pure virtual w/implementation bug in GCC 3.3?

lrtaylor@micron.com lrtaylor@micron.com
Thu Sep 18 19:46:00 GMT 2003


Without actually looking at the standard, isn't a pure virtual function with an implementation simply a contradiction?  The fact that there is no implementation is what makes it "pure".  Otherwise, it's just a regular virtual function.  It doesn't make sense to try to say something is both pure virtual and that it has a definition.  That's just self contradictory...

Thanks,
Lyle Taylor

-----Original Message-----
From: Eljay Love-Jensen [mailto:eljay@adobe.com]
Sent: Thursday, September 18, 2003 1:38 PM
To: gcc-help@gcc.gnu.org
Subject: pure virtual w/implementation bug in GCC 3.3?

Hi everyone,

Using GCC 3.3 or GCC 3.2, it appears unable to digest this code:

--------8<--------
class Foo
{
public:
        virtual ~Foo() = 0 { }
};
--------8<--------

> g++33 -c foo.cpp
foo.cpp:4: error: parse error before `{' token
foo.cpp:4: error: missing ';' before right brace

Pure virtual functions can have implementations.  Pure virtual destructors (if I recall correctly) MUST have implementations.

And if the implementation is defined later with GCC 3.2 or 3.3 -- either as inline or not as inline ("out of line"?) -- it digests it with out an issue.

As per Stroustrup's C++PL, the EBNF grammar looks like it should and does support the syntax given above.  (The "implicit inline" of a method given in the class declaration.)

Is this a known bug in GCC?

Or is this a new bug in GCC?

Or am I misinformed?

Thanks,
--Eljay



More information about the Gcc-help mailing list