+2019-04-01 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/62207
+ * pt.c (tsubst_copy): Deal with lookup_name not returing a variable.
+
2019-03-31 Marek Polacek <polacek@redhat.com>
PR c++/89852 - ICE with C++11 functional cast with { }.
{
/* First try name lookup to find the instantiation. */
r = lookup_name (DECL_NAME (t));
- if (r && !is_capture_proxy (r))
+ if (r)
{
- /* Make sure that the one we found is the one we want. */
- tree ctx = enclosing_instantiation_of (DECL_CONTEXT (t));
- if (ctx != DECL_CONTEXT (r))
- r = NULL_TREE;
+ if (!VAR_P (r))
+ {
+ /* During error-recovery we may find a non-variable,
+ even an OVERLOAD: just bail out and avoid ICEs and
+ duplicate diagnostics (c++/62207). */
+ gcc_assert (seen_error ());
+ return error_mark_node;
+ }
+ if (!is_capture_proxy (r))
+ {
+ /* Make sure the one we found is the one we want. */
+ tree ctx = enclosing_instantiation_of (DECL_CONTEXT (t));
+ if (ctx != DECL_CONTEXT (r))
+ r = NULL_TREE;
+ }
}
if (r)
}
gcc_assert (cp_unevaluated_operand || TREE_STATIC (r)
|| decl_constant_var_p (r)
- || errorcount || sorrycount);
+ || seen_error ());
if (!processing_template_decl
&& !TREE_STATIC (r))
r = process_outer_var_ref (r, complain);
+2019-04-01 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/62207
+ * g++.dg/template/crash130.C: New.
+ * g++.dg/template/crash131.C: Likewise.
+
2019-04-01 Martin Sebor <msebor@redhat.com>
PR c/89685
--- /dev/null
+// PR c++/62207
+
+template<class F>
+class X {
+public:
+ template<F f> class Y {};
+ template<F f> void y() {}
+ X(F f)
+ {
+ Y<f> y; // { dg-error "not a constant" }
+
+ y.value();
+ }
+};
+
+int main() { X<int> x(1); }