annotate gcc/testsuite/g++.dg/cpp0x/constexpr-object1.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // { dg-do compile { target c++11 } }
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 // From N2235
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 // 4.5.2 semantics
kono
parents:
diff changeset
6
kono
parents:
diff changeset
7 // p 1 constexpr specifier
kono
parents:
diff changeset
8 // objects, static const data
kono
parents:
diff changeset
9 struct A1 { int i; }; // { dg-message "no user-provided default constructor" }
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 constexpr int i1 = 1024;
kono
parents:
diff changeset
12 constexpr A1 a1 = A1();
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 // error: not a definition
kono
parents:
diff changeset
15 extern constexpr int i2; // { dg-error "definition" }
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 // error: missing initializer
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 111
diff changeset
18 constexpr A1 a2; // { dg-error "uninitialized 'const" }
111
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 const constexpr A1 a3 = A1();
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 volatile constexpr A1 a4 = A1(); // { dg-bogus "both .volatile. and .constexpr. cannot" }
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 // error: on type declaration
kono
parents:
diff changeset
25 constexpr struct pixel // { dg-error "cannot be used for type declarations" }
kono
parents:
diff changeset
26 {
kono
parents:
diff changeset
27 int x;
kono
parents:
diff changeset
28 int y;
kono
parents:
diff changeset
29 };