+2019-03-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/87480 - decltype of member access in default template arg
+ * pt.c (type_unification_real): Accept a dependent result in
+ template context.
+
2019-03-19 Martin Sebor <msebor@redhat.com>
PR tree-optimization/89688
}
else
{
+ /* Even if the call is happening in template context, getting
+ here means it's non-dependent, and a default argument is
+ considered a separate definition under [temp.decls], so we can
+ do this substitution without processing_template_decl. This
+ is important if the default argument contains something that
+ might be instantiation-dependent like access (87480). */
+ processing_template_decl_sentinel s;
tree substed = NULL_TREE;
- if (saw_undeduced == 1 && processing_template_decl == 0)
+ if (saw_undeduced == 1)
{
/* First instatiate in template context, in case we still
depend on undeduced template parameters. */
--- /dev/null
+// PR c++/87480
+// { dg-do compile { target c++11 } }
+
+template<typename T> T&& declval();
+
+template <typename T, typename = decltype(declval<T>().d)> void f(T) { }
+
+struct A {
+ double d;
+};
+
+template <typename>
+void j(A& a) {
+ f(a);
+}