public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-6569] c++: signed __int128_t [PR108099]
Date: Fri, 10 Mar 2023 03:57:54 +0000 (GMT)	[thread overview]
Message-ID: <20230310035754.562583858002@sourceware.org> (raw)

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

commit r13-6569-g2fc55f51f9953b451d6d6ddfae23379001e6ac95
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Mar 9 17:35:24 2023 -0500

    c++: signed __int128_t [PR108099]
    
    The code for handling signed + typedef was breaking on __int128_t, because
    it isn't a proper typedef: it doesn't have DECL_ORIGINAL_TYPE.
    
            PR c++/108099
    
    gcc/cp/ChangeLog:
    
            * decl.cc (grokdeclarator): Handle non-typedef typedef_decl.
    
    gcc/testsuite/ChangeLog:
    
            * g++.dg/ext/int128-7.C: New test.

Diff:
---
 gcc/cp/decl.cc                      | 11 ++++++++---
 gcc/testsuite/g++.dg/ext/int128-7.C |  4 ++++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 30c7470974d..b1603859644 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -12440,10 +12440,15 @@ grokdeclarator (const cp_declarator *declarator,
 	{
 	  if (typedef_decl)
 	    {
-	      pedwarn (loc, OPT_Wpedantic, "%qs specified with %qT",
-		       key, type);
+	      pedwarn (loc, OPT_Wpedantic, "%qs specified with %qD",
+		       key, typedef_decl);
 	      ok = !flag_pedantic_errors;
-	      type = DECL_ORIGINAL_TYPE (typedef_decl);
+	      if (is_typedef_decl (typedef_decl))
+		type = DECL_ORIGINAL_TYPE (typedef_decl);
+	      else
+		/* PR108099: __int128_t comes from c_common_nodes_and_builtins,
+		   and is not built as a typedef.  */
+		type = TREE_TYPE (typedef_decl);
 	      typedef_decl = NULL_TREE;
 	    }
 	  else if (declspecs->decltype_p)
diff --git a/gcc/testsuite/g++.dg/ext/int128-7.C b/gcc/testsuite/g++.dg/ext/int128-7.C
new file mode 100644
index 00000000000..bf5e8c40a4b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/int128-7.C
@@ -0,0 +1,4 @@
+// PR c++/108099
+// { dg-do compile { target { c++11 && int128 } } }
+
+using i128 = signed __int128_t;	// { dg-error "specified with" }

                 reply	other threads:[~2023-03-10  3:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230310035754.562583858002@sourceware.org \
    --to=jason@gcc.gnu.org \
    --cc=gcc-cvs@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).