// RUN: %clang_cc1 -verify -std=c++2b -verify=expected,cxx2b %s
// RUN: %clang_cc1 -verify -std=c++20 -verify=expected,cxx14_20 %s
// RUN: %clang_cc1 -verify -std=c++14 -verify=expected,cxx14_20 %s
int i;
int &&;
void ; // expected-note {{possible target}}
using Int = int;
using IntLRef = int&;
using IntRRef = int&&;
using InitListInt = std::initializer_list<int>;
using IntPtr = int*;
auto x3a = i;
decltype x3d = i;
using Int = decltype;
using Int = decltype;
auto x4a = ;
decltype x4d = ;
using Int = decltype;
using IntLRef = decltype; // cxx2b-note {{previous definition is here}}
auto x5a = ;
decltype x5d = ;
using Int = decltype;
using IntRRef = decltype;
auto x6a = ;
decltype x6d = ; // expected-error {{cannot deduce 'decltype(auto)' from initializer list}}
using InitListInt = decltype;
auto *x7a = &i;
decltype *x7d = &i; // expected-error {{cannot form pointer to 'decltype(auto)'}}
using IntPtr = decltype;
;
decltype ;
decltype ; // expected-error {{'decltype(auto)' can only be used as a return type in a function declaration}} expected-error {{requires an initializer}}
decltype *; // expected-error {{cannot form pointer to 'decltype(auto)'}}
const decltype ; // expected-error {{'decltype(auto)' cannot be combined with other type specifiers}}
typedef decltype ; // expected-error {{'decltype(auto)' not allowed in typedef}}
decltype ; // ok
decltype ; // expected-error {{'decltype(auto)' can only be used as a return type in a function declaration}}
decltype ; // expected-error {{'decltype(auto)' can only be used as a return type in a function declaration}} expected-error {{requires an initializer}}
decltype &; // expected-error {{cannot form reference to 'decltype(auto)'}}
decltype ; // expected-error {{cannot form array of 'decltype(auto)'}}
decltype = 0; // ok
decltype v2 = ; // expected-error {{cannot form array of 'decltype(auto)'}}
decltype &v3 = ; // expected-error {{cannot form reference to 'decltype(auto)'}}
decltype *v4 = ; // expected-error {{cannot form pointer to 'decltype(auto)'}}
decltype v5 = &overloaded_fn; // expected-error {{could not be resolved}}
auto multi1a = 0, &multi1b = multi1a;
auto multi1c = multi1a, multi1d = multi1b;
decltype multi1e = multi1a, multi1f = multi1b; // expected-error {{'decltype(auto)' deduced as 'int' in declaration of 'multi1e' and deduced as 'int &' in declaration of 'multi1f'}}
auto
decltype
using Int = decltype;
using Int = decltype;
auto
decltype
using Int = decltype;
using Int = decltype;
auto
decltype // expected-warning {{reference to stack memory}}
using Int = decltype;
using IntLRef = decltype; // cxx2b-error {{type alias redefinition with different types ('decltype(f3d(0))' (aka 'int &&') vs 'decltype(x4d)' (aka 'int &'))}}
auto
decltype
using Int = decltype;
using IntRRef = decltype;
auto
auto
decltype
decltype // cxx14_20-error {{rvalue reference to type 'int' cannot bind to lvalue}}
using Int = decltype;
using Int = decltype;
using Int = decltype;
auto // expected-error {{cannot deduce return type from initializer list}}
decltype // expected-error {{cannot deduce return type from initializer list}}