llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) <details> <summary>Changes</summary> We can't pass the AtomicType along to ASTContext::getFloatTypeSemantics. --- Full diff: https://github.com/llvm/llvm-project/pull/132782.diff 2 Files Affected: - (modified) clang/lib/AST/ByteCode/Compiler.cpp (+3) - (modified) clang/test/AST/ByteCode/floats.cpp (+4-1) ``````````diff diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index 943e4302a0398..5242a524308a8 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -4033,6 +4033,9 @@ template <class Emitter> bool Compiler<Emitter>::visitBool(const Expr *E) { template <class Emitter> bool Compiler<Emitter>::visitZeroInitializer(PrimType T, QualType QT, const Expr *E) { + if (const auto *AT = QT->getAs<AtomicType>()) + QT = AT->getValueType(); + switch (T) { case PT_Bool: return this->emitZeroBool(E); diff --git a/clang/test/AST/ByteCode/floats.cpp b/clang/test/AST/ByteCode/floats.cpp index 45c31c759e47f..930921d0eee1f 100644 --- a/clang/test/AST/ByteCode/floats.cpp +++ b/clang/test/AST/ByteCode/floats.cpp @@ -175,7 +175,10 @@ namespace ZeroInit { static_assert(a.f == 0.0f, ""); constexpr A<double> b{12}; - static_assert(a.f == 0.0, ""); + static_assert(b.f == 0.0, ""); + + constexpr A<_Atomic(float)> c{12}; + static_assert(c.f == 0.0, ""); }; namespace LongDouble { `````````` </details> https://github.com/llvm/llvm-project/pull/132782 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits