================
@@ -78,7 +78,13 @@ namespace {
// the qualifier.
if (!S.Context.getLangOpts().ObjC && !DestType->isRecordType() &&
!DestType->isArrayType() && !DestType.getPointerAuth()) {
- DestType = DestType.getAtomicUnqualifiedType();
+ if (S.Context.getLangOpts().CPlusPlus) {
+ // Note that in C++, _Atomic(T) is a distinct type, not a
+ // cv-qualifier, so it is not stripped.
+ DestType = DestType.getUnqualifiedType();
+ } else {
+ DestType = DestType.getAtomicUnqualifiedType();
+ }
----------------
AaronBallman wrote:
I'm also not yet convinced this is correct (or incorrect either, this is
complicated stuff). Consider this example:
```
struct S {
int get() const { return a; }
int a;
};
void static_cast_non_atomic_to_atomic() {
int i;
struct S s;
i = static_cast<_Atomic S>(s).get();
}
```
https://godbolt.org/z/s4MdYbrn9
The original code would have stripped the `_Atomic` qualifier here, so what's
causing the "can't access an atomic object" diagnostics?
https://github.com/llvm/llvm-project/pull/207616
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits