// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx17 -std=c++98 %s -Wno-c++11-extensions
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx17 -std=c++17 %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx20 -std=c++20 %s
// C++98:
// A non-type template-parameter shall not be declared to have
// floating point, class, or void type.
; // expected-note {{forward declaration}}
; // cxx17-error{{cannot have type}}
; //OK
; //OK
; // expected-error{{has incomplete type 'A'}}
;
; // cxx17-error{{cannot have type 'A' before C++20}}
typedef void VOID;
; // expected-error{{has incomplete type 'VOID'}}
// C++11 disallows rvalue references.
;
; // expected-warning 0-1{{extension}} expected-error {{non-type template parameter has rvalue reference type 'int &&'}}
// C++20 requires a structural type. In addition to the above cases, this allows:
// arbitrary scalar types; we generally include complex types in that list
; // cxx17-error {{cannot have type '_Complex float' before C++20}}
; // cxx17-error {{cannot have type '_Complex int' before C++20}}
;
// atomic types aren't scalar types
; // expected-error {{cannot have type '_Atomic(float)'}}
; // expected-error {{cannot have type '_Atomic(int)'}}
// we allow vector types as an extension
typedef int VI4;
typedef float VF4;
; // cxx17-error {{cannot have type 'VI4'}}
; // cxx17-error {{cannot have type 'VF4'}}
;
;
// class types with all public members and bases, no mutable state, and no rvalue references.
;
; // cxx17-error {{cannot have type 'B'}}
; // cxx17-error {{cannot have type 'RRef'}}
// cxx20-error@-1 {{type 'RRef' of non-type template parameter is not a structural type}}
; // cxx20-note {{'BadBase' is not a structural type because it has a base class of non-structural type 'RRef'}}
; // cxx17-error {{cannot have type}} cxx20-error {{is not a structural type}}
;
; // cxx17-error {{cannot have type}} cxx20-error {{is not a structural type}}
;
; // cxx17-error {{cannot have type}} cxx20-error {{is not a structural type}}
; // cxx20-note {{'ProtectedBase' is not a structural type because it has a base class that is not public}}
; // cxx17-error {{cannot have type}} cxx20-error {{is not a structural type}}
; // cxx20-note {{'PrivateBase' is not a structural type because it has a base class that is not public}}
; // cxx17-error {{cannot have type}} cxx20-error {{is not a structural type}}
; // cxx20-note {{'Private2Base' is not a structural type because it has a base class that is not public}}
; // cxx17-error {{cannot have type}} cxx20-error {{is not a structural type}}
;
; // cxx17-error {{cannot have type}} cxx20-error {{is not a structural type}}
;
; // cxx17-error {{cannot have type}} cxx20-error {{is not a structural type}}
;
; // cxx17-error {{cannot have type}} cxx20-error {{is not a structural type}}
;
; // cxx17-error {{cannot have type}} cxx20-error {{is not a structural type}}
; // cxx20-note 2{{has a non-static data member of non-structural type}}
; // cxx17-error {{cannot have type}} cxx20-error {{is not a structural type}}
; // cxx17-error {{cannot have type}} cxx20-error {{is not a structural type}}