From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20891 invoked by alias); 31 Oct 2011 16:09:14 -0000 Received: (qmail 20876 invoked by uid 22791); 31 Oct 2011 16:09:12 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 31 Oct 2011 16:08:58 +0000 From: "vincenzo.innocente at cern dot ch" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/45114] implement C++0x alias-declaration Date: Mon, 31 Oct 2011 16:09:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: vincenzo.innocente at cern dot ch X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dodji at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg03220.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D45114 --- Comment #10 from vincenzo Innocente = 2011-10-31 16:06:41 UTC --- using the patch of comment 8 in the example below I get $ c++ -std=3Dgnu++0x -c talias.cc=20 $ c++ -std=3Dgnu++0x -c talias.cc -DALIAS talias.cc: In instantiation of =E2=80=98Bar::D Bar::d() [with T =3D int]= =E2=80=99: talias.cc:44:19: required from here talias.cc:34:23: error: no matching function for call to =E2=80=98Bar::D::D(Bar::A)=E2=80=99 talias.cc:34:23: note: candidates are: talias.cc:19:5: note: Bar::D::D(const Bar::A&) [with T =3D int; Bar::= A =3D Foo] talias.cc:19:5: note: no known conversion for argument 1 from =E2=80=98Ba= r::A {aka Foo}=E2=80=99 to =E2=80=98Bar::A& {aka Foo&}=E2=80=99 talias.cc:15:5: note: Bar::D::D() [with T =3D int] talias.cc:15:5: note: candidate expects 0 arguments, 1 provided talias.cc:14:10: note: constexpr Bar::D::D(const Bar::D&) talias.cc:14:10: note: no known conversion for argument 1 from =E2=80=98B= ar::A {aka Foo}=E2=80=99 to =E2=80=98const Bar::D&=E2=80=99 talias.cc:14:10: note: constexpr Bar::D::D(Bar::D&&) talias.cc:14:10: note: no known conversion for argument 1 from =E2=80=98B= ar::A {aka Foo}=E2=80=99 to =E2=80=98Bar::D&&=E2=80=99 otherwise the patch looks fine (i.e. no other problem found so far :-) template struct Foo { explicit Foo(char *im) : m(im){} char * m; }; struct Bar { template using A =3D Foo; template struct D { D() {} #ifndef ALIAS D(Foo const & ia) : a(ia) {} #else D(A const & ia) : a(ia) {} #endif A a; }; template A=20 a() { return A(m_i); } template D d() { return D(a()); } char m_i[10000]; }; Bar b; Bar::D bar() { return b.d(); }