aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-09-16 22:22:35 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-09-16 22:22:35 +0200
commit1c2f613fbcc6ed7da19d8ed5aa487c813c21297b (patch)
tree1aee74c97f309f743e628901ae1bc355d7d71cc1 /gcc
parente7d61178099e49835d84fba9c5bffbace0f26099 (diff)
downloadgcc-1c2f613fbcc6ed7da19d8ed5aa487c813c21297b.zip
gcc-1c2f613fbcc6ed7da19d8ed5aa487c813c21297b.tar.gz
gcc-1c2f613fbcc6ed7da19d8ed5aa487c813c21297b.tar.bz2
re PR c++/77338 (ICE on invalid C++11 code on x86_64-linux-gnu: Segmentation fault)
PR c++/77338 * constexpr.c (cxx_eval_constant_expression) <case PARM_DECL>: Only call is_really_empty_class on complete types. * g++.dg/cpp0x/decltype-77338.C: New test. From-SVN: r240196
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/constexpr.c3
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype-77338.C7
4 files changed, 16 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ee0818e..0c7d351 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2016-09-16 Jakub Jelinek <jakub@redhat.com>
+ PR c++/77338
+ * constexpr.c (cxx_eval_constant_expression) <case PARM_DECL>: Only
+ call is_really_empty_class on complete types.
+
PR c++/77375
* class.c (check_bases): Set CLASSTYPE_HAS_MUTABLE if any
TYPE_HAS_MUTABLE_P for any bases.
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 34806d6..9308c54 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -3744,7 +3744,8 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
/* Defer in case this is only used for its type. */;
else if (TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE)
/* Defer, there's no lvalue->rvalue conversion. */;
- else if (is_really_empty_class (TREE_TYPE (t)))
+ else if (COMPLETE_TYPE_P (TREE_TYPE (t))
+ && is_really_empty_class (TREE_TYPE (t)))
{
/* If the class is empty, we aren't actually loading anything. */
r = build_constructor (TREE_TYPE (t), NULL);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bd3f70f..30d7615 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2016-09-16 Jakub Jelinek <jakub@redhat.com>
+ PR c++/77338
+ * g++.dg/cpp0x/decltype-77338.C: New test.
+
PR c++/77375
* g++.dg/cpp0x/mutable1.C: New test.
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-77338.C b/gcc/testsuite/g++.dg/cpp0x/decltype-77338.C
new file mode 100644
index 0000000..4ba7c96
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype-77338.C
@@ -0,0 +1,7 @@
+// PR c++/77338
+// { dg-do compile { target c++11 } }
+
+struct S;
+
+template <typename>
+auto f (S s) -> decltype (s (s)); // { dg-error "no match for call to" }