[clang] [Clang] Handle deduced auto types within AtomicType (PR #197874)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 23 09:26:01 PDT 2026


================
@@ -3742,7 +3742,14 @@ CheckOriginalCallArgDeduction(Sema &S, TemplateDeductionInfo &Info,
   QualType OriginalParamType = OriginalArg.OriginalParamType;
 
   // Check for type equality (top-level cv-qualifiers are ignored).
-  if (Context.hasSameUnqualifiedType(A, DeducedA))
+  // Also handle _Atomic(auto) deduction: SubstituteDeducedTypeTransform strips
+  // _Atomic from the function parameter so deduction succeeds against a
+  // non-atomic argument, then the final substitution re-wraps the result in
+  // _Atomic. DeducedA will be _Atomic(T) while A is T in that case.
+  if (Context.hasSameUnqualifiedType(A, DeducedA) ||
+      (DeducedA->isAtomicType() &&
+       Context.hasSameUnqualifiedType(
+           A, cast<AtomicType>(DeducedA)->getValueType())))
----------------
mizvekov wrote:

FWIW, it would be simpler to state that Atomic is treated as a qualifier, and we want to compare if the types are the same ignoring any qualifiers.

https://github.com/llvm/llvm-project/pull/197874


More information about the cfe-commits mailing list