1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -Wno-c99-designator %s
6 decltype(0, f0()) i
= 0;
10 struct A
{ int a
[1]; A() { } };
13 float &f2(int const*);
16 float &fr
= f2(AC().a
);
24 auto call(F
&& fn
) -> decltype(fn(T())) {
28 template <class B
, class F
>
29 auto then(F
&& fn
) -> decltype(call(fn
))
37 f1
.call([](int){ return Future
<float>(0); });
42 A(decltype(nullptr) param
);
46 template<typename T
> struct S
{};
47 template<typename T
> auto f(T t
) -> decltype(S
<int>(t
)) {
48 using U
= decltype(S
<int>(t
));
54 B(decltype(undeclared
)); // expected-error {{undeclared identifier}}
57 C(decltype(undeclared
; // expected-error {{undeclared identifier}} \
58 // expected-error {{expected ')'}} expected-note {{to match this '('}}
63 template <typename T
> struct S
{
64 static decltype(T
{}, U
{}) &f();
70 struct A
{ ~A() = delete; }; // expected-note +{{here}}
72 decltype(f()) *a
; // ok, function call
73 decltype(A()) *b
; // expected-error {{attempt to use a deleted function}}
74 decltype(0, f()) *c
; // ok, function call on RHS of comma
75 decltype(0, A()) *d
; // expected-error {{attempt to use a deleted function}}
76 decltype(f(), 0) *e
; // expected-error {{attempt to use a deleted function}}
80 struct P1
{ char x
[6]; } g1
= { "foo" };
81 struct LP1
{ struct P1 p1
; };
83 // expected-warning@+3 {{initializer partially overrides}}
84 // expected-note@+2 {{previous initialization}}
85 // expected-note@+1 {{previous definition}}
86 template<class T
> void foo(decltype(T(LP1
{ .p1
= g1
, .p1
.x
[1] = 'x' }))) {}
88 // expected-warning@+3 {{initializer partially overrides}}
89 // expected-note@+2 {{previous initialization}}
91 void foo(decltype(T(LP1
{ .p1
= g1
, .p1
.x
[1] = 'r' }))) {} // okay
93 // expected-warning@+3 {{initializer partially overrides}}
94 // expected-note@+2 {{previous initialization}}
96 void foo(decltype(T(LP1
{ .p1
= { "foo" }, .p1
.x
[1] = 'x'}))) {} // okay
98 // expected-warning@+3 {{initializer partially overrides}}
99 // expected-note@+2 {{previous initialization}}
100 // expected-error@+1 {{redefinition of 'foo'}}
101 template<class T
> void foo(decltype(T(LP1
{ .p1
= g1
, .p1
.x
[1] = 'x' }))) {}
108 // FIXME: The diagnostics here are produced twice.
109 void foo(conditional
<decltype((1),int>) { // expected-note 2 {{to match this '('}} expected-error {{expected ')'}} expected-note 2{{to match this '<'}}
110 } // expected-error {{expected function body after function declarator}} expected-error 2 {{expected '>'}} expected-error {{expected ')'}}