public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-6237] c++: Fix clang problem [PR 98340]
@ 2020-12-17 17:57 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-12-17 17:57 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:2d7a40fa60fb8b9870cfd053a37fc67404353ee2

commit r11-6237-g2d7a40fa60fb8b9870cfd053a37fc67404353ee2
Author: Nathan Sidwell <nathan@acm.org>
Date:   Thu Dec 17 09:53:01 2020 -0800

    c++: Fix clang problem [PR 98340]
    
    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.cc (uintset<T>::hash::add): Use uintset (0u).MEMBER,
            rather than uintset::MEMBER.

Diff:
---
 gcc/cp/module.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 21d04ccec19..b2b81900fc3 100644
--- a/gcc/cp/module.cc
+++ b/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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-17 17:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 17:57 [gcc r11-6237] c++: Fix clang problem [PR 98340] Nathan Sidwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).