-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang] ODR hashes depth+index and not name of TemplateTypeParm #144796
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5164,6 +5164,29 @@ namespace A { | |
A::X x; | ||
#endif | ||
|
||
namespace TemplateDecltypeOperator { | ||
|
||
#if defined(FIRST) || defined(SECOND) | ||
template <class T6> | ||
T6 func(); | ||
#endif | ||
|
||
#if defined(SECOND) | ||
template <class UnrelatedT> | ||
using UnrelatedAlias = decltype(func<UnrelatedT>())(); | ||
#endif | ||
|
||
#if defined(FIRST) || defined(SECOND) | ||
class A { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without the changes in this PR, this test would fail with this message:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add a comment to this test that points to this PR/GitHub issue and mentions that we need to make sure despite the fact that It might prove helpful in the future if somebody decides to reassess the choices made here and choose different trade-offs. |
||
template <class T6> | ||
operator decltype(func<T6>()) () {} | ||
}; | ||
#else | ||
A a; | ||
#endif | ||
|
||
} | ||
|
||
// Keep macros contained to one file. | ||
#ifdef FIRST | ||
#undef FIRST | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you split the variadic templates into a separate change?
This looks like an independent issue (the code below should detect an ODR violation, but it doesn't) and actually opens a whole other can of worms wrt to what needs to be checked (e.g. checking types of non-type template parameters, template headers of template template parameters, etc).