This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/9907: [3.4 regression] sizeof considered as non constant
- From: nes at lrde dot epita dot fr
- To: gcc-gnats at gcc dot gnu dot org
- Date: Sun, 2 Mar 2003 23:29:31 +0100 (CET)
- Subject: c++/9907: [3.4 regression] sizeof considered as non constant
>Number: 9907
>Category: c++
>Synopsis: [3.4 regression] sizeof considered as non constant
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Sun Mar 02 22:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Nicolas Burrus
>Release: 3.4 20030302 (experimental)
>Organization:
LRDE
>Environment:
System: Linux meissa 2.4.20 #1 Wed Dec 4 21:05:57 CET 2002 i686 unknown unknown GNU/Linux
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /home/nes/work/ext/gcc/configure --prefix=/opt/gcc-3.4-cvs --enable-languages=c,c++
>Description:
Using sizeof(function) in a template function is considered non constant.
>How-To-Repeat:
Try to compile this code :
template <unsigned n> struct bar {};
int foo();
template <class T>
void baz()
{
bar<sizeof(foo())> b;
}
Here is the output of g++ 3.4 :
foo.cc: In function `void baz()':
foo.cc:18: error: non-constant `sizeof ((*foo()()))' cannot be used as template
If baz() is not template, it works.
>Fix:
No fix found.
>Release-Note:
>Audit-Trail:
>Unformatted: