I posted my original question on stackoverflow, but have not received satisfactory answer so far.
I personally find behaviour of clang correct and appropriate in this case. Clang generates no warning because the shallow copy operator of derived is generated implicitly. And it must not hide user defined operator of the base class.
But somehow it contradicts the note and example given in ISO C++ standard (find links below). At least GCC and MSVC behaves differently to clang in this context.
The ISO C++ standard does not specify compiler warnings (other than for the #warning directive). Implementations are free to emit warnings for conformant code. Warnings are not standardized.
The warnings exhibited by the other compilers are useful because name lookup considers names in a derived class differently than names in a base class. In some cases, a name in a derived class will hide a base class name, even one with a different signature. A using declaration is then needed, as Toby’s answer indicates, when it is desirable for these differently scoped names to be considered equivalently for lookup purposes.
Perhaps Clang should also be issuing warnings in these cases.
@tahonermann
The ISO C++ standard
does not specify compiler warnings (other than for the #warning directive). Implementations are free to emit warnings for conformant code. Warnings are not standardized.
The warning is issued because the class function of derived class hides the class function of base class.
==> My question is rather why clang does not report, that the function is hidden? Either it is not hidden (A) or the clang is capable to resolve the declaration correctly (B) in this case (implicitly generated functions).
In case of A, there would the violation of ISO standard, right?
Is the case B standard conform?
Perhaps Clang doesn’t issue a warning because no one thought to implement a warning for that case. Or perhaps it was felt that such a warning would be too frequently undesirable. I don’t know.
I don’t see a conformance question here. Per [class.copy.assign]p2, " If the class definition does not explicitly declare a copy assignment operator, one is declared implicitly…". Clang implicitly declares such functions the same as other compilers do.
I don’t see a conformance question here. Per [class.copy.assign]p2, " If the class definition does not explicitly declare a copy assignment operator, one is declared implicitly…". Clang implicitly declares such functions the same as other compilers do.