From: paolo Date: Wed, 21 Sep 2011 09:56:45 +0000 (+0000) Subject: /cp X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=156df524a4a894f92f6dbd61e00e905d2e6778e7;p=thirdparty%2Fgcc.git /cp 2011-09-21 Paolo Carlini PR c++/50454 * decl.c (grokdeclarator): Consistently handle both __int128 and unsigned __int128 with -pedantic; suppress diagnostic in system headers. /testsuite 2011-09-21 Paolo Carlini PR c++/50454 * g++.dg/ext/int128-1.C: New. * g++.dg/ext/int128-2.C: Likewise. * g++.dg/ext/int128-2.h: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179042 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c9c4a215f700..51230909ed97 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2011-09-21 Paolo Carlini + + PR c++/50454 + * decl.c (grokdeclarator): Consistently handle both __int128 + and unsigned __int128 with -pedantic; suppress diagnostic in + system headers. + 2011-09-20 Jason Merrill * cp-tree.h (DECL_TEMPLOID_INSTANTIATION): New. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index a61b3598cb81..86fd2d5a23b9 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8640,6 +8640,18 @@ grokdeclarator (const cp_declarator *declarator, ctype = NULL_TREE; + if (explicit_int128) + { + if (int128_integer_type_node == NULL_TREE) + { + error ("%<__int128%> is not supported by this target"); + explicit_int128 = false; + } + else if (pedantic && ! in_system_header) + pedwarn (input_location, OPT_pedantic, + "ISO C++ does not support %<__int128%> for %qs", name); + } + /* Now process the modifiers that were specified and check for invalid combinations. */ @@ -8663,8 +8675,6 @@ grokdeclarator (const cp_declarator *declarator, error ("% and % specified together for %qs", name); else if (longlong && TREE_CODE (type) != INTEGER_TYPE) error ("% invalid for %qs", name); - else if (explicit_int128 && TREE_CODE (type) != INTEGER_TYPE) - error ("%<__int128%> invalid for %qs", name); else if (long_p && TREE_CODE (type) == REAL_TYPE) error ("% invalid for %qs", name); else if (short_p && TREE_CODE (type) == REAL_TYPE) @@ -8695,22 +8705,6 @@ grokdeclarator (const cp_declarator *declarator, if (flag_pedantic_errors) ok = 0; } - if (explicit_int128) - { - if (int128_integer_type_node == NULL_TREE) - { - error ("%<__int128%> is not supported by this target"); - ok = 0; - } - else if (pedantic) - { - pedwarn (input_location, OPT_pedantic, - "ISO C++ does not support %<__int128%> for %qs", - name); - if (flag_pedantic_errors) - ok = 0; - } - } } /* Discard the type modifiers if they are invalid. */ @@ -8721,7 +8715,6 @@ grokdeclarator (const cp_declarator *declarator, long_p = false; short_p = false; longlong = 0; - explicit_int128 = false; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2a7803a99b76..cba634168177 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2011-09-21 Paolo Carlini + + PR c++/50454 + * g++.dg/ext/int128-1.C: New. + * g++.dg/ext/int128-2.C: Likewise. + * g++.dg/ext/int128-2.h: Likewise. + 2011-09-20 H.J. Lu PR testsuite/50469 @@ -11,9 +18,9 @@ PR c++/50442 * g++.dg/overload/ref-conv1.C: New. -2011-09-20 Roberto Agostino Vitillo +2011-09-20 Roberto Agostino Vitillo - * g++.dg/other/final1.C: new test + * g++.dg/other/final1.C: New. 2011-09-20 Ira Rosen diff --git a/gcc/testsuite/g++.dg/ext/int128-1.C b/gcc/testsuite/g++.dg/ext/int128-1.C new file mode 100644 index 000000000000..65540e84841f --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/int128-1.C @@ -0,0 +1,11 @@ +// PR c++/50454 +// { dg-do compile { target int128 } } + +template + struct limits; + +template<> + struct limits<__int128> { }; // { dg-error "does not support" } + +template<> + struct limits { }; // { dg-error "does not support" } diff --git a/gcc/testsuite/g++.dg/ext/int128-2.C b/gcc/testsuite/g++.dg/ext/int128-2.C new file mode 100644 index 000000000000..36a3f1a44d1b --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/int128-2.C @@ -0,0 +1,4 @@ +// PR c++/50454 +// { dg-do compile { target int128 } } + +#include "int128-2.h" diff --git a/gcc/testsuite/g++.dg/ext/int128-2.h b/gcc/testsuite/g++.dg/ext/int128-2.h new file mode 100644 index 000000000000..4e441be8d0dd --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/int128-2.h @@ -0,0 +1,10 @@ +#pragma GCC system_header + +template + struct limits; + +template<> + struct limits<__int128> { }; + +template<> + struct limits { };