Commit 6e7ceb17 by Paolo Carlini Committed by Paolo Carlini

re PR c++/51400 ([c++0x] ICE with constexpr and attribute noreturn)

/c-family
2014-06-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51400
	* c-common.c (handle_noreturn_attribute, handle_const_attribute):
	Do not discard TYPE_QUALS of type.

/testsuite
2014-06-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51400
	* g++.dg/cpp0x/constexpr-attribute3.C: New.

From-SVN: r212155
parent e8b27b08
2014-06-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51400
* c-common.c (handle_noreturn_attribute, handle_const_attribute):
Do not discard TYPE_QUALS of type.
2014-06-26 Jason Merrill <jason@redhat.com> 2014-06-26 Jason Merrill <jason@redhat.com>
* c-common.h (enum cxx_dialect): Add cxx1z. * c-common.h (enum cxx_dialect): Add cxx1z.
......
...@@ -6575,9 +6575,11 @@ handle_noreturn_attribute (tree *node, tree name, tree ARG_UNUSED (args), ...@@ -6575,9 +6575,11 @@ handle_noreturn_attribute (tree *node, tree name, tree ARG_UNUSED (args),
else if (TREE_CODE (type) == POINTER_TYPE else if (TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
TREE_TYPE (*node) TREE_TYPE (*node)
= build_pointer_type = (build_qualified_type
(build_type_variant (TREE_TYPE (type), (build_pointer_type
TYPE_READONLY (TREE_TYPE (type)), 1)); (build_type_variant (TREE_TYPE (type),
TYPE_READONLY (TREE_TYPE (type)), 1)),
TYPE_QUALS (type)));
else else
{ {
warning (OPT_Wattributes, "%qE attribute ignored", name); warning (OPT_Wattributes, "%qE attribute ignored", name);
...@@ -6988,9 +6990,11 @@ handle_const_attribute (tree *node, tree name, tree ARG_UNUSED (args), ...@@ -6988,9 +6990,11 @@ handle_const_attribute (tree *node, tree name, tree ARG_UNUSED (args),
else if (TREE_CODE (type) == POINTER_TYPE else if (TREE_CODE (type) == POINTER_TYPE
&& TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
TREE_TYPE (*node) TREE_TYPE (*node)
= build_pointer_type = (build_qualified_type
(build_type_variant (TREE_TYPE (type), 1, (build_pointer_type
TREE_THIS_VOLATILE (TREE_TYPE (type)))); (build_type_variant (TREE_TYPE (type), 1,
TREE_THIS_VOLATILE (TREE_TYPE (type)))),
TYPE_QUALS (type)));
else else
{ {
warning (OPT_Wattributes, "%qE attribute ignored", name); warning (OPT_Wattributes, "%qE attribute ignored", name);
......
2014-06-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51400
* g++.dg/cpp0x/constexpr-attribute3.C: New.
2014-06-30 Jeff Law <law@redhat.com> 2014-06-30 Jeff Law <law@redhat.com>
PR tree-optimization/61607 PR tree-optimization/61607
......
// PR c++/51400
// { dg-do compile { target c++11 } }
constexpr int (*f)() __attribute__((noreturn)) = 0;
constexpr int (*g)() __attribute__((const)) = 0;
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