* pt.c (instantiate_decl): Clear fn_context for lambdas.
From-SVN: r258502
+2018-03-13 Jason Merrill <jason@redhat.com>
+
+ PR c++/82565 - ICE with concepts and generic lambda.
+ * pt.c (instantiate_decl): Clear fn_context for lambdas.
+
2018-03-13 Jason Merrill <jason@redhat.com>
PR c++/84720 - ICE with rvalue ref non-type argument.
bool push_to_top, nested;
tree fn_context;
fn_context = decl_function_context (d);
+ if (LAMBDA_FUNCTION_P (d))
+ /* tsubst_lambda_expr resolved any references to enclosing functions. */
+ fn_context = NULL_TREE;
nested = current_function_decl != NULL_TREE;
push_to_top = !(nested && fn_context == current_function_decl);
--- /dev/null
+// PR c++/82565
+// { dg-do compile { target c++14 } }
+// { dg-additional-options -fconcepts }
+
+struct string
+{
+ string();
+ string(const char *);
+ bool empty() const;
+};
+
+template<typename T, typename ReturnType>
+concept bool Concept() {
+ return requires(T t, const string& s) {
+ { t(s) } -> ReturnType;
+ };
+}
+
+struct test {
+ string _str;
+
+ template<typename Visitor>
+ requires Concept<Visitor, bool>()
+ decltype(auto) visit(Visitor&& visitor) const {
+ return visitor(_str);
+ }
+
+};
+
+int main() {
+ test().visit([] (auto& x) { return x.empty(); });
+}