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