-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Clang][Sema][Parse] Delay parsing of noexcept-specifiers in friend function declarations #90517
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
Merged
sdkrystian
merged 5 commits into
llvm:main
from
sdkrystian:delayed-parse-friend-except-spec
Apr 30, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b942879
[Clang][Parse] Delay parsing of noexcept-specifiers in friend functio…
sdkrystian ee4eed5
[FOLD] fix delayed parsing of exception specification for friend func…
sdkrystian ad2a0ef
[FOLD] add release note
sdkrystian 3e67d48
[FOLD] cleanup comments
sdkrystian fafe75f
[FOLD] address review comments
sdkrystian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -verify %s | ||
|
||
namespace N0 { | ||
struct A { | ||
void f0() noexcept(x); | ||
void g0() noexcept(y); // expected-error {{use of undeclared identifier 'y'}} | ||
|
||
void f1() noexcept(A::x); | ||
void g1() noexcept(A::y); // expected-error {{no member named 'y' in 'N0::A'}} | ||
|
||
template<typename T> | ||
void f2() noexcept(x); | ||
template<typename T> | ||
void g2() noexcept(y); // expected-error {{use of undeclared identifier 'y'}} | ||
|
||
template<typename T> | ||
void f3() noexcept(A::x); | ||
template<typename T> | ||
void g3() noexcept(A::y); // expected-error {{no member named 'y' in 'N0::A'}} | ||
|
||
friend void f4() noexcept(x); | ||
friend void g4() noexcept(y); // expected-error {{use of undeclared identifier 'y'}} | ||
|
||
friend void f5() noexcept(A::x); | ||
friend void g5() noexcept(A::y); // expected-error {{no member named 'y' in 'N0::A'}} | ||
|
||
template<typename T> | ||
friend void f6() noexcept(x); | ||
template<typename T> | ||
friend void g6() noexcept(y); // expected-error {{use of undeclared identifier 'y'}} | ||
|
||
template<typename T> | ||
friend void f7() noexcept(A::x); | ||
template<typename T> | ||
friend void g7() noexcept(A::y); // expected-error {{no member named 'y' in 'N0::A'}} | ||
|
||
static constexpr bool x = true; | ||
}; | ||
} // namespace N0 | ||
|
||
namespace N1 { | ||
template<typename T> | ||
struct A { | ||
void f0() noexcept(x); | ||
void g0() noexcept(y); // expected-error {{use of undeclared identifier 'y'}} | ||
|
||
void f1() noexcept(A::x); | ||
void g1() noexcept(A::y); // expected-error {{no member named 'y' in 'A<T>'}} | ||
|
||
template<typename U> | ||
void f2() noexcept(x); | ||
template<typename U> | ||
void g2() noexcept(y); // expected-error {{use of undeclared identifier 'y'}} | ||
|
||
template<typename U> | ||
void f3() noexcept(A::x); | ||
template<typename U> | ||
void g3() noexcept(A::y); // expected-error {{no member named 'y' in 'A<T>'}} | ||
|
||
friend void f4() noexcept(x); | ||
friend void g4() noexcept(y); // expected-error {{use of undeclared identifier 'y'}} | ||
|
||
friend void f5() noexcept(A::x); | ||
friend void g5() noexcept(A::y); // expected-error {{no member named 'y' in 'A<T>'}} | ||
|
||
template<typename U> | ||
friend void f6() noexcept(x); | ||
template<typename U> | ||
friend void g6() noexcept(y); // expected-error {{use of undeclared identifier 'y'}} | ||
|
||
template<typename U> | ||
friend void f7() noexcept(A::x); | ||
template<typename U> | ||
friend void g7() noexcept(A::y); // expected-error {{no member named 'y' in 'A<T>'}} | ||
|
||
static constexpr bool x = true; | ||
}; | ||
} // namespace N1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// RUN: %clang_cc1 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s | ||
|
||
namespace N0 { | ||
void f() noexcept; | ||
void g() noexcept; | ||
|
||
struct A { | ||
friend void f() noexcept; | ||
friend void g() noexcept(x); | ||
|
||
static constexpr bool x = true; | ||
}; | ||
} // namespace N0 | ||
|
||
namespace N1 { | ||
void f() noexcept; | ||
void g(); | ||
|
||
template<typename T> | ||
struct A { | ||
friend void f() noexcept; | ||
// FIXME: This error is emitted if no other errors occured (i.e. Sema::hasUncompilableErrorOccurred() is false). | ||
friend void g() noexcept(x); // expected-error {{no member 'x' in 'N1::A<int>'; it has not yet been instantiated}} | ||
// expected-note@-1 {{in instantiation of exception specification}} | ||
static constexpr bool x = false; // expected-note {{not-yet-instantiated member is declared here}} | ||
}; | ||
|
||
template struct A<int>; // expected-note {{in instantiation of template class}} | ||
} // namespace N1 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.