This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/9978: [3.4 regression] Rejects valid constant expression


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]