File tree Expand file tree Collapse file tree 1 file changed +20
-21
lines changed
Expand file tree Collapse file tree 1 file changed +20
-21
lines changed Original file line number Diff line number Diff line change @@ -68,41 +68,40 @@ consteval int ok5() {
6868 } s;
6969 new (&s) S[1 ]{{12 , 13 }};
7070
71+ // / FIXME: Broken in the current interpreter.
72+ #if BYTECODE
73+ return s.a + s.b ;
74+ #else
7175 return 25 ;
72- // return s.a + s.b; FIXME: Broken in the current interpreter.
76+ # endif
7377}
7478static_assert (ok5() == 25 );
7579
76- // / FIXME: Broken in both interpreters.
77- #if 0
78- consteval int ok5() {
80+ consteval int ok6 () {
81+ int i[2 ];
82+ new (i) int (100 );
83+ new (i + 1 ) int (200 );
84+ return i[0 ] + i[1 ];
85+ }
86+ static_assert (ok6() == 300 );
87+
88+ // / FIXME: Broken in the current interpreter.
89+ #if BYTECODE
90+ consteval int ok7 () {
7991 int i;
80- new (&i) int[1]{1}; // expected-note {{assignment to dereferenced one-past-the-end pointer}}
92+ new (&i) int [1 ]{1 };
8193 return i;
8294}
83- static_assert(ok5() == 1); // expected-error {{not an integral constant expression}} \
84- // expected-note {{in call to}}
85- #endif
95+ static_assert (ok7() == 1 );
8696
87- // / FIXME: Crashes the current interpreter.
88- #if 0
89- consteval int ok6() {
97+ consteval int ok8 () {
9098 int i[2 ];
9199 new (&i) int (100 );
92100 return i[0 ];
93101}
94- static_assert(ok6 () == 100);
102+ static_assert (ok8 () == 100 );
95103#endif
96104
97- consteval int ok6 () {
98- int i[2 ];
99- new (i) int (100 );
100- new (i + 1 ) int (200 );
101- return i[0 ] + i[1 ];
102- }
103- static_assert (ok6() == 300 );
104-
105-
106105consteval auto fail1 () {
107106 int b;
108107 new (&b) float (1.0 ); // both-note {{placement new would change type of storage from 'int' to 'float'}}
You can’t perform that action at this time.
0 commit comments