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]

c++/1639: template operator != interferes with const expressions



>Number:         1639
>Category:       c++
>Synopsis:       template operator != interferes with const expressions
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 12 15:06:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Artem Khodush
>Release:        20010108 snapshot
>Organization:
>Environment:
RedHat Linux 6.2 i386
>Description:
The testcase

template< class T > bool operator!=( T t1, T t2 ) { return !t1==t2; }

enum { e1, e2 };

struct S {
	static const bool b= e1 != e2;
};

gives an error:
bug2.cxx:7: field initializer is not constant

This happens only when != arguments are enums, and
only when initializer is inside class declaration.
>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]