1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
11 static_assert(sizeof(U
) == 0, "expected type failure");
20 auto g(); // expected-error{{return without trailing return type; deduced return types are a C++14 extension}}
21 decltype(auto) g2(); // expected-warning{{extension}} expected-error-re{{{{^}}deduced return types are a C++14 extension}}
24 int h() -> int; // expected-error{{trailing return type must specify return type 'auto', not 'int'}}
30 using T
= auto (int) -> auto (*)(char) -> void; // expected-note {{previous}}
31 using T
= void; // expected-error {{type alias redefinition with different types ('void' vs 'auto (int) -> auto (*)(char) -> void')}}
33 using U
= auto (int) -> auto (*)(char) -> void;
34 using U
= void (*(int))(char); // ok
39 auto i(T x
) -> decltype(x
)
44 only
<double> p1
= i(1.0);
49 auto f(T x
) -> T
{ return x
; }
52 auto g(T x
, U y
) -> decltype(x
+ y
)
60 auto h(T x
, U y
, V z
) -> decltype(x
+ y
+ z
)
67 nested
<U
> get_nested();
71 only
<int> p2
= xx
.f(0L);
72 only
<double> p3
= xx
.g(0L, 1.0);
73 only
<double> p4
= xx
.get_nested
<double>().h(0L, 1.0, 3.14f
);
77 auto f1(T t
) -> decltype(f1(t
)) {} // expected-note{{candidate template ignored}}
80 f1(0); // expected-error{{no matching function for call to 'f1'}}
84 auto f2(T t
) -> decltype(f2(&t
)) {} // expected-note{{candidate template ignored}}
87 f2(0); // expected-error{{no matching function for call to 'f2'}}
95 auto f() -> decltype(+*this); // expected-note {{here}}
96 auto f() -> decltype((*this)[0]); // expected-error {{cannot be overloaded}}
102 template <int N
> void f();
103 auto g()->decltype(this->f
<0>());
108 using A
= auto () -> auto; // expected-error {{'auto' not allowed in function return type}}
109 using B
= auto (*)() -> auto; // expected-error {{'auto' not allowed in function return type}}
110 template<auto (*)() -> auto> struct X
{}; // expected-error {{'auto' not allowed in function return type}}
111 template<typename T
> struct Y
{ T x
; };
112 Y
<auto() -> auto> y
; // expected-error {{'auto' not allowed in function return type}}