c++/9978: [3.4 regression] Rejects valid constant expression
rguenth@tat.physik.uni-tuebingen.de
rguenth@tat.physik.uni-tuebingen.de
Thu Mar 6 09:56:00 GMT 2003
>Number: 9978
>Category: c++
>Synopsis: [3.4 regression] Rejects valid constant expression
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Thu Mar 06 09:56:02 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Richard Guenther
>Release: g++-3.4 (GCC) 3.4 20030303 (experimental)
>Organization:
>Environment:
>Description:
The following is rejected by gcc 3.4 but accepted by icpc -ansi (who is I believe right in this case):
enum { val = 1 };
template <class T>
struct Bar
{
static const int A = val;
static const int B = A + 1;
};
this leads to
bellatrix:~/src/tests$ g++-3.4 -c cexpr.cpp
cexpr.cpp:7: error: `Bar<T>::A' cannot appear in a constant-expression
substituting 1 for val solves the problem.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list