diff mbox series

c++: Fix clang problem [PR 98340]

Message ID 307b19bd-0a3e-ce8b-d735-f6d99fc80e24@acm.org
State New
Headers show
Series c++: Fix clang problem [PR 98340] | expand

Commit Message

Nathan Sidwell Dec. 17, 2020, 5:56 p.m. UTC
Clang didn't like sizeot (uintset::value) in a templated context.  Not 
sure where the problem lies -- ambiguous std, gcc erroneous accept or 
clang erroneous reject.  Anyway, this avoids that construct.

	PR c++/98340
	gcc/cp/
         * module.c (uintset<T>::hash::add): Use	uintset	(0u).MEMBER,
         rather than uintset::MEMBER.

Thanks to Peter for testing.

pushing to trunk
diff mbox series

Patch

diff --git i/gcc/cp/module.cc w/gcc/cp/module.cc
index 21d04ccec19..b2b81900fc3 100644
--- i/gcc/cp/module.cc
+++ w/gcc/cp/module.cc
@@ -2718,7 +2718,7 @@  uintset<T>::hash::add (typename uintset<T>::hash::key_t key, T value)
 	{
 	  unsigned n = set->num * 2;
 	  size_t new_size = (offsetof (uintset, values)
-			     + sizeof (uintset::values) * n);
+			     + sizeof (uintset (0u).values) * n);
 	  uintset *new_set = new (::operator new (new_size)) uintset (set);
 	  delete set;
 	  set = new_set;
@@ -2743,7 +2743,7 @@  uintset<T>::hash::create (typename uintset<T>::hash::key_t key, unsigned num,
     p2alloc++;
 
   size_t new_size = (offsetof (uintset, values)
-		     + (sizeof (uintset::values) << p2alloc));
+		     + (sizeof (uintset (0u).values) << p2alloc));
   uintset *set = new (::operator new (new_size)) uintset (key);
   set->allocp2 = p2alloc;
   set->num = num;