diff options
Diffstat (limited to 'test/CXX/dcl.dcl')
-rw-r--r-- | test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp | 6 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp | 4 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp | 4 |
3 files changed, 12 insertions, 2 deletions
diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp index 3c250f9..e713d72 100644 --- a/test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp @@ -15,6 +15,12 @@ enum alignas(1) E1 {}; // expected-error {{requested alignment is less than mini enum alignas(1) E2 : char {}; // ok enum alignas(4) E3 { e3 = 0 }; // ok enum alignas(4) E4 { e4 = 1ull << 33 }; // expected-error {{requested alignment is less than minimum alignment of 8 for type 'E4'}} +enum alignas(8) E5 {}; +static_assert(alignof(E5) == 8, ""); + +typedef __attribute__((aligned(16))) int IntAlign16; +enum E6 : IntAlign16 {}; +static_assert(alignof(E6) == 4, ""); struct S1 { alignas(8) int n; diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp index 1e3734e..3986dc9 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp @@ -36,6 +36,8 @@ struct T : SS, NonLiteral { constexpr int ImplicitlyVirtual() const { return 0; } // expected-error {{virtual function cannot be constexpr}} + virtual constexpr int OutOfLineVirtual() const; // expected-error {{virtual function cannot be constexpr}} + // - its return type shall be a literal type; constexpr NonLiteral NonLiteralReturn() const { return {}; } // expected-error {{constexpr function's return type 'NonLiteral' is not a literal type}} constexpr void VoidReturn() const { return; } @@ -67,6 +69,8 @@ struct T : SS, NonLiteral { // expected-error@-5 {{defaulted definition of copy assignment operator is not constexpr}} #endif }; + +constexpr int T::OutOfLineVirtual() const { return 0; } #ifdef CXX1Y struct T2 { int n = 0; diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp index 5f102e7..0aaedcc 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp @@ -17,7 +17,7 @@ extern int (*const d)(int); // A variable declaration which uses the constexpr specifier shall have an // initializer and shall be initialized by a constant expression. -constexpr int ni1; // expected-error {{default initialization of an object of const type 'const int'}} expected-note {{add an explicit initializer to initialize 'ni1'}} +constexpr int ni1; // expected-error {{default initialization of an object of const type 'const int'}} constexpr struct C { C(); } ni2; // expected-error {{cannot have non-literal type 'const struct C'}} expected-note 3{{has no constexpr constructors}} constexpr double &ni3; // expected-error {{declaration of reference variable 'ni3' requires an initializer}} @@ -34,4 +34,4 @@ struct pixel { int x, y; }; constexpr pixel ur = { 1294, 1024 }; // ok -constexpr pixel origin; // expected-error {{default initialization of an object of const type 'const pixel' without a user-provided default constructor}} expected-note {{add an explicit initializer to initialize 'origin'}} +constexpr pixel origin; // expected-error {{default initialization of an object of const type 'const pixel' without a user-provided default constructor}} |