Skip to content

using namespace std before include causes ambiguous reference error #96423

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

Open
ncihnegn opened this issue Jun 23, 2024 · 10 comments
Open

using namespace std before include causes ambiguous reference error #96423

ncihnegn opened this issue Jun 23, 2024 · 10 comments
Labels
clang:modules C++20 modules and Clang Header Modules

Comments

@ncihnegn
Copy link

With the patch suggested in #96147 applied on e7622ab,

Source:

import std;
using namespace std;

#include <vector>

int main() {
  return 0;
}

Errors:

[1/4] Scanning /Users/Temp/playground/c++-std-modules/main.cpp for CXX dependencies
[2/4] Generating CXX dyndep file CMakeFiles/main.dir/CXX.dd
[3/4] Building CXX object CMakeFiles/main.dir/main.cpp.o
FAILED: CMakeFiles/main.dir/main.cpp.o 
/usr/local/Sither/Cellar/llvm/e7622ab47/bin/clang++  -I/Users/Temp/playground/c++-std-modules/_build/_deps/doctest-src -g -std=gnu++26 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -MD -MT CMakeFiles/main.dir/main.cpp.o -MF CMakeFiles/main.dir/main.cpp.o.d @CMakeFiles/main.dir/main.cpp.o.modmap -o CMakeFiles/main.dir/main.cpp.o -c /Users/Temp/playground/c++-std-modules/main.cpp
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:108:28: error: reference to 'tm' is ambiguous
  108 | char *asctime(const struct tm *);
      |                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:112:8: error: reference to 'tm' is ambiguous
  112 | struct tm *getdate(const char *);
      |        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:113:8: error: reference to 'tm' is ambiguous
  113 | struct tm *gmtime(const time_t *);
      |        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:114:8: error: reference to 'tm' is ambiguous
  114 | struct tm *localtime(const time_t *);
      |        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:115:22: error: reference to 'tm' is ambiguous
  115 | time_t mktime(struct tm *) __DARWIN_ALIAS(mktime);
      |                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:116:82: error: reference to 'tm' is ambiguous
  116 | size_t strftime(char * __restrict, size_t, const char * __restrict, const struct tm * __restrict) __DARWIN_ALIAS(strftime);
      |                                                                                  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:117:73: error: reference to 'tm' is ambiguous
  117 | char *strptime(const char * __restrict, const char * __restrict, struct tm * __restrict) __DARWIN_ALIAS(strptime);
      |                                                                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:125:30: error: reference to 'tm' is ambiguous
  125 | char *asctime_r(const struct tm * __restrict, char * __restrict);
      |                              ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:127:8: error: reference to 'tm' is ambiguous
  127 | struct tm *gmtime_r(const time_t * __restrict, struct tm * __restrict);
      |        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:127:55: error: reference to 'tm' is ambiguous
  127 | struct tm *gmtime_r(const time_t * __restrict, struct tm * __restrict);
      |                                                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:128:8: error: reference to 'tm' is ambiguous
  128 | struct tm *localtime_r(const time_t * __restrict, struct tm * __restrict);
      |        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:128:58: error: reference to 'tm' is ambiguous
  128 | struct tm *localtime_r(const time_t * __restrict, struct tm * __restrict);
      |                                                          ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:137:25: error: reference to 'tm' is ambiguous
  137 | time_t timelocal(struct tm * const);
      |                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:138:22: error: reference to 'tm' is ambiguous
  138 | time_t timegm(struct tm * const);
      |                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:142:28: error: reference to 'timespec' is ambiguous
  142 | int nanosleep(const struct timespec *__rqtp, struct timespec *__rmtp) __DARWIN_ALIAS_C(nanosleep);
      |                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:33:1: note: candidate found by name lookup is 'timespec'
   33 | _STRUCT_TIMESPEC
      | ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:29:40: note: expanded from macro '_STRUCT_TIMESPEC'
   29 | #define _STRUCT_TIMESPEC        struct timespec
      |                                        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:15:14: note: candidate found by name lookup is 'std::timespec'
   15 |   using std::timespec _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:142:53: error: reference to 'timespec' is ambiguous
  142 | int nanosleep(const struct timespec *__rqtp, struct timespec *__rmtp) __DARWIN_ALIAS_C(nanosleep);
      |                                                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:33:1: note: candidate found by name lookup is 'timespec'
   33 | _STRUCT_TIMESPEC
      | ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:29:40: note: expanded from macro '_STRUCT_TIMESPEC'
   29 | #define _STRUCT_TIMESPEC        struct timespec
      |                                        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:15:14: note: candidate found by name lookup is 'std::timespec'
   15 |   using std::timespec _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:175:47: error: reference to 'timespec' is ambiguous
  175 | int clock_getres(clockid_t __clock_id, struct timespec *__res);
      |                                               ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:33:1: note: candidate found by name lookup is 'timespec'
   33 | _STRUCT_TIMESPEC
      | ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:29:40: note: expanded from macro '_STRUCT_TIMESPEC'
   29 | #define _STRUCT_TIMESPEC        struct timespec
      |                                        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:15:14: note: candidate found by name lookup is 'std::timespec'
   15 |   using std::timespec _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:178:48: error: reference to 'timespec' is ambiguous
  178 | int clock_gettime(clockid_t __clock_id, struct timespec *__tp);
      |                                                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:33:1: note: candidate found by name lookup is 'timespec'
   33 | _STRUCT_TIMESPEC
      | ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:29:40: note: expanded from macro '_STRUCT_TIMESPEC'
   29 | #define _STRUCT_TIMESPEC        struct timespec
      |                                        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:15:14: note: candidate found by name lookup is 'std::timespec'
   15 |   using std::timespec _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:187:54: error: reference to 'timespec' is ambiguous
  187 | int clock_settime(clockid_t __clock_id, const struct timespec *__tp);
      |                                                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:33:1: note: candidate found by name lookup is 'timespec'
   33 | _STRUCT_TIMESPEC
      | ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:29:40: note: expanded from macro '_STRUCT_TIMESPEC'
   29 | #define _STRUCT_TIMESPEC        struct timespec
      |                                        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:15:14: note: candidate found by name lookup is 'std::timespec'
   15 |   using std::timespec _LIBCPP_USING_IF_EXISTS;
      |              ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
