File tree Expand file tree Collapse file tree 3 files changed +7
-15
lines changed Expand file tree Collapse file tree 3 files changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -2146,7 +2146,7 @@ static bool IsLiteralLValue(const LValue &Value) {
2146
2146
if (Value.getLValueCallIndex())
2147
2147
return false;
2148
2148
const Expr *E = Value.Base.dyn_cast<const Expr*>();
2149
- return E && !isa<MaterializeTemporaryExpr>(E);
2149
+ return E && !isa<MaterializeTemporaryExpr, StringLiteral >(E);
2150
2150
}
2151
2151
2152
2152
static bool IsWeakLValue(const LValue &Value) {
Original file line number Diff line number Diff line change @@ -108,22 +108,16 @@ constexpr auto p2 = "test2";
108
108
constexpr bool b1 = foo(p1) == foo(p1);
109
109
static_assert (b1);
110
110
111
- constexpr bool b2 = foo(p1) == foo(p2); // ref-error {{must be initialized by a constant expression}} \
112
- // ref-note {{comparison of addresses of literals}} \
113
- // ref-note {{declared here}}
114
- static_assert (!b2); // ref-error {{not an integral constant expression}} \
115
- // ref-note {{not a constant expression}}
111
+ constexpr bool b2 = foo(p1) == foo(p2);
112
+ static_assert (!b2);
116
113
117
114
constexpr auto name1 () { return " name1" ; }
118
115
constexpr auto name2 () { return " name2" ; }
119
116
120
117
constexpr auto b3 = name1() == name1();
121
118
static_assert (b3);
122
- constexpr auto b4 = name1() == name2(); // ref-error {{must be initialized by a constant expression}} \
123
- // ref-note {{has unspecified value}} \
124
- // ref-note {{declared here}}
125
- static_assert (!b4); // ref-error {{not an integral constant expression}} \
126
- // ref-note {{not a constant expression}}
119
+ constexpr auto b4 = name1() == name2();
120
+ static_assert (!b4);
127
121
128
122
namespace UninitializedFields {
129
123
class A {
Original file line number Diff line number Diff line change @@ -358,11 +358,9 @@ struct Str {
358
358
359
359
extern char externalvar[];
360
360
constexpr bool constaddress = (void *)externalvar == (void *)0x4000UL ; // expected-error {{must be initialized by a constant expression}} expected-note {{reinterpret_cast}}
361
- constexpr bool litaddress = " foo" == " foo" ; // expected-error {{must be initialized by a constant expression}}
362
- // expected-note@-1 {{comparison of addresses of literals has unspecified value}}
363
- // cxx20_23-warning@-2 {{comparison between two arrays is deprecated}}
361
+ constexpr bool litaddress = " foo" == " foo" ; // cxx20_23-warning {{comparison between two arrays is deprecated}}
364
362
static_assert (0 != " foo" , " " );
365
-
363
+ static_assert ( " foo " != " foo " , " " ); // cxx20_23-warning {{comparison between two arrays is deprecated}}
366
364
}
367
365
368
366
namespace MaterializeTemporary {
You can’t perform that action at this time.
0 commit comments