// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++1y %s -DCXX1Y
;
// A type is a literal type if it is:
// [C++1y] - void
constexpr void
// expected-error@-2 {{'void' is not a literal type}}
// - a scalar type
constexpr int
// - a reference type
;
constexpr int
;
extern BeingDefined beingdefined;
;
// - a class type that has all of the following properties:
// (implied) - it is complete
; // expected-note 2{{forward declaration of 'Incomplete'}}
;
constexpr Incomplete incomplete = ; // expected-error {{constexpr variable cannot have non-literal type 'const Incomplete'}} expected-note {{incomplete type 'const Incomplete' is not a literal type}}
constexpr Incomplete incomplete2 = ; // expected-error {{constexpr variable cannot have non-literal type 'const Incomplete[]'}} expected-note {{incomplete type 'const Incomplete[]' is not a literal type}}
constexpr ClassTemp<int> classtemplate = ;
constexpr ClassTemp<int> classtemplate2 = ;
// - it has a trivial destructor
;
constexpr int // expected-error {{'UserProvDtor' is not a literal type}}
;
constexpr int // expected-error {{'NonTrivDtor' is not a literal type}}
;
;
constexpr int // expected-error {{constexpr function's 1st parameter type 'DerivedFromNonTrivDtor<NonTrivDtorBase>' is not a literal type}}
;
constexpr int
;
constexpr int
// - it is an aggregate type or has at least one constexpr constructor or
// constexpr constructor template that is not a copy or move constructor
;
constexpr int
;
;
constexpr int // expected-error {{'CopyCtorOnly' is not a literal type}}
;
constexpr int // expected-error {{'MoveCtorOnly' is not a literal type}}
;
constexpr int // ok
constexpr int // ok, ctor is still constexpr
// We have a special-case diagnostic for classes with virtual base classes.
;
; // expected-note 2{{virtual base class declared here}}
;
;
constexpr int // expected-error {{constexpr function's 1st parameter type 'DerivedFromVBase<HasVBase>' is not a literal type}}
constexpr DerivedFromVBase<T> :
constexpr int nVBase = ; // expected-error {{constant expression}} expected-note {{cannot construct object of type 'DerivedFromVBase<HasVBase>' with virtual base class in a constant expression}}
// - it has all non-static data members and base classes of literal types
;
constexpr int // expected-error {{1st parameter type 'NonLitMember' is not a literal type}}
;
constexpr int // expected-error {{'NonLitBase' is not a literal type}}
;
;
constexpr int
constexpr int // expected-error {{not a literal type}}
// - an array of literal type [C++1y] other than an array of runtime bound
;
constexpr int
;
constexpr int // expected-error {{1st parameter type 'ArrBad' is not a literal type}}
constexpr int
// expected-warning@+1 {{variable length array folded to constant array as an extension}}
constexpr long Overflow; // expected-warning {{requires 34 bits to represent}}