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 {
1703
1703
bool checkNullPointerDiagnosingWith(const GenDiagType &GenDiag) {
1704
1704
if (Designator.Invalid)
1705
1705
return false;
1706
- if (IsNullPtr ) {
1706
+ if (getLValueBase().isNull() ) {
1707
1707
GenDiag();
1708
1708
Designator.setInvalid();
1709
1709
return false;
Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ namespace UndefinedBehavior {
188
188
189
189
namespace Ptr {
190
190
struct A {};
191
- struct B : A { int n; };
191
+ struct B : A { int n; int m; };
192
192
B a[3 ][3 ];
193
193
constexpr B *p = a[0 ] + 4 ; // expected-error {{constant expression}} expected-note {{element 4 of array of 3 elements}}
194
194
B b = {};
@@ -204,6 +204,7 @@ namespace UndefinedBehavior {
204
204
static_assert ((A*)nb == 0 , " " );
205
205
static_assert ((B*)na == 0 , " " );
206
206
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}}
207
208
constexpr const int *np1 = (int *)nullptr + 0 ; // ok
208
209
constexpr const int *np2 = &(*(int (*)[4 ])nullptr )[0 ]; // ok
209
210
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