Hi,
On 11/23/2013 11:35 PM, Jason Merrill wrote:
On 10/20/2013 12:07 PM, Paolo Carlini wrote:
case COMPONENT_REF:
+ if (is_overloaded_fn (TREE_OPERAND (t, 1)))
+ return t;
Hmm, I'd be inclined to strip the COMPONENT_REF in this case to
produce something that's actually usable as a constant. Does that work?
I see. Thus I tested successfully the below (which, for the testcase,
forwards a BASELINK) or you mean something more complex?
Thanks,
Paolo.
//////////////////
Index: cp/semantics.c
===================================================================
--- cp/semantics.c (revision 205382)
+++ cp/semantics.c (working copy)
@@ -9601,8 +9601,13 @@ cxx_eval_constant_expression (const constexpr_call
break;
case COMPONENT_REF:
- r = cxx_eval_component_reference (call, t, allow_non_constant, addr,
- non_constant_p, overflow_p);
+ if (is_overloaded_fn (TREE_OPERAND (t, 1)))
+ r = cxx_eval_constant_expression (call, TREE_OPERAND (t, 1),
+ allow_non_constant, addr,
+ non_constant_p, overflow_p);
+ else
+ r = cxx_eval_component_reference (call, t, allow_non_constant, addr,
+ non_constant_p, overflow_p);
break;
case BIT_FIELD_REF:
Index: testsuite/g++.dg/parse/crash66.C
===================================================================
--- testsuite/g++.dg/parse/crash66.C (revision 0)
+++ testsuite/g++.dg/parse/crash66.C (working copy)
@@ -0,0 +1,11 @@
+// PR c++/58647
+
+struct A
+{
+ static void foo();
+};
+
+template<typename> void bar()
+{
+ A().foo;
+}