[PATCH] D142704: [C++20][Modules] Handle template declarations in header units.

Arthur Laurent via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 28 12:04:53 PST 2023


Arthapz added a comment.

tried the patch and it seems to work with libstdc++ but not with libc++

  > rm -rf .xmake build; xmake f --toolchain=clang; xmake b
  checking for platform ... linux
  checking for architecture ... x86_64
  [  0%]: generating.module.deps src/main.cpp
  [  4%]: compiling.headerunit.release iostream
  [  4%]: compiling.headerunit.release utility
  [  4%]: compiling.headerunit.release cstdio
  [  4%]: compiling.headerunit.release vector
  [  4%]: compiling.headerunit.release fstream
  [  4%]: compiling.headerunit.release memory
  [  4%]: compiling.headerunit.release queue
  [  4%]: compiling.headerunit.release string
  [  4%]: compiling.headerunit.release map
  [  4%]: compiling.headerunit.release complex
  [  4%]: compiling.headerunit.release deque
  [  4%]: compiling.headerunit.release iomanip
  [  4%]: compiling.headerunit.release cstdlib
  [  4%]: compiling.headerunit.release set
  [  4%]: compiling.headerunit.release algorithm
  [  4%]: compiling.headerunit.release exception
  [  4%]: compiling.headerunit.release stack
  [  4%]: compiling.headerunit.release list
  [ 88%]: compiling.release src/main.cpp
  [ 92%]: linking.release stl_headerunit_cpp_only
  [100%]: build ok!
  
  > rm -rf .xmake build; xmake f --toolchain=clang --cxxflags="-stdlib=libc++"; xmake b                                                                                               
  checking for platform ... linux
  checking for architecture ... x86_64
  [  0%]: generating.module.deps src/main.cpp
  [  4%]: compiling.headerunit.release memory
  [  4%]: compiling.headerunit.release exception
  [  4%]: compiling.headerunit.release queue
  [  4%]: compiling.headerunit.release iomanip
  [  4%]: compiling.headerunit.release vector
  [  4%]: compiling.headerunit.release utility
  [  4%]: compiling.headerunit.release deque
  [  4%]: compiling.headerunit.release set
  [  4%]: compiling.headerunit.release map
  [  4%]: compiling.headerunit.release fstream
  [  4%]: compiling.headerunit.release cstdio
  [  4%]: compiling.headerunit.release complex
  [  4%]: compiling.headerunit.release cstdlib
  [  4%]: compiling.headerunit.release iostream
  [  4%]: compiling.headerunit.release list
  [  4%]: compiling.headerunit.release string
  [  4%]: compiling.headerunit.release stack
  [  4%]: compiling.headerunit.release algorithm
  [ 88%]: compiling.release src/main.cpp
  error: /usr/bin/../include/c++/v1/ostream:254:20: error: 'std::basic_ostream<char>::operator<<' from module '/usr/bin/../include/c++/v1/complex' is not present in definition of 'std::ostream' in module '/usr/bin/../include/c++/v1/iostream'
      basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb);
                     ^
  /usr/bin/../include/c++/v1/ostream:221:20: note: declaration of 'operator<<' does not match
      basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&))
                     ^
  /usr/bin/../include/c++/v1/ostream:225:20: note: declaration of 'operator<<' does not match
      basic_ostream& operator<<(basic_ios<char_type, traits_type>&
                     ^
  /usr/bin/../include/c++/v1/ostream:230:20: note: declaration of 'operator<<' does not match
      basic_ostream& operator<<(ios_base& (*__pf)(ios_base&))
                     ^
  /usr/bin/../include/c++/v1/ostream:233:20: note: declaration of 'operator<<' does not match
      basic_ostream& operator<<(bool __n);
                     ^
  /usr/bin/../include/c++/v1/ostream:234:20: note: declaration of 'operator<<' does not match
      basic_ostream& operator<<(short __n);
    > in src/main.cpp
    
  > cat src/main.cpp
  import <iostream>;
  import <algorithm>;
  import <deque>;
  import <iostream>;
  import <map>;
  import <memory>;
  import <set>;
  import <utility>;
  import <vector>;
  import <string>;
  import <queue>;
  import <cstdlib>;
  import <utility>;
  import <exception>;
  import <list>;
  import <stack>;
  import <complex>;
  import <fstream>;
  import <cstdio>;
  import <iomanip>;
  
  using namespace std;
  
  int main(int argc, char** argv)
  {
      cout << "hello world!" << endl;
      return 0;
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142704



More information about the cfe-commits mailing list