From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14315 invoked by alias); 21 Feb 2013 20:02:58 -0000 Received: (qmail 14267 invoked by uid 48); 21 Feb 2013 20:02:35 -0000 From: "kristian.spangsege at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/56421] New: Non-matching overload produces template substitution error Date: Thu, 21 Feb 2013 20:02:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kristian.spangsege at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: 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: 2013-02/txt/msg02181.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D56421 Bug #: 56421 Summary: Non-matching overload produces template substitution error Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: kristian.spangsege@gmail.com template struct Foo { typedef typename S::type type; }; template void foo(); template typename Foo::type foo(int); int main() { foo(); } Produces the following error in both gcc-4.7.2 and gcc-4.6.3: $ g++ -c t.cpp t.cpp: In instantiation of =E2=80=98struct Foo=E2=80=99: t.cpp:6:41: required by substitution of =E2=80=98template typena= me Foo::type foo(int) [with S =3D int]=E2=80=99 t.cpp:10:12: required from here t.cpp:2:28: error: =E2=80=98int=E2=80=99 is not a class, struct, or union t= ype Clang accepts it as valid. Note: No errors are reported by GCC if we change line 6 from template typename Foo::type foo(int); to template typename S::type foo(int);