]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/58647 (ICE with function pointer)
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 27 Nov 2013 15:55:18 +0000 (15:55 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 27 Nov 2013 15:55:18 +0000 (15:55 +0000)
/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.

From-SVN: r205449

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/crash66.C [new file with mode: 0644]

index c45ddbec7bd26ce0b20257bccec6c46e95515b3e..cbae6c43978fc606240046bbe36252f3318b18f2 100644 (file)
@@ -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>
 
index e72a9c2f1691b580cd53f92de37b4705e635a83e..bc10f1de39bb01a2c3a975f764627ac28adf93e4 100644 (file)
@@ -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;
index 075e0b14d80f1e44d4ae16e3c06f1adcfb486c44..cc389d4dc392b3a380295613b81b074eac1cbe30 100644 (file)
@@ -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 (file)
index 0000000..ceedd2b
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/58647
+
+struct A
+{
+  static void foo();
+};
+
+template<typename> void bar()
+{
+  A().foo;
+}