From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1059) id 6465F38930C5; Thu, 17 Dec 2020 17:57:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6465F38930C5 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Nathan Sidwell To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-6237] c++: Fix clang problem [PR 98340] X-Act-Checkin: gcc X-Git-Author: Nathan Sidwell X-Git-Refname: refs/heads/master X-Git-Oldrev: d1ad55c4e08b827b4d38f763e0427096305d460d X-Git-Newrev: 2d7a40fa60fb8b9870cfd053a37fc67404353ee2 Message-Id: <20201217175717.6465F38930C5@sourceware.org> Date: Thu, 17 Dec 2020 17:57:17 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Dec 2020 17:57:17 -0000 https://gcc.gnu.org/g:2d7a40fa60fb8b9870cfd053a37fc67404353ee2 commit r11-6237-g2d7a40fa60fb8b9870cfd053a37fc67404353ee2 Author: Nathan Sidwell 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::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::hash::add (typename uintset::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::hash::create (typename uintset::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;