Open llvmbot opened 5 years ago
The following is a more minimal version of the above showing the same error:
struct S
{
private:
template <typename> static constexpr void Impl() { }
public:
template <typename X> using U = decltype(Impl<X>());
};
using X = S::U<void>;
Confirmed: https://godbolt.org/z/76ncerc3T
see https://github.com/llvm/llvm-project/issues/66604 for some more examples
@llvm/issue-subscribers-clang-frontend
Author: None (llvmbot)
Patch was reverted so reopening this one.
Fix was done in private branch.
Ok, I've made two attempts to fix but both ended up insufficient. The idea was simple - since access checks depend on context:
, let's start instantiation of a type alias from the context where the alias is declared. This fixes the problem from this issue. However, there is also this piece of code starting from:
that checks if some type referenced ATM with a template-id matches current context (or outer context) and this context is a record, then canonical type of the type that is being checked is assigned with InjectedClassNameType
of the found record. And it seems there might be quite a lot of uncovered by check-clang tests cases where switch of the CurContext
breaks this whole scheme. I worked around at least two cases in https://github.com/llvm/llvm-project/pull/75069, and received two other reported. So, perhaps there should be another, less obvious approach to fix this.
cc @zygoloid , @cor3ntin , @erichkeane in case you have other ideas.
Not merged yet.
@llvm/issue-subscribers-c-11
Author: None (llvmbot)
Extended Description
The following code fails to compile with an erroneous error "'Impl' is a private member of 'S'":
The above code compiles in gcc et al. Making the following change allows compilation: