From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29481 invoked by alias); 18 Sep 2005 15:43:28 -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 29434 invoked by uid 48); 18 Sep 2005 15:43:23 -0000 Date: Sun, 18 Sep 2005 15:43:00 -0000 From: "lichtwerk dot x at laposte dot net" To: gcc-bugs@gcc.gnu.org Message-ID: <20050918154321.23950.lichtwerk.x@laposte.net> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/23950] New: Two-phase name lookup crash with "using" a static const integer from a base class as template parameter X-Bugzilla-Reason: CC X-SW-Source: 2005-09/txt/msg02263.txt.bz2 List-Id: Accessing members of base classes depending on template parameters from derived classes has to be done by postponing the name lookup onte the second phase of the standard c++ two phase name lookup (if I'm right about that). This means, one has to use dependent types, so you have to use scope resolution, this-> or a using declaration in order to access the member of the base class. Example (this works): template class Base { static const int i = 0; }; template class Derived : public Base { // For two phase name lookup. using Base::i; int foo() const { return i; } }; In order not to obfuscate bigger classes I heavily used using declarations as shown in the example above (instead of writing "return Base::i;"). However using a static const integral out of a base class using a using declaration as a template parameter resulted in an internal compiler error: internal compiler error: in uses_template_parms, at cp/pt.c:4948 To reproduce the error compile this piece of code: template class X { }; template class Base { static const int i = 0; }; template class Derived : public Base { // For two phase name lookup. using Base::i; X member; }; If I don't use a using declaration but write X::i> member; instead of using Base::i; X member; it works, though. Thanks in advance I'm using g++ 4.0.0 on Windows using these files http://www.thisiscool.com/gcc_mingw.htm#gcj40 However, I have exactly the same internal compiler error using MinGW's g++ 3.4.2. -- Summary: Two-phase name lookup crash with "using" a static const integer from a base class as template parameter Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: lichtwerk dot x at laposte dot net CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23950