[all-commits] [llvm/llvm-project] 15ddc0: [C++20] [Modules] Handle linkage properly for spec...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Tue Jul 26 03:31:12 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 15ddc09ef9b05ffd5398165049b5202264fa203a
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2022-07-26 (Tue, 26 Jul 2022)

  Changed paths:
    M clang/lib/Sema/SemaOverload.cpp
    A clang/test/Modules/instantiation-argdep-lookup.cppm

  Log Message:
  [C++20] [Modules] Handle linkage properly for specializations when overloading

Currently, the semantics of linkage in clang is slightly
different from the semantics in C++ spec. In C++ spec, only names
have linkage. So that all entities of the same should share
one linkage. But in clang, different entities of the same could
have different linkage.

It would break a use case where the template have external linkage and
its specialization have internal linkage due to its type argument is
internal linkage. The root cause is that the semantics of internal
linkage in clang is a mixed form of internal linkage and TU-local in
C++ spec. It is hard to solve the root problem and I tried to add a
workaround inplace.

More information about the All-commits mailing list