* init.c (get_nsdmi): Use push_to/pop_from_top_level.
* tree.c (bot_manip): Don't set_flags_from_callee in a template.
From-SVN: r260972
+2018-05-24 Jason Merrill <jason@redhat.com>
+
+ PR c++/85807 - ICE with call in template NSDMI.
+ * init.c (get_nsdmi): Use push_to/pop_from_top_level.
+ * tree.c (bot_manip): Don't set_flags_from_callee in a template.
+
2018-05-30 Jason Merrill <jason@redhat.com>
PR c++/85873 - constant initializer_list array not in .rodata.
DECL_INSTANTIATING_NSDMI_P (member) = 1;
+ bool pushed = false;
+ if (!currently_open_class (DECL_CONTEXT (member)))
+ {
+ push_to_top_level ();
+ push_nested_class (DECL_CONTEXT (member));
+ pushed = true;
+ }
+
+ gcc_checking_assert (!processing_template_decl);
+
inject_this_parameter (DECL_CONTEXT (member), TYPE_UNQUALIFIED);
start_lambda_scope (member);
nsdmi_inst->put (member, init);
}
+ if (pushed)
+ {
+ pop_nested_class ();
+ pop_from_top_level ();
+ }
+
input_location = sloc;
cp_unevaluated_operand = un;
}
/* Make a copy of this node. */
t = copy_tree_r (tp, walk_subtrees, NULL);
if (TREE_CODE (*tp) == CALL_EXPR || TREE_CODE (*tp) == AGGR_INIT_EXPR)
- set_flags_from_callee (*tp);
+ if (!processing_template_decl)
+ set_flags_from_callee (*tp);
if (data.clear_location && EXPR_HAS_LOCATION (*tp))
SET_EXPR_LOCATION (*tp, input_location);
return t;
struct function<R (Args...)>
{
template<typename F>
- function(const F&);
+ function(const F&) { }
};
template<typename T>
public:
template <typename _Functor, typename = _Requires<_Functor, void>>
- A(_Functor);
+ A(_Functor) { }
};
template <class T> class B {
A f = [](T) {};
--- /dev/null
+// PR c++/85807
+// { dg-do compile { target c++11 } }
+
+template <class T>
+struct limits
+{
+ static T max();
+};
+
+template< class ScalarT = double >
+struct value_statistics_t
+{
+ double median = limits<double>::max();
+};
+
+template< class T > // required
+value_statistics_t<> calc()
+{
+ return {};
+}
+
+int main()
+{
+ value_statistics_t<> wstats = calc<double>();
+}