[cfe-dev] _Atomic qualified types and template argument deduction

Hubert Tong via cfe-dev cfe-dev at lists.llvm.org
Wed Sep 2 14:01:39 PDT 2015

Hi Rachel,

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

-- HT

On Wed, Sep 2, 2015 at 1:52 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> On Wed, Sep 2, 2015 at 9:29 AM, Hubert Tong via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>> 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 <typename T> struct C { typedef T type; };
>> template <typename T> C<T> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150902/4741d37b/attachment.html>

More information about the cfe-dev mailing list