[cfe-dev] early instantiation of defaulted copy constructor
Richard Smith
richard at metafoo.co.uk
Sun Apr 29 17:14:06 PDT 2012
On Sun, Apr 29, 2012 at 2:44 PM, Nathan Ridge <zeratul976 at hotmail.com>wrote:
>
> > Hello,
> >
> > The following code fails to compile with Clang trunk:
> >
> > template <class T, class U>
> > struct pair
> > {
> > T first;
> > U second;
> >
> > pair() : first(), second() {}
> >
> > pair(const pair&) = default;
> > };
> >
> > struct S
> > {
> > S() {}
> > S(const S&) = delete;
> > S(S&&) = default;
> > };
> >
> > int main()
> > {
> > pair<int, S> p;
> > }
> >
> > The errors are:
> >
> > test.cpp:9:5: error: the parameter for this explicitly-defaulted copy
> > constructor is const, but a member or base requires it to be
> > non-const
> > pair(const pair&) = default;
> > ^
> > test.cpp:21:18: note: in instantiation of template class 'pair<int, S>'
> > requested here
> > pair<int, S> p;
> > ^
> >
> > Thanks for the report! This issue was fixed over a week ago. Trunk
> > clang accepts your code.
>
> Ok, cool! Will it be fixed in the 3.1 branch?
>
Yes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120429/4c3f6bd5/attachment.html>
More information about the cfe-dev
mailing list