[PATCH] D148802: [Sema] Lambdas are not part of immediate context for deduction

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 20 13:59:34 PDT 2023


shafik added inline comments.


================
Comment at: clang/test/CXX/temp/temp.deduct/p9.cpp:2
+// RUN:  %clang_cc1 -std=c++20 -verify %s
+template <class T>
+auto f(T) -> decltype([]() { T::invalid; } ());
----------------
Maybe helpful to quote p9?


================
Comment at: clang/test/CXX/temp/temp.deduct/p9.cpp:36
+template <class T>
+auto j(T t) -> decltype([](auto x) -> decltype(x.invalid) { } (t));   // #1
+void j(...);                                                            // #2
----------------
I know the note in the standard does not explain why this is ok but a comment would be helpful to future readers.


================
Comment at: clang/test/CXX/temp/temp.deduct/p9.cpp:39
+void test_j() {
+  j(0);
+}
----------------
I think the comment from the draft is helpful here "deduction fails on #1, calls #2" 


================
Comment at: clang/test/SemaCXX/warn-unused-lambda-capture.cpp:192
 void test_use_template() {
-  test_templated<int>(); // expected-note{{in instantiation of function template specialization 'test_templated<int>' requested here}}
+  test_templated<int>(); // expected-note 13{{in instantiation of function template specialization 'test_templated<int>' requested here}}
 }
----------------
Why the 12 extra notes here, I feel I am missing something but not sure what. I see the increase in notes in other cases as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148802/new/

https://reviews.llvm.org/D148802



More information about the cfe-commits mailing list