This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/9978: [3.4 regression] Rejects valid constant expression
- From: rguenth at tat dot physik dot uni-tuebingen dot de
- To: gcc-gnats at gcc dot gnu dot org
- Date: 6 Mar 2003 09:47:42 -0000
- Subject: c++/9978: [3.4 regression] Rejects valid constant expression
- Reply-to: rguenth at tat dot physik dot uni-tuebingen dot de
>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: