Commit 086f3b9a by Paolo Carlini

re PR c++/50454 (Unexpected problems with -pedantic / -pedantic-errors and…

re PR c++/50454 (Unexpected problems with -pedantic / -pedantic-errors and __int128 and unsigned __int128 specializations)

/cp
2011-09-21  Paolo Carlini  <paolo.carlini@oracle.com>

	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  <paolo.carlini@oracle.com>

	PR c++/50454
	* g++.dg/ext/int128-1.C: New.
	* g++.dg/ext/int128-2.C: Likewise.
	* g++.dg/ext/int128-2.h: Likewise.

From-SVN: r179042
parent e3e28585
2011-09-21 Paolo Carlini <paolo.carlini@oracle.com>
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 <jason@redhat.com> 2011-09-20 Jason Merrill <jason@redhat.com>
* cp-tree.h (DECL_TEMPLOID_INSTANTIATION): New. * cp-tree.h (DECL_TEMPLOID_INSTANTIATION): New.
......
...@@ -8640,6 +8640,18 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -8640,6 +8640,18 @@ grokdeclarator (const cp_declarator *declarator,
ctype = NULL_TREE; 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 /* Now process the modifiers that were specified
and check for invalid combinations. */ and check for invalid combinations. */
...@@ -8663,8 +8675,6 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -8663,8 +8675,6 @@ grokdeclarator (const cp_declarator *declarator,
error ("%<signed%> and %<unsigned%> specified together for %qs", name); error ("%<signed%> and %<unsigned%> specified together for %qs", name);
else if (longlong && TREE_CODE (type) != INTEGER_TYPE) else if (longlong && TREE_CODE (type) != INTEGER_TYPE)
error ("%<long long%> invalid for %qs", name); error ("%<long long%> 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) else if (long_p && TREE_CODE (type) == REAL_TYPE)
error ("%<long%> invalid for %qs", name); error ("%<long%> invalid for %qs", name);
else if (short_p && TREE_CODE (type) == REAL_TYPE) else if (short_p && TREE_CODE (type) == REAL_TYPE)
...@@ -8695,22 +8705,6 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -8695,22 +8705,6 @@ grokdeclarator (const cp_declarator *declarator,
if (flag_pedantic_errors) if (flag_pedantic_errors)
ok = 0; 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. */ /* Discard the type modifiers if they are invalid. */
...@@ -8721,7 +8715,6 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -8721,7 +8715,6 @@ grokdeclarator (const cp_declarator *declarator,
long_p = false; long_p = false;
short_p = false; short_p = false;
longlong = 0; longlong = 0;
explicit_int128 = false;
} }
} }
......
2011-09-21 Paolo Carlini <paolo.carlini@oracle.com>
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 <hongjiu.lu@intel.com> 2011-09-20 H.J. Lu <hongjiu.lu@intel.com>
PR testsuite/50469 PR testsuite/50469
...@@ -11,9 +18,9 @@ ...@@ -11,9 +18,9 @@
PR c++/50442 PR c++/50442
* g++.dg/overload/ref-conv1.C: New. * g++.dg/overload/ref-conv1.C: New.
2011-09-20 Roberto Agostino Vitillo <ravitillo@lbl.gov> 2011-09-20 Roberto Agostino Vitillo <ravitillo@lbl.gov>
* g++.dg/other/final1.C: new test * g++.dg/other/final1.C: New.
2011-09-20 Ira Rosen <ira.rosen@linaro.org> 2011-09-20 Ira Rosen <ira.rosen@linaro.org>
......
// PR c++/50454
// { dg-do compile { target int128 } }
template<typename T>
struct limits;
template<>
struct limits<__int128> { }; // { dg-error "does not support" }
template<>
struct limits<unsigned __int128> { }; // { dg-error "does not support" }
// PR c++/50454
// { dg-do compile { target int128 } }
#include "int128-2.h"
#pragma GCC system_header
template<typename T>
struct limits;
template<>
struct limits<__int128> { };
template<>
struct limits<unsigned __int128> { };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment