OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [udlit-namespace.C] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do run }
2
// { dg-options "-std=c++0x" }
3
 
4
// Test user-defined literals.
5
// Test simple operator declaration and definition in namespaces.
6
 
7
#include 
8
#include 
9
 
10
namespace Long
11
{
12
  long double operator"" _LL(long double);
13
}
14
 
15
namespace Short
16
{
17
  short
18
  operator"" _SS(long double x)
19
  { return std::fmod(x, static_cast(std::numeric_limits::max())); }
20
}
21
 
22
void
23
test1()
24
{
25
  long double x = Long::operator "" _LL(1.2L);
26
 
27
  using namespace Short;
28
  short s = operator"" _SS(1.2L);
29
  short s2 = 1.2_SS;
30
}
31
 
32
int
33
main()
34
{
35
  test1();
36
}
37
 
38
namespace Long
39
{
40
  long double
41
  operator"" _LL(long double x)
42
  { return x + 2.0L; }
43
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.