* search.c (any_dependent_bases_p): Check uses_template_parms
rather than processing_template_decl.
From-SVN: r258962
+2018-03-27 Jason Merrill <jason@redhat.com>
+
+ PR c++/85060 - wrong-code with call to base member in template.
+ * search.c (any_dependent_bases_p): Check uses_template_parms
+ rather than processing_template_decl.
+
2018-03-29 David Malcolm <dmalcolm@redhat.com>
PR c++/85110
bool
any_dependent_bases_p (tree type)
{
- if (!type || !CLASS_TYPE_P (type) || !processing_template_decl)
+ if (!type || !CLASS_TYPE_P (type) || !uses_template_parms (type))
return false;
/* If we haven't set TYPE_BINFO yet, we don't know anything about the bases.
--- /dev/null
+// PR c++/85060
+// { dg-do compile { target c++14 } }
+
+struct CA {
+ constexpr int foo() const { return 42; }
+};
+
+template <class T>
+struct CB : CA { };
+
+template <class T>
+struct CC : CB<T> {
+ constexpr int bar() const {
+ const int m = CA::foo();
+ return m;
+ }
+
+ constexpr int baz() const {
+ const T m = CA::foo();
+ return m;
+ }
+};
+
+constexpr CC<double> c;
+
+static_assert( c.bar() == 42, "" );