This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/25894] New: conditional operator operating on derived / base pointers appears incorrect
- From: "hhinnant at apple dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Jan 2006 02:07:42 -0000
- Subject: [Bug c++/25894] New: conditional operator operating on derived / base pointers appears incorrect
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider this program:
class base {
public:
base() {}
private:
int val_;
};
class derived : public base {
public:
derived() {}
};
template <bool> struct static_assert;
template <> struct static_assert<true> {};
int main ()
{
static const bool x = true ? (derived*)0 : (base*)0;
static_assert<!x> test;
}
I'm expecting it to compile (EDG compiles it). The current error I get is:
error: 'x' cannot appear in a constant-expression
If I allow run time evaluation of x, and print it out, I get 1 instead of 0 as
I expect.
--
Summary: conditional operator operating on derived / base
pointers appears incorrect
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hhinnant at apple dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25894