Hi,
On 11/26/2013 08:10 PM, Jason Merrill wrote:
On 11/26/2013 11:43 AM, Paolo Carlini wrote:
We have got a bunch of testcases, for example constexpr-ex4.C - attached
for your convenience - which trigger the assert !really_overloaded_fn
(t) ... What do you suggest?
Aha. Well, in that case we really can't get a constant value, so I'd
assert allow_non_constant, set *non_constant_p, and return t.
Actually, I'd do that any time we get a function COMPONENT_REF, since
that will only ever happen under the checking maybe_constant_value
call anyway. So a small expansion of your original patch.
Thus something like the below? Passes testing.
Thanks,
Paolo.
////////////////////////////
Index: cp/semantics.c
===================================================================
--- cp/semantics.c (revision 205433)
+++ cp/semantics.c (working copy)
@@ -9601,6 +9601,12 @@ cxx_eval_constant_expression (const constexpr_call
break;
case COMPONENT_REF:
+ if (is_overloaded_fn (t))
+ {
+ 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: 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;
+}