From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5221 invoked by alias); 9 Nov 2006 05:33:16 -0000 Received: (qmail 5191 invoked by uid 48); 9 Nov 2006 05:33:08 -0000 Date: Thu, 09 Nov 2006 05:33:00 -0000 Message-ID: <20061109053308.5189.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/14032] Specialization of inner template using outer template argument doesn't work In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "bangerth at dealii dot org" 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 X-SW-Source: 2006-11/txt/msg00730.txt.bz2 List-Id: ------- Comment #9 from bangerth at dealii dot org 2006-11-09 05:33 ------- PR29767 made me try whether we can achieve the same wrong effect for template type parameters, and indeed we can: -------------------- template struct outer { template struct inner { static int f() { return inner::N; }; }; template struct inner { static const int N = 1; }; }; int i = outer::inner::f(); ------------------ This compiles with icc, but doesn't with gcc: g/x> /home/bangerth/bin/gcc-4.2-pre/bin/c++ -c x.cc x.cc: In static member function ‘static int outer::inner::f() [with T2 = double, U = int, T = int]’: x.cc:13: instantiated from here x.cc:4: error: ‘N’ is not a member of ‘outer::inner’ As PR29767 shows, this can actually lead to wrong code. W. -- bangerth at dealii dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|non type boolean template |Specialization of inner |argument partial |template using outer |specialization to argument |template argument doesn't |in parent never matches |work http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14032