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

Reply via email to