http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58403

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
http://gcc.gnu.org/wiki/VerboseDiagnostics#missing_static_const_definition

You odr-use a static member variable, so it must have a definition.  The linker
error is your fault for not defining the static member, not the library's fault
for using a reference parameter.

If you add the missing definition the program links:

constexpr std::iterator_traits<std::string::iterator>::difference_type A::a;

So I have no objection to changing __normal_iterator to take the parameter by
value, but taking it by reference is not a bug.  It is unspecified whether
"it += A::a" is an odr-use or not.

Your program will also fail to link if you do this:

    std::max(A::a, A::a);

But clearly we're not going to change std::max, that would be non-conforming.

Reply via email to