_Atomic qualified types and template argument deduction

In C11, the lvalue conversions replace atomic types with the unqualified, non-atomic version. This is similar to the array-to-pointer and function-to-pointer conversions in C++.

I believe that this parallel should be reflected in template argument deduction (specifically, in the place in [temp.deduct.call] where array-to-pointer and function-to-pointer conversion is mentioned).

That is, I believe the following should compile successfully (Clang doesn’t do so at this time):
extern _Atomic const int x;
template struct C { typedef T type; };
template C foo(T);
extern decltype(foo(x))::type chk;
extern int chk;

Comments welcome.

I agree. The intent of [temp.deduct.call]p2 and p3 seems to be that if P is
not a reference, then A is replaced by the type obtained by converting A to
a prvalue (and dropping qualifiers). Whether we view _Atomic as a funny
kind of qualifier or as a funny kind of modifier that decays to its
underlying type, we should deduce T = int in your above example.

Hi Rachel,

I believe you might be interested in picking this one up?

– HT

Hi Hubert,

Yes, I’ll take a look.

Thanks,

Rachel

graycol.gifHubert Tong —09/02/2015 05:02:26 PM—Hi Rachel, I believe you might be interested in picking this one up?