public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-98360-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             reply	other threads:[~2020-12-17 18:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17 18:47 jakub at gcc dot gnu.org [this message]
2020-12-18 23:52 ` [Bug c++/98360] " ensadc at mailnesia dot com
2020-12-19  1:35 ` ensadc at mailnesia dot com
2021-11-26  1:48 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-98360-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).