[PATCH] D129174: [C++20][Modules] Update ADL to handle basic.lookup.argdep p4 [P1815R2 part 1]

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 26 03:45:53 PDT 2022


ChuanqiXu added a comment.

FYI

When I implements/tests the modularized STL for libstdc++ (https://github.com/ChuanqiXu9/stdmodules), I find the patch blocks it. Due to the time is limited (I really wish we could have something workable in clang15), I made a pre-review commit in: https://github.com/llvm/llvm-project/commit/15ddc09ef9b05ffd5398165049b5202264fa203a

The problem shows in the tests:

  struct A {};
  
   template<typename Func>
   constexpr bool __call_is_nt(A)
   {
       return true;
   }
   ns::A make();
  
   template <typename T>
   bool foo(T t) {
       auto func = [](){};
       return __call_is_nt<decltype(func)>(t);
   }

The linkage of `__call_is_nt<decltype(func)>` in clang is internal linkage. So it is refused by this patch. This is not the fault of the patch. According to [basic.link], only names have linkage. So __call_is_nt<decltype(func)> should have same linkage with  its template, which should be external.

The root cause for the problem is that the semantics of internal linkage in clang is a mixed form of internal linkage and TU-Local in C++ Specifications. So here is the slight difference. It is hard to fix the root problem so I choose to give a workaround here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129174



More information about the cfe-commits mailing list