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) {
21462146 if (Value.getLValueCallIndex())
21472147 return false;
21482148 const Expr *E = Value.Base.dyn_cast<const Expr*>();
2149- return E && !isa<MaterializeTemporaryExpr>(E);
2149+ return E && !isa<MaterializeTemporaryExpr, StringLiteral >(E);
21502150}
21512151
21522152static bool IsWeakLValue(const LValue &Value) {
Original file line number Diff line number Diff line change @@ -108,22 +108,16 @@ constexpr auto p2 = "test2";
108108constexpr bool b1 = foo(p1) == foo(p1);
109109static_assert (b1);
110110
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);
116113
117114constexpr auto name1 () { return " name1" ; }
118115constexpr auto name2 () { return " name2" ; }
119116
120117constexpr auto b3 = name1() == name1();
121118static_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);
127121
128122namespace UninitializedFields {
129123 class A {
Original file line number Diff line number Diff line change @@ -358,11 +358,9 @@ struct Str {
358358
359359extern char externalvar[];
360360constexpr 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}}
364362static_assert (0 != " foo" , " " );
365-
363+ static_assert ( " foo " != " foo " , " " ); // cxx20_23-warning {{comparison between two arrays is deprecated}}
366364}
367365
368366namespace MaterializeTemporary {
You can’t perform that action at this time.
0 commit comments