public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jimrees at itasoftware dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/21385] New: __extension__ lost inside template
Date: Wed, 04 May 2005 18:06:00 -0000	[thread overview]
Message-ID: <20050504180652.21385.jimrees@itasoftware.com> (raw)

[-- 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


             reply	other threads:[~2005-05-04 18:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-04 18:06 jimrees at itasoftware dot com [this message]
2005-05-04 18:10 ` [Bug c++/21385] " pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050504180652.21385.jimrees@itasoftware.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).