https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98340

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Before r0-99643-g2defb926479247a61fe0fffbcf95597722a94c40 this used to be
rejected with:
pr98340.C: In member function ‘int uintset<T>::hash::foo() [with T = int]’:
pr98340.C:33:18:   instantiated from here
pr98340.C:29:33: error: type ‘uintset<int>’ is not a base type for type
‘uintset<int>::hash’

clang++ rejects the above testcase even if it is just struct traits {};
i.e. not derived from delete_ptr_hash <uintset>, but accepts it if
uintptr<T>::hash isn't derived from hash_table<traits> but say hash_table<int>
(rejects if it is derived
from hash_table<uintptr<T>::traits> though).
I guess a C++ language lawyer would need to have a look if it is a clang++ bug
or g++ bug in accepting it.  Of course, even if it is clang++ bug, a workaround
is possible, e.g. it could use sizeof (T) rather than sizeof (uintset::values),
after all, when it multiplicates by n, I guess it wants sizeof
(uintset<T>::values[0]) anyway, because it uses trailing array of Ts rather
than T[1]s.

Reply via email to