diff options
author | Jason Merrill <jason@redhat.com> | 2023-03-09 17:35:24 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2023-03-09 22:14:10 -0500 |
commit | 2fc55f51f9953b451d6d6ddfae23379001e6ac95 (patch) | |
tree | 5cda7ac3e5b54959462b3a298a035d161959a3af /gcc | |
parent | 68c5d92a1390ecccb61d3600a95eeff6caf7ccdf (diff) | |
download | gcc-2fc55f51f9953b451d6d6ddfae23379001e6ac95.zip gcc-2fc55f51f9953b451d6d6ddfae23379001e6ac95.tar.gz gcc-2fc55f51f9953b451d6d6ddfae23379001e6ac95.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/decl.cc | 11 | ||||
-rw-r--r-- | 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 30c7470..b160385 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 0000000..bf5e8c4 --- /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" } |