diff options
| author | Timm Baeder <tbaeder@redhat.com> | 2024-10-01 17:09:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-01 17:09:26 +0200 |
| commit | 55c70f6d893452d3b7b2005bc6b5d208f2e840ba (patch) | |
| tree | d3723bff3d0360d49ef5d68ed855f0733d914c6a /clang/test/AST/ByteCode/records.cpp | |
| parent | 16ba126a1465f6194c1f39a15740d72d30379c73 (diff) | |
[clang][bytecode] Check GetPtrBase ops for null pointers (#110673)
Diffstat (limited to 'clang/test/AST/ByteCode/records.cpp')
| -rw-r--r-- | clang/test/AST/ByteCode/records.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/AST/ByteCode/records.cpp b/clang/test/AST/ByteCode/records.cpp index 7e3cf5b94518..215f26bd5da8 100644 --- a/clang/test/AST/ByteCode/records.cpp +++ b/clang/test/AST/ByteCode/records.cpp @@ -1653,3 +1653,11 @@ namespace ExprWithCleanups { constexpr auto F = true ? 1i : 2i; static_assert(F == 1i, ""); } + +namespace NullptrUpcast { + struct A {}; + struct B : A { int n; }; + constexpr B *nb = nullptr; + constexpr A &ra = *nb; // both-error {{constant expression}} \ + // both-note {{cannot access base class of null pointer}} +} |
