================
@@ -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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to