2015-06-01 Jason Merrill <jason@redhat.com>
+ PR c++/65942
+ * decl2.c (mark_used): Don't always instantiate constexpr fns.
+ * constexpr.c (cxx_eval_call_expression): Instantiate them here.
+
PR c++/44282
* mangle.c (attr_strcmp): New.
(write_CV_qualifiers_for_type): Also write out attributes that
return build_zero_init (DECL_CONTEXT (fun), NULL_TREE, false);
}
+ /* We can't defer instantiating the function any longer. */
+ if (!DECL_INITIAL (fun)
+ && DECL_TEMPLOID_INSTANTIATION (fun))
+ {
+ ++function_depth;
+ instantiate_decl (fun, /*defer_ok*/false, /*expl_inst*/false);
+ --function_depth;
+ }
+
/* If in direct recursive call, optimize definition search. */
if (ctx && ctx->call && ctx->call->fundef->decl == fun)
new_call.fundef = ctx->call->fundef;
&& DECL_TEMPLATE_INFO (decl)
&& (decl_maybe_constant_var_p (decl)
|| (TREE_CODE (decl) == FUNCTION_DECL
- && (DECL_DECLARED_CONSTEXPR_P (decl)
- || DECL_OMP_DECLARE_REDUCTION_P (decl)))
+ && DECL_OMP_DECLARE_REDUCTION_P (decl))
|| undeduced_auto_decl (decl))
&& !uses_template_parms (DECL_TI_ARGS (decl)))
{
--- /dev/null
+// PR c++/65942
+// { dg-do compile { target c++11 } }
+
+template <typename T> constexpr int f(T t) { return t; }
+template <typename T, typename = decltype(f(T()))> void g(T) { }
+void g(...) { }
+int main() { g(""); }