From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 909CE3896010; Thu, 17 Dec 2020 18:47:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 909CE3896010 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/98360] New: sizeof in template difference between g++/icc and clang++ Date: Thu, 17 Dec 2020 18:47:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc dependson target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Dec 2020 18:47:33 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98360 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 struct delete_ptr_hash { }; template struct hash_table { }; template struct uintset { T values[1]; struct traits : delete_ptr_hash { }; struct hash : hash_table { int foo (); }; hash h; }; template int uintset::hash::foo () { return sizeof (uintset::values); } uintset s; int x =3D s.h.foo (); As stated in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98340#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=3D98340 [Bug 98340] gcc trunk build with clang failure, part 2=