This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/21385] New: __extension__ lost inside template


Target: x86_64-suse-linux
Configured with: ../gcc-4.0.0/configure --prefix=/ita3 --enable-languages=c,c++ --with-system-
zlib --enable-__cxa_atexit x86_64-suse-linux : (reconfigured) ../gcc-4.0.0/configure --prefix=/ita3 
--enable-languages=c,c++ --with-system-zlib --enable-__cxa_atexit --disable-checking x86_64-
suse-linux
Thread model: posix
gcc version 4.0.0


template functions appear to erase the effect of the __extension__ keyword inside their definitions, 
causing "-ansi -pedantic" to produce an error instead of a warning.

Compiling the following code with "-ansi -pedantic" produces an error for the line in the template 
function, but not the ordinary function. 

% g++ -c -ansi -pedantic foo.cpp
foo.cpp: In function âint template_function(int) [with T = void]â:
foo.cpp:15:   instantiated from here
foo.cpp:11: error: ISO C++ forbids variable-size array

------------------------------------------------------
int ordinary_function(int dimension)
{
    __extension__ int data[dimension];
    return 0;
}

template<typename T>
int template_function(int dimension)
{
    __extension__ int data[dimension];
    return 0;
}

template int template_function<void>(int);

-- 
           Summary: __extension__ lost inside template
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jimrees at itasoftware dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-suse-linux
  GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21385


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]