ninja: build stopped: subcommand failed.
@EugeneZelenko EugeneZelenko added clang:modules C++20 modules and Clang Header Modules and removed new issue labels Jun 23, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 23, 2024

@llvm/issue-subscribers-clang-modules

Author: None (ncihnegn)

With the patch suggested in #96147 applied on e7622ab,

Source:

import std;
using namespace std;

#include &lt;vector&gt;

int main() {
  return 0;
}

Errors:

[1/4] Scanning /Users/Temp/playground/c++-std-modules/main.cpp for CXX dependencies
[2/4] Generating CXX dyndep file CMakeFiles/main.dir/CXX.dd
[3/4] Building CXX object CMakeFiles/main.dir/main.cpp.o
FAILED: CMakeFiles/main.dir/main.cpp.o 
/usr/local/Sither/Cellar/llvm/e7622ab47/bin/clang++  -I/Users/Temp/playground/c++-std-modules/_build/_deps/doctest-src -g -std=gnu++26 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk -MD -MT CMakeFiles/main.dir/main.cpp.o -MF CMakeFiles/main.dir/main.cpp.o.d @<!-- -->CMakeFiles/main.dir/main.cpp.o.modmap -o CMakeFiles/main.dir/main.cpp.o -c /Users/Temp/playground/c++-std-modules/main.cpp
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:108:28: error: reference to 'tm' is ambiguous
  108 | char *asctime(const struct tm *);
      |                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:112:8: error: reference to 'tm' is ambiguous
  112 | struct tm *getdate(const char *);
      |        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:113:8: error: reference to 'tm' is ambiguous
  113 | struct tm *gmtime(const time_t *);
      |        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:114:8: error: reference to 'tm' is ambiguous
  114 | struct tm *localtime(const time_t *);
      |        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:115:22: error: reference to 'tm' is ambiguous
  115 | time_t mktime(struct tm *) __DARWIN_ALIAS(mktime);
      |                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:116:82: error: reference to 'tm' is ambiguous
  116 | size_t strftime(char * __restrict, size_t, const char * __restrict, const struct tm * __restrict) __DARWIN_ALIAS(strftime);
      |                                                                                  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:117:73: error: reference to 'tm' is ambiguous
  117 | char *strptime(const char * __restrict, const char * __restrict, struct tm * __restrict) __DARWIN_ALIAS(strptime);
      |                                                                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:125:30: error: reference to 'tm' is ambiguous
  125 | char *asctime_r(const struct tm * __restrict, char * __restrict);
      |                              ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:127:8: error: reference to 'tm' is ambiguous
  127 | struct tm *gmtime_r(const time_t * __restrict, struct tm * __restrict);
      |        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:127:55: error: reference to 'tm' is ambiguous
  127 | struct tm *gmtime_r(const time_t * __restrict, struct tm * __restrict);
      |                                                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:128:8: error: reference to 'tm' is ambiguous
  128 | struct tm *localtime_r(const time_t * __restrict, struct tm * __restrict);
      |        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:128:58: error: reference to 'tm' is ambiguous
  128 | struct tm *localtime_r(const time_t * __restrict, struct tm * __restrict);
      |                                                          ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:137:25: error: reference to 'tm' is ambiguous
  137 | time_t timelocal(struct tm * const);
      |                         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:138:22: error: reference to 'tm' is ambiguous
  138 | time_t timegm(struct tm * const);
      |                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:75:8: note: candidate found by name lookup is 'tm'
   75 | struct tm {
      |        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:16:14: note: candidate found by name lookup is 'std::tm'
   16 |   using std::tm _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:142:28: error: reference to 'timespec' is ambiguous
  142 | int nanosleep(const struct timespec *__rqtp, struct timespec *__rmtp) __DARWIN_ALIAS_C(nanosleep);
      |                            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:33:1: note: candidate found by name lookup is 'timespec'
   33 | _STRUCT_TIMESPEC
      | ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:29:40: note: expanded from macro '_STRUCT_TIMESPEC'
   29 | #define _STRUCT_TIMESPEC        struct timespec
      |                                        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:15:14: note: candidate found by name lookup is 'std::timespec'
   15 |   using std::timespec _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:142:53: error: reference to 'timespec' is ambiguous
  142 | int nanosleep(const struct timespec *__rqtp, struct timespec *__rmtp) __DARWIN_ALIAS_C(nanosleep);
      |                                                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:33:1: note: candidate found by name lookup is 'timespec'
   33 | _STRUCT_TIMESPEC
      | ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:29:40: note: expanded from macro '_STRUCT_TIMESPEC'
   29 | #define _STRUCT_TIMESPEC        struct timespec
      |                                        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:15:14: note: candidate found by name lookup is 'std::timespec'
   15 |   using std::timespec _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:175:47: error: reference to 'timespec' is ambiguous
  175 | int clock_getres(clockid_t __clock_id, struct timespec *__res);
      |                                               ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:33:1: note: candidate found by name lookup is 'timespec'
   33 | _STRUCT_TIMESPEC
      | ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:29:40: note: expanded from macro '_STRUCT_TIMESPEC'
   29 | #define _STRUCT_TIMESPEC        struct timespec
      |                                        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:15:14: note: candidate found by name lookup is 'std::timespec'
   15 |   using std::timespec _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:178:48: error: reference to 'timespec' is ambiguous
  178 | int clock_gettime(clockid_t __clock_id, struct timespec *__tp);
      |                                                ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:33:1: note: candidate found by name lookup is 'timespec'
   33 | _STRUCT_TIMESPEC
      | ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:29:40: note: expanded from macro '_STRUCT_TIMESPEC'
   29 | #define _STRUCT_TIMESPEC        struct timespec
      |                                        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:15:14: note: candidate found by name lookup is 'std::timespec'
   15 |   using std::timespec _LIBCPP_USING_IF_EXISTS;
      |              ^
In file included from /Users/Temp/playground/c++-std-modules/main.cpp:4:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/vector:314:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/remove.h:12:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/__algorithm/find.h:31:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/cwchar:113:
In file included from /usr/local/Sither/Cellar/llvm/e7622ab47/bin/../include/c++/v1/wchar.h:127:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/wchar.h:91:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/time.h:187:54: error: reference to 'timespec' is ambiguous
  187 | int clock_settime(clockid_t __clock_id, const struct timespec *__tp);
      |                                                      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:33:1: note: candidate found by name lookup is 'timespec'
   33 | _STRUCT_TIMESPEC
      | ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/usr/include/sys/_types/_timespec.h:29:40: note: expanded from macro '_STRUCT_TIMESPEC'
   29 | #define _STRUCT_TIMESPEC        struct timespec
      |                                        ^
/usr/local/Sither/Cellar/llvm/e7622ab47/share/libc++/v1/std/ctime.inc:15:14: note: candidate found by name lookup is 'std::timespec'
   15 |   using std::timespec _LIBCPP_USING_IF_EXISTS;
      |              ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
ninja: build stopped: subcommand failed.

@ChuanqiXu9 ChuanqiXu9 assigned ChuanqiXu9 and unassigned ChuanqiXu9 Jun 24, 2024
@ChuanqiXu9 ChuanqiXu9 added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jun 24, 2024
@ChuanqiXu9
Copy link
Member

From the error message, I suspect this is a library issue too. But I am not sure if it is amendable since it looks like problems from C libraries.

@mordante
Copy link
Member

mordante commented Jul 5, 2024

Does the compilation issue disappear when you remove the using namespace std;?

@ncihnegn
Copy link
Author

Does the compilation issue disappear when you remove the using namespace std;?

Yes.

@ChuanqiXu9
Copy link
Member

I feel this is some use case problems. Maybe it worth to discuss this in WG21?

@ncihnegn
Copy link
Author

Why? This will be completely fine if not using modules.

@ChuanqiXu9
Copy link
Member

Since without modules, there is if guards and #pragma once. But with modules, we won't leak the the preprocessor state.

So that back in this example, look at the reproducer: it says, when the compiler parse char *asctime(const struct tm *); in /usr/include/time.h, the compiler can see two tm. One is from the current TU and the other one is std::tm from the std module. std::tm is avialable here since we're using std namespace globally.

So it makes sense to me.

@ChuanqiXu9
Copy link
Member

And this issue may be relevant: #80663

We can get rid of such issues if we can provide that.

@ldionne
Copy link
Member

ldionne commented Oct 1, 2024

Is it possible that this is actually related to the using_if_exists attribute?

using std::tm _LIBCPP_USING_IF_EXISTS;

IIRC, using_if_exists is implemented by creating another type of declaration which kind of forwards to the underlying declaration upon usage. Could it be that Clang sees this and thinks the using_if_exists declaration and the original declaration are different?

@ChuanqiXu9
Copy link
Member

After I review the issue, I feel this may be another compiler's bug. The compiler should be able to recognize the two tm are actually the same one.

@ChuanqiXu9 ChuanqiXu9 removed the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:modules C++20 modules and Clang Header Modules
Projects
None yet
Development

No branches or pull requests

6 participants