Commit e597f682 by Jason Merrill Committed by Jason Merrill

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.

From-SVN: r258962
parent 28ed1460
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
......
......@@ -2619,7 +2619,7 @@ original_binfo (tree binfo, tree here)
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.
......
// 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, "" );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment