* expr.c (mark_use): Look through NOP_EXPR.
From-SVN: r261676
2018-06-15 Jason Merrill <jason@redhat.com>
+ PR c++/86147 - wrong capture for template argument.
+ * expr.c (mark_use): Look through NOP_EXPR.
+
* name-lookup.c (do_pushtag): Don't look through complete types, but
don't add to them either. Get context from current_binding_level.
* pt.c (tsubst_default_argument): Use push_to/pop_from_top_level.
expr = convert_from_reference (r);
}
break;
- default:
+
+ CASE_CONVERT:
+ case VIEW_CONVERT_EXPR:
if (location_wrapper_p (expr))
- {
- loc = EXPR_LOCATION (expr);
- recurse_op[0] = true;
- }
+ loc = EXPR_LOCATION (expr);
+ recurse_op[0] = true;
+ break;
+
+ default:
break;
}
--- /dev/null
+// PR c++/86147
+// { dg-do compile { target c++11 } }
+
+template <class T, T N> struct X { };
+
+struct A { static constexpr int value = 0; };
+
+template<class C>
+void foo() {
+ constexpr int N = C::value;
+ auto f = [&]{ X<int, N> a; };
+}
+
+int main() {
+ foo<A>();
+ return 0;
+}