public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: pure virtual w/implementation bug in GCC 3.3?
@ 2003-09-18 19:46 lrtaylor
  2003-09-18 19:53 ` Eljay Love-Jensen
  0 siblings, 1 reply; 7+ messages in thread
From: lrtaylor @ 2003-09-18 19:46 UTC (permalink / raw)
  To: eljay, gcc-help

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

^ permalink raw reply	[flat|nested] 7+ messages in thread
* RE: pure virtual w/implementation bug in GCC 3.3?
@ 2003-09-19 18:46 lrtaylor
  2003-09-19 19:30 ` Eljay Love-Jensen
  0 siblings, 1 reply; 7+ messages in thread
From: lrtaylor @ 2003-09-19 18:46 UTC (permalink / raw)
  To: gcc-help

I was under the impression that virtual functions could not be inlined (seems I read that somewhere), because, especially in the case of polymorphism, which function to call cannot be determined at compile time.  I can see cases where the compiler _would_ know that it could be inlined, though.  It just seemed that that was a matter of policy in the standard.  Is my impression incorrect?

Thanks,
Lyle Taylor

-----Original Message-----
From: Eljay Love-Jensen [mailto:eljay@adobe.com]
Sent: Friday, September 19, 2003 11:33 AM
To: m.; gcc-help@gcc.gnu.org
Subject: Re: pure virtual w/implementation bug in GCC 3.3?

Hi m,

Thank you for the clarification.  :-)

10.4 paragraph 2 clearly shows that the construct is illegal.

I'll use the sanctioned form:
class Foo { public: virtual ~Foo() = 0; };
inline Foo::~Foo() { }

Sincerely,
--Eljay

^ permalink raw reply	[flat|nested] 7+ messages in thread
* pure virtual w/implementation bug in GCC 3.3?
@ 2003-09-18 19:38 Eljay Love-Jensen
  0 siblings, 0 replies; 7+ messages in thread
From: Eljay Love-Jensen @ 2003-09-18 19:38 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-09-19 19:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-18 19:46 pure virtual w/implementation bug in GCC 3.3? lrtaylor
2003-09-18 19:53 ` Eljay Love-Jensen
2003-09-19  6:29   ` m.
2003-09-19 17:32     ` Eljay Love-Jensen
  -- strict thread matches above, loose matches on Subject: below --
2003-09-19 18:46 lrtaylor
2003-09-19 19:30 ` Eljay Love-Jensen
2003-09-18 19:38 Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).