[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gcc 4.1, cast-to-union and GNUstep

From: David G. Yu
Subject: gcc 4.1, cast-to-union and GNUstep
Date: Wed, 24 Aug 2005 15:32:36 -0700 (PDT)

In the gcc mainline (and 4.1 development snapshots), the
behavior of the cast-to-union extension has changed in a way
which is incompatible with the way this is used by GNUstep.

The problem seems to be that implicit casts no longer work,
e.g. this simple example:

    @interface Base { }

    @interface Derived : Base { }

    union Union {
        Base *obj;

    union Union
    foo(Derived *derived) {
        return (union Union)derived;

which works in gcc 4.0 and earlier, now raises the error:
    error: cast to union type from type not present in union

This breaks many of the uses of GSIArray and GSIMap in the GNUstep
implementation.  It's easy enough to add explicit type casts to the
GNUstep source code, but it seems like this might be a bug in gcc.

I say "might" because it's not clear from reading the gcc manual what
the correct behavior should be.  Does anyone here know?


BTW: I've been using the unreleased gcc 4.1 development snapshots
in order to try out Objective-C++ which isn't supported yet in any
of the released versions.

Here's the config, in case anyone is curious
  % gcc -v
  Using built-in specs.
  Target: x86_64-unknown-linux-gnu
  Configured with: ./configure --enable-languages=c,c++,objc,obj-c++
  Thread model: posix
  gcc version 4.1.0 20050819 (experimental)

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]