File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1703,7 +1703,7 @@ namespace {
17031703 bool checkNullPointerDiagnosingWith(const GenDiagType &GenDiag) {
17041704 if (Designator.Invalid)
17051705 return false;
1706- if (IsNullPtr ) {
1706+ if (getLValueBase().isNull() ) {
17071707 GenDiag();
17081708 Designator.setInvalid();
17091709 return false;
Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ namespace UndefinedBehavior {
188188
189189 namespace Ptr {
190190 struct A {};
191- struct B : A { int n; };
191+ struct B : A { int n; int m; };
192192 B a[3 ][3 ];
193193 constexpr B *p = a[0 ] + 4 ; // expected-error {{constant expression}} expected-note {{element 4 of array of 3 elements}}
194194 B b = {};
@@ -204,6 +204,7 @@ namespace UndefinedBehavior {
204204 static_assert ((A*)nb == 0 , " " );
205205 static_assert ((B*)na == 0 , " " );
206206 constexpr const int &nf = nb->n; // expected-error {{constant expression}} expected-note {{cannot access field of null pointer}}
207+ constexpr const int &mf = nb->m; // expected-error {{constant expression}} expected-note {{cannot access field of null pointer}}
207208 constexpr const int *np1 = (int *)nullptr + 0 ; // ok
208209 constexpr const int *np2 = &(*(int (*)[4 ])nullptr )[0 ]; // ok
209210 constexpr const int *np3 = &(*(int (*)[4 ])nullptr )[2 ]; // expected-error {{constant expression}} expected-note {{cannot perform pointer arithmetic on null pointer}}
You can’t perform that action at this time.
0 commit comments