c++/1639: template operator != interferes with const expressions
kaa@comail.ru
kaa@comail.ru
Fri Jan 12 15:06:00 GMT 2001
>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:
More information about the Gcc-bugs
mailing list