-
Notifications
You must be signed in to change notification settings - Fork 15.6k
[Clang][Sema] Revisit the fix for the lambda within a type alias template decl #89934
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
Changes from 1 commit
9eb7a15
68186d4
4462adb
e8a7c4d
2a5dc0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,15 +91,60 @@ void bar() { | |
|
|
||
| namespace GH82104 { | ||
|
|
||
| template <typename, typename...> int Zero = 0; | ||
| template <typename, typename... D> int Value = sizeof...(D); | ||
|
|
||
| template <typename T, typename...U> | ||
| using T14 = decltype([]<int V = 0>() { return Zero<T, U...>; }()); | ||
| template <typename T, typename... U> | ||
| using T14 = decltype([]<int V = 0>(auto Param) { | ||
| return Value<T, U...> + V + (int)sizeof(Param); | ||
| }("hello")); | ||
|
|
||
| template <typename T> using T15 = T14<T, T>; | ||
|
|
||
| static_assert(__is_same(T15<char>, int)); | ||
|
|
||
| // FIXME: This still crashes because we can't extract template arguments T and U | ||
| // outside of the instantiation context of T16. | ||
| #if 0 | ||
| template <typename T, typename... U> | ||
| using T16 = decltype([](auto Param) requires (sizeof(Param) != 1 && sizeof...(U) > 0) { | ||
| return Value<T, U...> + sizeof(Param); | ||
| }); | ||
| static_assert(T16<int, char, float>()(42) == 2 + sizeof(42)); | ||
| #endif | ||
|
||
| } // namespace GH82104 | ||
|
|
||
| namespace GH89853 { | ||
|
|
||
| template <typename = void> | ||
| static constexpr auto innocuous = []<int m> { return m; }; | ||
|
|
||
| template <auto Pred = innocuous<>> | ||
| using broken = decltype(Pred.template operator()<42>()); | ||
|
|
||
| broken<> *boom; | ||
|
|
||
| template <auto Pred = | ||
| []<char c> { | ||
| (void)static_cast<char>(c); | ||
| }> | ||
| using broken2 = decltype(Pred.template operator()<42>()); | ||
|
|
||
| broken2<> *boom2; | ||
|
|
||
| template <auto Pred = []<char m> { return m; }> | ||
| using broken3 = decltype(Pred.template operator()<42>()); | ||
|
|
||
| broken3<> *boom3; | ||
|
|
||
| static constexpr auto non_default = []<char c>(True auto) { | ||
| (void) static_cast<char>(c); | ||
| }; | ||
|
|
||
| template<True auto Pred> | ||
| using broken4 = decltype(Pred.template operator()<42>(Pred)); | ||
|
|
||
| broken4<non_default>* boom4; | ||
|
|
||
| } | ||
|
|
||
| } // namespace lambda_calls | ||
Uh oh!
There was an error while loading. Please reload this page.