[GOLD][COMMITTED] Fix build breakage with -g.

Ian Lance Taylor iant@google.com
Thu Jan 14 04:55:00 GMT 2010


"Doug Kwan (關振德)" <dougkwan@google.com> writes:

> I did a bit more research and read the C++ standard again, especially
> in [class.static.data].  Paragraph 4 of it says the following:
>
> "If a static data member is of const integral or const enumeration
> type, its declaration in the class definition can specify a
> constant-initializer which shall be ben integral constant expression
> (5.19).  In that case, the member can appear in integral constant
> expressions within its scope.  The member shall still be defined in a
> namespace scope if it is used in the program and the namespace scope
> definition shall not contain an initializer."
>
> Since the static const integral data members of
> elfcpp::Elf_sizes<size> are used in many places outside of the class
> scope, I think we should add definitions of them in the elfcpp
> namespace.

Yes, it's technically required but I've been avoiding it because I
don't particularly want to add any .cc files in elfcpp.  It works fine
with g++ as long as you avoid the case you just noticed of ?:.  I
think it fails there because of an old g++ extension in which ?: is an
lvalue.  In C++0x the definitions are not required.

Ian



More information about the Binutils mailing list