Message ID | 5295C801.703@oracle.com |
---|---|
State | New |
Headers | show |
On 11/27/2013 05:22 AM, Paolo Carlini wrote:
> Thus something like the below? Passes testing.
Yep. With a comment that we can only get there in checking mode via
build_non_dependent_expr, because any expression that calls or takes the
address of the function will have pull a FUNCTION_DECL out of the
COMPONENT_REF.
Jason
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; +}