[cfe-dev] _Atomic qualified types and template argument deduction
Rachel Craik via cfe-dev
cfe-dev at lists.llvm.org
Thu Sep 3 09:58:10 PDT 2015
Hi Hubert,
Yes, I'll take a look.
Thanks,
Rachel
From: Hubert Tong <hubert.reinterpretcast at gmail.com>
To: Rachel Craik/Toronto/IBM at IBMCA
Cc: Richard Smith <richard at metafoo.co.uk>, Clang Dev
<cfe-dev at lists.llvm.org>
Date: 09/02/2015 05:02 PM
Subject: Re: [cfe-dev] _Atomic qualified types and template argument
deduction
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/20150903/6936e960/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150903/6936e960/attachment.gif>
More information about the cfe-dev
mailing list