IMA corner case with forward declarations of statics

Zack Weinberg zack@codesourcery.com
Thu Jun 24 20:08:00 GMT 2004


Alexandre Oliva <aoliva@redhat.com> writes:

> On Jun 24, 2004, Zack Weinberg <zack@codesourcery.com> wrote:
>
>> ... so I find nothing here to support the claim that the program is
>> valid.  I've now gone over to Geoff's opinion that it isn't, and
>> am proceeding on that theory.
>
> I don't think you can refuse to compile the code by issuing an error,
> though.  I'm thinking of DRs 132 and 109.

This is compile-time undefined behavior, which *is* allowed to refuse
to compile.  Note that the undefinedness is predicated on the mere
appearance of two declarations of the same object with clashing
linkage specifications; not whether that object is used at runtime.

zw



More information about the Gcc mailing list