summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-27 15:55:18 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-27 15:55:18 +0000
commitde193dff2f2d7f57869511bf8cf67f5cc2882753 (patch)
tree1494b1e6efd3f7322415da0ae3316d1356daab59
parent15b8d58c97ed9c7cef6c7de79dc5e32fb455d3a4 (diff)
downloadgcc-de193dff2f2d7f57869511bf8cf67f5cc2882753.tar.gz
/cp
2013-11-27 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58647 * semantics.c (cxx_eval_constant_expression, [COMPONENT_REF]): Handle function COMPONENT_REFs. /testsuite 2013-11-27 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58647 * g++.dg/parse/crash66.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205449 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/semantics.c10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/parse/crash66.C11
4 files changed, 32 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c45ddbec7bd..cbae6c43978 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2013-11-27 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58647
+ * semantics.c (cxx_eval_constant_expression, [COMPONENT_REF]):
+ Handle function COMPONENT_REFs.
+
2013-11-27 Aldy Hernandez <aldyh@redhat.com>
Jakub Jelinek <jakub@redhat.com>
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index e72a9c2f169..bc10f1de39b 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -9603,6 +9603,16 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t,
break;
case COMPONENT_REF:
+ if (is_overloaded_fn (t))
+ {
+ /* We can only get here in checking mode via
+ build_non_dependent_expr, because any expression that
+ calls or takes the address of the function will have
+ pulled a FUNCTION_DECL out of the COMPONENT_REF. */
+ gcc_checking_assert (allow_non_constant);
+ *non_constant_p = true;
+ return t;
+ }
r = cxx_eval_component_reference (call, t, allow_non_constant, addr,
non_constant_p, overflow_p);
break;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 075e0b14d80..cc389d4dc39 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-27 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/58647
+ * g++.dg/parse/crash66.C: New.
+
2013-11-27 Kenneth Zadeck <zadeck@naturalbridge.com>
* gcc.dg/c90-const-expr-8.c: Look for overflow on INT_MIN % -1.
diff --git a/gcc/testsuite/g++.dg/parse/crash66.C b/gcc/testsuite/g++.dg/parse/crash66.C
new file mode 100644
index 00000000000..ceedd2be243
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/crash66.C
@@ -0,0 +1,11 @@
+// PR c++/58647
+
+struct A
+{
+ static void foo();
+};
+
+template<typename> void bar()
+{
+ A().foo;
+}