From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24747 invoked by alias); 22 Jan 2012 20:40:00 -0000 Received: (qmail 24737 invoked by uid 22791); 22 Jan 2012 20:39:59 -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; Sun, 22 Jan 2012 20:39:47 +0000 From: "basil at list dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/51951] Template function dependent name resolution fails Date: Sun, 22 Jan 2012 20:57: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: normal X-Bugzilla-Who: basil at list dot ru 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: 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: 2012-01/txt/msg02545.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D51951 --- Comment #2 from Vasily Sukhanov 2012-01-22 20:39= :41 UTC --- Compilation of attached code fails despite it is accepted by previous GCC versions. 1 template 2 class Option { 3 public: 4 bool m_bValid; 5 T m_t; 6 }; 7=20 8 template 9 void readSingle(Option& opt) { 10 readFromStream(opt.m_bValid); 11 } 12=20 13 template 14 void readFromStream(T& t) { } 15=20 16 int main() 17 { 18 Option o; 19 readSingle(o); 20 } template_test.cpp: In instantiation of =E2=80=98void readSingle(Option&)= [with T =3D int]=E2=80=99: template_test.cpp:19:15: required from here template_test.cpp:10:5: error: =E2=80=98readFromStream=E2=80=99 was not dec= lared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive] template_test.cpp:14:6: note: =E2=80=98template void readFromStrea= m(T&)=E2=80=99 declared here, later in the translation unit I think that instantiation point of readSingle is line 19. readFromStr= eam in line 10 is dependent on template parameter. Therefore compiler should perform lookup in context of template instantiation (14.6.4.2). readFromStr= eam was defined by this point.=20=20 I'm on revision 183301.