]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: signed __int128_t [PR108099]
authorJason Merrill <jason@redhat.com>
Thu, 9 Mar 2023 22:35:24 +0000 (17:35 -0500)
committerJason Merrill <jason@redhat.com>
Tue, 18 Apr 2023 20:10:25 +0000 (16:10 -0400)
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.

gcc/cp/decl.cc
gcc/testsuite/g++.dg/ext/int128-7.C [new file with mode: 0644]

index 16ddea1099ea563ee17b5fed2d8f73584921d90c..dcb9f0c47034159361196e8d2e6f55753a5a32dd 100644 (file)
@@ -12300,10 +12300,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 (file)
index 0000000..bf5e8c4
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/108099
+// { dg-do compile { target { c++11 && int128 } } }
+
+using i128 = signed __int128_t;        // { dg-error "specified with" }