[cfe-dev] Fwd: Fwd: Is variadic template a default constructor ? gcc 4.8.1 test case variadic-default.C
Richard Smith
richard at metafoo.co.uk
Tue Nov 12 01:54:49 PST 2013
Your testcase got mangled; something seems to be treating it as HTML. I
think you mean something like:
struct A {
template<typename ...T> A(T...);
A(std::initializer_list<int>);
A(std::initializer_list<short>);
};
A a{};
The question here is, does A have a default constructor? I think it does
not, under [class.ctor](12.1)/4, since a constructor template is not a
constructor, but that may not be the intent of the standard. Usually, we
perform overload resolution in cases where we need to default construct, so
this case does not arise, but for list-initialization, we need to determine
whether a default constructor *exists* first.
So, under a literal interpretation of the standard's wording, Clang appears
to be correct. This is somewhat related to core issue 1630, but it looks
like the wording fix we have there doesn't cover this question.
On Tue, Nov 12, 2013 at 1:30 AM, SENTHIL KUMAR THANGAVELU <
senthil.t at samsung.com> wrote:
>
>
> Ping! anyone has some info on the issue below?
>
>
>
> ------- *Original Message* -------
>
> *Sender* : SENTHIL KUMAR THANGAVELU<senthil.t at samsung.com> ./Senior
> Technical Manager/SRI-Bangalore-Native Framework/Samsung Electronics
>
> *Date* : Oct 30, 2013 12:44 (GMT+05:30)
>
> *Title* : Fwd: Is variadic template a default constructor ? gcc 4.8.1
> test case variadic-default.C
>
>
>
>
>
> Clang rejects this test case with diagnostic "error: call to constructor
> of 'A' is ambiguous".
>
>
>
> ------- *Original Message* -------
>
> *Sender* : SENTHIL KUMAR THANGAVELU<senthil.t at samsung.com> ./Senior
> Technical Manager/SRI-Bangalore-Native Framework/Samsung Electronics
>
> *Date* : Oct 30, 2013 12:40 (GMT+05:30)
>
> *Title* : Is variadic template a default constructor ? gcc 4.8.1 test
> case variadic-default.C
>
>
> Hello all,
> There is a test case "variadic-default.C" in gcc 4.8.1 test suite
> discussed in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49205 . I can
> see "consensus at clang was that WG21 made an oversight in allowing this"
> in the discussion. Anyone knows the history? also in the same discussion
> its mentioned "We should just treat the variadic template as a default
> constructor". gcc 4.8.1 and intel 64 bit compiler 13.1.3 accepts this test
> case. Should this be fixed in clang? or clang behaviour is correct?
>
> #include
>
> struct A {
> template A(T...);
> A(std::initializer_list);
> A(std::initializer_list);
> };
>
> A a{};
>
> Regards
> Senthil Kumar
>
>
>
>
>
> Regards
>
> Senthil Kumar
>
>
>
>
>
>
>
>
>
> Regards
>
> Senthil Kumar
>
>
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131112/d52a7239/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 201311121504027_QKNMBDIF.gif
Type: image/gif
Size: 14036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131112/d52a7239/attachment.gif>
More information about the cfe-dev
mailing list