[Bug c++/98360] New: sizeof in template difference between g++/icc and clang++
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Dec 17 18:47:33 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98360
Bug ID: 98360
Summary: sizeof in template difference between g++/icc and
clang++
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
CC: dcb314 at hotmail dot com, jakub at gcc dot gnu.org,
marxin at gcc dot gnu.org, nathan at gcc dot gnu.org
Depends on: 98340
Target Milestone: ---
+++ This bug was initially created as a clone of Bug #98340 +++
template <typename T>
struct delete_ptr_hash
{
};
template <typename T>
struct hash_table
{
};
template <typename T>
struct uintset
{
T values[1];
struct traits : delete_ptr_hash <uintset>
{
};
struct hash : hash_table <traits>
{
int foo ();
};
hash h;
};
template <typename T>
int
uintset<T>::hash::foo ()
{
return sizeof (uintset::values);
}
uintset<int> s;
int x = s.h.foo ();
As stated in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98340#c2
the above has been rejected by g++ before
r0-99643-g2defb926479247a61fe0fffbcf95597722a94c40 and by icc 13 and is
rejected by all clang++ versions I've tried (but each compiler different
diagnostic), while it is accepted by g++ 4.6+ and icc 16+.
Is this an accepts-invalid bug in g++ or ice-on-invalid in clang++?
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98340
[Bug 98340] gcc trunk build with clang failure, part 2
More information about the Gcc-bugs
mailing list