From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4383 invoked by alias); 16 Oct 2009 08:46:49 -0000 Received: (qmail 4337 invoked by uid 48); 16 Oct 2009 08:46:36 -0000 Date: Fri, 16 Oct 2009 08:46:00 -0000 Subject: [Bug c++/41725] New: g++ accepts compounded unnamed type in template (violates 14.3.1-2) X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "td-gnubugs at th-dorner dot de" 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-10/txt/msg01431.txt.bz2 g++ accepts a type as a template argument, that is defined inside of an unnamed type. In the attached example t_inner is defined in an unnamed structure. That would make t_inner a "type compounded from an unnamed type" as I read section 14.3.1-2 of the ISO/IEC 14882/1998 standard (p. 241). So this should cause an error (and does with other Compilers / tools), but g++ accepts it. The problem was found with: > gcc -v Using built-in specs. Target: sparc-sun-solaris2.10 Configured with: ../gcc-4.2.4/configure --prefix=/usr/local/gcc424 Thread model: posix gcc version 4.2.4 It has also been verified with: > gcc -v Reading specs from /usr/local/gcc344/lib/gcc/sparc-sun-solaris2.10/3.4.4/specs Configured with: ./configure --prefix=/usr/local/gcc344 Thread model: posix gcc version 3.4.4 It has also been seen with version 4.3.3 on Linux (Ubuntu 9.04 on 64bit Intel). The Comeau online compiler gives an "a template argument may not reference an unnamed type" error message for that code. -- Summary: g++ accepts compounded unnamed type in template (violates 14.3.1-2) Product: gcc Version: 4.2.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: td-gnubugs at th-dorner dot de GCC build triplet: sparc-sun-solaris2.10 GCC host triplet: sparc-sun-solaris2.10 GCC target triplet: sparc-sun-solaris2.10 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41725