diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2014-06-30 15:41:16 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2014-06-30 15:41:16 +0000 |
commit | 6e7ceb171d0905bdd7ffb7f97d98c2f0b11226a3 (patch) | |
tree | 0875cc06c0dda13b340390dc06bb3dee99154e16 | |
parent | e8b27b0809ded909f2652ff5d32fc83fbc955b4c (diff) | |
download | gcc-6e7ceb171d0905bdd7ffb7f97d98c2f0b11226a3.zip gcc-6e7ceb171d0905bdd7ffb7f97d98c2f0b11226a3.tar.gz gcc-6e7ceb171d0905bdd7ffb7f97d98c2f0b11226a3.tar.bz2 |
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
-rw-r--r-- | gcc/c-family/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-attribute3.C | 5 |
4 files changed, 26 insertions, 6 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 0112bc5..341df69 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +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> * c-common.h (enum cxx_dialect): Add cxx1z. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 087f036..ee89fca 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -6575,9 +6575,11 @@ handle_noreturn_attribute (tree *node, tree name, tree ARG_UNUSED (args), else if (TREE_CODE (type) == POINTER_TYPE && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) TREE_TYPE (*node) - = build_pointer_type - (build_type_variant (TREE_TYPE (type), - TYPE_READONLY (TREE_TYPE (type)), 1)); + = (build_qualified_type + (build_pointer_type + (build_type_variant (TREE_TYPE (type), + TYPE_READONLY (TREE_TYPE (type)), 1)), + TYPE_QUALS (type))); else { warning (OPT_Wattributes, "%qE attribute ignored", name); @@ -6988,9 +6990,11 @@ handle_const_attribute (tree *node, tree name, tree ARG_UNUSED (args), else if (TREE_CODE (type) == POINTER_TYPE && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) TREE_TYPE (*node) - = build_pointer_type - (build_type_variant (TREE_TYPE (type), 1, - TREE_THIS_VOLATILE (TREE_TYPE (type)))); + = (build_qualified_type + (build_pointer_type + (build_type_variant (TREE_TYPE (type), 1, + TREE_THIS_VOLATILE (TREE_TYPE (type)))), + TYPE_QUALS (type))); else { warning (OPT_Wattributes, "%qE attribute ignored", name); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4c4b683..930d60b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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> PR tree-optimization/61607 diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute3.C new file mode 100644 index 0000000..491c2e7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute3.C @@ -0,0 +1,5 @@ +// PR c++/51400 +// { dg-do compile { target c++11 } } + +constexpr int (*f)() __attribute__((noreturn)) = 0; +constexpr int (*g)() __attribute__((const)) = 0; |