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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// { dg-options -std=c++0x }
2
 
3
namespace std { template  T&& declval(); }
4
 
5
template
6
  class is_constructible_mini
7
  {
8
    typedef char __one;
9
    typedef struct { char __arr[2]; } __two;
10
 
11
    template
12
      static decltype(::new _Tp1(std::declval<_Args1>()...), __one())
13
      __test(int);
14
 
15
    template
16
      static __two __test(...);
17
 
18
  public:
19
    static const bool value = sizeof(__test<_Tp, _Args...>(0)) == 1;
20
  };
21
 
22
/*
23
template
24
  class is_constructible_mini<_Tp>
25
  {
26
    typedef char __one;
27
    typedef struct { char __arr[2]; } __two;
28
 
29
    template
30
      static decltype(::new _Tp1, __one()) __test(int);
31
 
32
    template
33
      static __two __test(...);
34
 
35
  public:
36
    static const bool value
37
    = sizeof(__test::type>(0)) == 1;
38
  };
39
*/
40
 
41
struct A
42
{
43
  A(int);
44
};
45
 
46
struct B { };
47
 
48
static_assert( is_constructible_mini::value, "");
49
static_assert( is_constructible_mini::value, "");
50
static_assert( !is_constructible_mini::value, "");
51
 
52
static_assert( !is_constructible_mini::value, "");  // doesn't compile without the
53
                                                       // partial specialization
54
 
55
static_assert( is_constructible_mini::value, "");
56
static_assert( is_constructible_mini::value, "");

powered by: WebSVN 2.1.0

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