From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2163 invoked by alias); 29 Jul 2003 20:22:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 2156 invoked by uid 48); 29 Jul 2003 20:21:59 -0000 Date: Tue, 29 Jul 2003 20:22:00 -0000 From: "reichelt at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org Message-ID: <20030729202158.11715.reichelt@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/11715] New: Error with template keyword in a non-dependent type X-Bugzilla-Reason: CC X-SW-Source: 2003-07/txt/msg03438.txt.bz2 List-Id: PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11715 Summary: Error with template keyword in a non-dependent type Product: gcc Version: 3.4 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: reichelt at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org The following valid code (from PR 10398) is rejected by g++ since at least gcc 2.95.x: ---------------------------------------------- struct A { template struct B {}; }; template struct C { C() { A::template B b; } }; C c; ---------------------------------------------- The error message is: bug.cc: In constructor `C::C()': bug.cc:8: error: expected `;' bug.cc: In constructor `C::C() [with T = void]': bug.cc:11: instantiated from here bug.cc:8: error: `B' undeclared (first use this function) bug.cc:8: error: (Each undeclared identifier is reported only once for each function it appears in.) If one removes the "template" keyword in line 8 or adds a typename before "A::template", the code compiles.