1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 
3 // PR5290
4 int const f0();
5 void f0_test() {
6   decltype(0, f0()) i = 0;
7   i = 0;
8 }
9 
10 struct A { int a[1]; A() { } };
11 typedef A const AC;
12 int &f1(int*);
13 float &f2(int const*);
14 
15 void test_f2() {
16   float &fr = f2(AC().a);
17 }
18 
19 namespace pr10154 {
20   class A{
21       A(decltype(nullptr) param);
22   };
23 }
24 
25 template<typename T> struct S {};
26 template<typename T> auto f(T t) -> decltype(S<int>(t)) {
27   using U = decltype(S<int>(t));
28   using U = S<int>;
29   return S<int>(t);
30 }
31 
32 struct B {
33   B(decltype(undeclared)); // expected-error {{undeclared identifier}}
34 };
35 struct C {
36   C(decltype(undeclared; // expected-error {{undeclared identifier}} \
37                          // expected-error {{expected ')'}} expected-note {{to match this '('}}
38 };
39 
40 namespace PR16529 {
41   struct U {};
42   template <typename T> struct S {
43     static decltype(T{}, U{}) &f();
44   };
45   U &r = S<int>::f();
46 }
47 
48 namespace PR18876 {
49   struct A { ~A() = delete; }; // expected-note +{{here}}
50   A f();
51   decltype(f()) *a; // ok, function call
52   decltype(A()) *b; // expected-error {{attempt to use a deleted function}}
53   decltype(0, f()) *c; // ok, function call on RHS of comma
54   decltype(0, A()) *d; // expected-error {{attempt to use a deleted function}}
55   decltype(f(), 0) *e; // expected-error {{attempt to use a deleted function}}
56 }
57 
58 template<typename>
59 class conditional {
60 };
61 
62 void foo(conditional<decltype((1),int>) {  // expected-note 2 {{to match this '('}} expected-error {{expected ')'}}
63 } // expected-error {{expected function body after function declarator}} expected-error 2 {{expected '>'}} expected-error {{expected ')'}}
64