gcc gives bogus errors for classes wrapped in 'extern "C"'

turly turly@apple.com
Thu Jan 13 10:43:00 GMT 2000


gcc-2.95.2 gives bogus errors for classes wrapped in 'extern "C"'
(I'm not even sure whether this is legal.)

extern "C" {
   class Argh {
       public:
          ~Argh ();
           void DoSomething (Argh *);
           Argh ();
   };
}

gcc will give the error
    "invalid use of undefined type `class Argh'"
when it sees the "Argh *" parameter of DoSomething ().

(It's even weirder in that these error messages are only given for
methods which occur AFTER the destructor has been seen; i.e., moving 
the destructor so it's the LAST method above will result in a clean
compile.  <fx:Theme music from _The Twilight Zone_> Hmmm. </fx>)

Any ideas/suggestions, or is this simply a case of "Doctor, it hurts
when I do this."  -- "Well, don't do that."?

Thanks!

--turly


More information about the Gcc-bugs mailing list