From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26095 invoked by alias); 26 Apr 2009 07:30:11 -0000 Received: (qmail 25825 invoked by uid 48); 26 Apr 2009 07:29:46 -0000 Date: Sun, 26 Apr 2009 07:30:00 -0000 Subject: [Bug c++/39906] New: Accepted invalid member template specialization in derived class X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "sutambe at yahoo dot com" 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: 2009-04/txt/msg02383.txt.bz2 struct Base { template struct Kind { typedef T type; }; }; struct Derived : public Base { }; template <> struct Derived::Kind // Should fail to compile here { typedef int type; }; int main(void) { } I believe the above code should be rejected but gcc 4.1.2 accepted it. Global scope explicit member template specialization of the inner struct Kind is shown to be in the Derived class. (It is rejected by Comeau). gcc correctly rejects in the case of member template functions but not in case of structs/classes. Compiler information: Using built-in specs. Target: i386-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-cpu=generic --host=i386-redhat-linux Thread model: posix gcc version 4.1.2 20070925 (Red Hat 4.1.2-33) -- Summary: Accepted invalid member template specialization in derived class Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sutambe at yahoo dot com GCC build triplet: i386-redhat-linux GCC host triplet: i386-redhat-linux GCC target triplet: i386-redhat-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39906