xref: /minix3/external/bsd/llvm/dist/clang/test/CXX/stmt.stmt/stmt.ambig/p1-0x.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc struct T {
4*f4a2713aSLionel Sambuc   struct x {
5*f4a2713aSLionel Sambuc     int m;
6*f4a2713aSLionel Sambuc   };
7*f4a2713aSLionel Sambuc   x* operator->();
8*f4a2713aSLionel Sambuc   void operator++(int);
9*f4a2713aSLionel Sambuc   void operator<<(int);
10*f4a2713aSLionel Sambuc   T();
11*f4a2713aSLionel Sambuc   T(int);
12*f4a2713aSLionel Sambuc   T(int, int);
13*f4a2713aSLionel Sambuc };
14*f4a2713aSLionel Sambuc 
15*f4a2713aSLionel Sambuc template<typename A, typename B, typename C, typename D, typename E>
16*f4a2713aSLionel Sambuc void func(A, B, C, D, E);
17*f4a2713aSLionel Sambuc 
func(int a,int c)18*f4a2713aSLionel Sambuc void func(int a, int c) {
19*f4a2713aSLionel Sambuc   T(a)->m = 7;
20*f4a2713aSLionel Sambuc   T(a)++;
21*f4a2713aSLionel Sambuc   T(a,5)<<c;
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc   T(*d)(int);
24*f4a2713aSLionel Sambuc   T(e)[5];
25*f4a2713aSLionel Sambuc   T(f) = {1, 2};
26*f4a2713aSLionel Sambuc   T(*g)(double(3)); // expected-error{{cannot initialize a variable of type 'T (*)' with an rvalue of type 'double'}}
27*f4a2713aSLionel Sambuc   func(a, d, e, f, g);
28*f4a2713aSLionel Sambuc }
29*f4a2713aSLionel Sambuc 
func2(int a,int c)30*f4a2713aSLionel Sambuc void func2(int a, int c) {
31*f4a2713aSLionel Sambuc   decltype(T())(a)->m = 7;
32*f4a2713aSLionel Sambuc   decltype(T())(a)++;
33*f4a2713aSLionel Sambuc   decltype(T())(a,5)<<c;
34*f4a2713aSLionel Sambuc 
35*f4a2713aSLionel Sambuc   decltype(T())(*d)(int);
36*f4a2713aSLionel Sambuc   decltype(T())(e)[5];
37*f4a2713aSLionel Sambuc   decltype(T())(f) = {1, 2};
38*f4a2713aSLionel Sambuc   decltype(T())(*g)(double(3)); // expected-error{{cannot initialize a variable of type 'decltype(T()) (*)' (aka 'T *') with an rvalue of type 'double'}}
39*f4a2713aSLionel Sambuc   func(a, d, e, f, g);
40*f4a2713aSLionel Sambuc }
41