-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
clang accepts friend that g++/Comeau reject #12361
Comments
cloned to rdar://problem/10869563 |
@llvm/issue-subscribers-clang-frontend |
This is still an issue. gcc 13.2 rejects the code while clang 17.0.1 and trunk (60c4f82) accept it. https://godbolt.org/z/3oje3KbeW |
EDG, GCC, and MSVC agree that |
…ayed (#91430) attempt to fix #12361 Consider this example: ```cpp class D { class E{ class F{}; friend void foo(D::E::F& q); }; friend void foo(D::E::F& q); }; void foo(D::E::F& q) {} ``` The first friend declaration of foo is correct. After that, the second friend declaration delayed access checking and set its previous declaration to be the first one. When doing access checking of `F`(which is private filed of `E`), we put its canonical declaration(the first friend declaration) into `EffectiveContext.Functions`. Actually, we are still checking the first one. This is incorrect due to the delayed checking. Creating a new scope to indicate we are parsing a friend declaration and doing access checking in time.
Extended Description
This code:
is accepted by clang but rejected by g++ and Comeau. Gnu says they are right to reject (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52212), so I'm filing it with you. One of you guys is right; perhaps you can get together and agree who it is?
The text was updated successfully, but these errors were encountered: