| Issue |
203328
|
| Summary |
crash in constant evaluation: member call on this inside an _Atomic-wrapped object with a base class
|
| Labels |
crash-on-valid,
constexpr
|
| Assignees |
|
| Reporter |
ahatanak
|
clang crashes during constant evaluation when a constexpr constructor calls a non-virtual member function through `this`, the object has a base class, and the object is being constructed inside an `_Atomic(...)` data member. The crash happens while checking the dynamic type of the `this` pointer; `getBaseIndex` calls `CXXRecordDecl::bases_begin()` on a null `CXXRecordDecl`.
Reproducer:
$ cat test.cpp
```
struct StorageBase {
constexpr void construct(int) {}
};
struct Optional : StorageBase {
constexpr Optional(int x) { construct(x); }
};
struct atomic_base {
_Atomic(Optional) val;
constexpr atomic_base(int x) : val(Optional(x)) {}
};
```
atomic_base g(0);
$ clang++ -std=c++17 -fsyntax-only test.cpp
This is not a recent regression: it reproduces back to at least clang 14.0.0, so it has been present for many releases.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs