https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90080
Jonathan Wakely changed:
What|Removed |Added
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #2 from Jonathan Wakely ---
Reduced:
struct false_type { static constexpr bool value = false; };
struct true_type { static constexpr bool value = true; };
template struct enable_if { };
template struct enable_if { using type = T; };
template T&& declval();
template
struct is_static_castable : false_type
{};
template
struct is_static_castable(declval()))> :
true_type
{};
template::value, int>::type = 0>
To* safePtrCast(From* from)
{
return static_cast(from);
}
template::value, int>::type = 0>
To* safePtrCast(From* from)
{
return dynamic_cast(from);
}
struct BarBase{ virtual ~BarBase() = default;};
struct Bar : virtual BarBase{};
Bar* foo(BarBase* b){
return safePtrCast(b);
}
This started to fail with r258824:
PR c++/78489 - wrong SFINAE behavior.
PR c++/84489
* pt.c (type_unification_real): Don't defer substitution failure.
And was fixed on trunk by r269921:
PR c++/87748 - substitution failure error with decltype.
This issue is similar to PR 87480; in both cases we were doing
non-dependent
substitution with processing_template_decl set, leading to member access
expressions seeming still instantiation-dependent, and therefore decltype
not being simplified to its actual type. And as in that PR, the fix is to
clear processing_template_decl while substituting a default template
argument.
* pt.c (most_specialized_partial_spec): Clear
processing_template_decl.
So this looks like a dup of that PR, which is still present on gcc-8-branch.
*** This bug has been marked as a duplicate of bug 87748 ***