aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-04-05 12:04:08 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-04-05 12:04:08 -0400
commit68218b64edccb3286d57217f7bd85264340e5a9f (patch)
treeb31fd8e3c77319582dd15d25b0a03adffc4ce8f5 /gcc
parent4cbe585c99bf621607420b341384bdb7e0e8a71d (diff)
downloadgcc-68218b64edccb3286d57217f7bd85264340e5a9f.zip
gcc-68218b64edccb3286d57217f7bd85264340e5a9f.tar.gz
gcc-68218b64edccb3286d57217f7bd85264340e5a9f.tar.bz2
PR c++/84665 - ICE with array of empty class.
* decl2.c (cp_check_const_attributes): Use fold_non_dependent_expr. From-SVN: r259132
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/decl2.c2
-rw-r--r--gcc/testsuite/g++.dg/ext/attr-noinline-4.C10
3 files changed, 14 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cd3e363..b453577 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2018-04-05 Jason Merrill <jason@redhat.com>
+ PR c++/84665 - ICE with array of empty class.
+ * decl2.c (cp_check_const_attributes): Use fold_non_dependent_expr.
+
PR c++/85228 - ICE with lambda in enumerator in template.
* pt.c (bt_instantiate_type_proc): Don't assume
CLASSTYPE_TEMPLATE_INFO is non-null.
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 6078fb6..b0bf824 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1416,7 +1416,7 @@ cp_check_const_attributes (tree attributes)
{
tree expr = TREE_VALUE (arg);
if (EXPR_P (expr))
- TREE_VALUE (arg) = maybe_constant_value (expr);
+ TREE_VALUE (arg) = fold_non_dependent_expr (expr);
}
}
}
diff --git a/gcc/testsuite/g++.dg/ext/attr-noinline-4.C b/gcc/testsuite/g++.dg/ext/attr-noinline-4.C
new file mode 100644
index 0000000..27c7ae8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attr-noinline-4.C
@@ -0,0 +1,10 @@
+// PR c++/84665
+
+struct S {} a[1];
+
+template <int N>
+void
+foo ()
+{
+ __attribute__ ((noinline (a[0]))) int c = 0; // { dg-error "wrong number of arguments" }
+}