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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [sfinae2.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
// PR c++/44967
2
// { dg-options -std=c++0x }
3
 
4
template  T&& declval();
5
 
6
template
7
struct has_construct
8
{
9
    typedef char one;
10
    typedef struct {char _m[2]; } two;
11
 
12
    template
13
    static decltype(declval().construct(declval(), declval()...), one()) test(int);
14
    template
15
    static two test(...);
16
 
17
    static const bool value = sizeof(test(0)) == 1;
18
};
19
 
20
 
21
struct A0
22
{};
23
 
24
struct A1
25
{
26
    void construct(int*, int);
27
};
28
 
29
template
30
struct A2
31
{
32
  template
33
  void construct(_Tp1*, _Args&&...) {}
34
};
35
 
36
#define SA(X) static_assert(X,#X)
37
SA((!has_construct::value)); // ok
38
SA((has_construct::value)); // bang
39
SA((has_construct, int>::value)); // bang

powered by: WebSVN 2.1.0

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