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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-dev/] [fsf-gcc-snapshot-1-mar-12/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [regress/] [condition1.C] - Blame information for rev 783

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// PR c++/47950
2
// { dg-options -std=c++0x }
3
 
4
template  struct empty
5
{
6
   // allow success case to build (not relevant to bug)
7
   operator bool() { return true; }
8
};
9
 
10
template  struct from_int
11
{
12
   from_int(int) {}
13
 
14
   // allow success case to build (not relevant to bug)
15
   operator bool() { return true; }
16
};
17
 
18
template 
19
from_int via_function(T v)
20
{
21
   return from_int(v);
22
}
23
 
24
template 
25
void f()
26
{
27
   // ********* this section compiles ***********
28
 
29
   // these plain initializers work fine
30
   from_int a = 7;
31
   from_int b = from_int(7);
32
   empty    c = empty();
33
   from_int ta = 7;
34
   from_int tb = from_int(7);
35
   empty    tc = empty();
36
 
37
   // these dependent condition decls work fine
38
   if (empty x = empty())
39
      ;
40
   if (from_int x = 7)
41
      ;
42
   if (from_int x = from_int(7))
43
      ;
44
   if (from_int x = via_function(T()))
45
      ;
46
 
47
   // this non-dependent condition decl using conversion works fine
48
   if (from_int x = 7)
49
      ;
50
 
51
   // these non-dependent condition decls using conversion or braced-
52
   // initialization work fine (in c++0x mode only course)
53
   #if __GXX_EXPERIMENTAL_CXX0X__
54
   if (empty x {})
55
      ;
56
   if (from_int x {7})
57
      ;
58
   #endif
59
 
60
   // ********** this section fails in C++0x ***********
61
 
62
   // the following non-dependent condition decls cause an assertion
63
   // failure in
64
   //
65
   //   tsubst_copy_and_build, at cp/pt.c:13370
66
   //
67
   // in C++0x mode
68
   //
69
   if (empty x = empty())
70
      ;
71
   if (from_int x = from_int(7))
72
      ;
73
   if (from_int x = via_function(7))
74
      ;
75
}
76
 
77
int main()
78
{
79
   f();
80
}

powered by: WebSVN 2.1.0

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