Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid private check for member addresses #36772

Open
asl opened this issue May 11, 2018 · 2 comments
Open

Invalid private check for member addresses #36772

asl opened this issue May 11, 2018 · 2 comments
Labels
bugzilla Issues migrated from bugzilla c++

Comments

@asl
Copy link
Collaborator

asl commented May 11, 2018

Bugzilla Link 37424
Version trunk
OS All
CC @DougGregor,@broadwaylamb,@zygoloid

Extended Description

Consider the following code:

class TestClass {
private:
void func();
void func2();
void func2(int);
};
template <void (TestClass::*)()> class TemplateClass { };
template class TemplateClass<&TestClass::func>;
template class TemplateClass<&TestClass::func2>;

clang rejects the second instantiation while gcc does not. If I'm reading the standard correctly we should accept both.

@zygoloid
Copy link
Mannequin

zygoloid mannequin commented May 11, 2018

Confirmed, we're probably leaving the "no access checking errors" context before checking and converting the arguments rather than afterwards.

We also seem to get this wrong for both the overloaded and non-overload case for a partial specialization, for which the same rules apply ([temp.class.spec]p10):

template<typename T, void (TestClass::*)()> class TemplateClass2 {};
template class TemplateClass2<T, &TestClass::func>;
template class TemplateClass2<T, &TestClass::func2>;

... but it looks like we don't implement the rule at all for partial specializations.

@broadwaylamb
Copy link
Contributor

Addressed in https://reviews.llvm.org/D78404.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++
Projects
None yet
Development

No branches or pull requests

2 participants