public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21385] New: __extension__ lost inside template
@ 2005-05-04 18:06 jimrees at itasoftware dot com
  2005-05-04 18:10 ` [Bug c++/21385] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 8+ messages in thread
From: jimrees at itasoftware dot com @ 2005-05-04 18:06 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1723 bytes --]

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


^ permalink raw reply	[flat|nested] 8+ messages in thread
[parent not found: <bug-21385-10569@http.gcc.gnu.org/bugzilla/>]
[parent not found: <bug-21385-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2015-07-10 14:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-04 18:06 [Bug c++/21385] New: __extension__ lost inside template jimrees at itasoftware dot com
2005-05-04 18:10 ` [Bug c++/21385] " pinskia at gcc dot gnu dot org
     [not found] <bug-21385-10569@http.gcc.gnu.org/bugzilla/>
2007-09-22 18:09 ` pcarlini at suse dot de
2007-09-23 17:49 ` jason at gcc dot gnu dot org
2007-09-24 16:46 ` pcarlini at suse dot de
     [not found] <bug-21385-4@http.gcc.gnu.org/bugzilla/>
2012-05-29 11:55 ` paolo.carlini at oracle dot com
2012-08-06 17:18 ` paolo.carlini at oracle dot com
2015-07-10 14:52 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).