* expr.c (mark_use): Handle location wrappers.
From-SVN: r261121
+2018-06-02 Jason Merrill <jason@redhat.com>
+
+ PR c++/85761 - ICE with ill-formed use of const outer variable.
+ * expr.c (mark_use): Handle location wrappers.
+
2018-06-01 Jason Merrill <jason@redhat.com>
PR c++/85764 - bogus 'this' not captured error.
break;
}
}
+ temp_override<location_t> l (input_location);
+ if (loc != UNKNOWN_LOCATION)
+ input_location = loc;
expr = process_outer_var_ref (expr, tf_warning_or_error, true);
if (!(TREE_TYPE (oexpr)
&& TYPE_REF_P (TREE_TYPE (oexpr))))
}
break;
default:
+ if (location_wrapper_p (expr))
+ {
+ loc = EXPR_LOCATION (expr);
+ recurse_op[0] = true;
+ }
break;
}
--- /dev/null
+// PR c++/85761
+// { dg-do compile { target c++11 } }
+
+template <typename T>
+void out(const T& value);
+
+struct foo {
+ void bar();
+};
+
+void foo::bar()
+{
+ constexpr int COUNT = 10000;
+ auto run = []() {
+ out(COUNT); // { dg-error "9:not captured" }
+ };
+
+ run();
+}