Thanks to visit codestin.com
Credit goes to github.com

Skip to content

reference to basic_ostream is ambiguous when using libc++ and #include <iostream> first #2

@FeignClaims

Description

@FeignClaims

This library fails to compile with libc++ when #include <iostream> in front of #include <ut2>.

godbolt

/Users/feignclaims/.conan2/p/b/boost44f8b84116680/p/include/ut2:169:8: error: reference to 'basic_ostream' is ambiguous
  169 | extern basic_ostream<char, char_traits<char>> clog; // only used if defined
      |        ^
/Users/feignclaims/.conan2/p/b/boost44f8b84116680/p/include/ut2:168:30: note: candidate found by name lookup is 'std::basic_ostream'
  168 | template<class, class> class basic_ostream;
      |                              ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/ostream:208:28: note: candidate found by name lookup is 'std::__1::basic_ostream'
  208 | class _LIBCPP_TEMPLATE_VIS basic_ostream : virtual public basic_ios<_CharT, _Traits> {
      |                            ^
In file included from /Users/feignclaims/code/cpp/cpp-practice/test/main.cpp:2:
/Users/feignclaims/.conan2/p/b/boost44f8b84116680/p/include/ut2:169:28: error: reference to 'char_traits' is ambiguous
  169 | extern basic_ostream<char, char_traits<char>> clog; // only used if defined
      |                            ^
/Users/feignclaims/.conan2/p/b/boost44f8b84116680/p/include/ut2:167:24: note: candidate found by name lookup is 'std::char_traits'
  167 | template<class> struct char_traits;
      |                        ^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/__string/char_traits.h:83:92: note: candidate found by name lookup is 'std::__1::char_traits'
   83 |     "for a temporary period. It will be removed in LLVM 19, so please migrate off of it.") char_traits {
      |                                                                                            ^
In file included from /Users/feignclaims/code/cpp/cpp-practice/test/main.cpp:2:
/Users/feignclaims/.conan2/p/b/boost44f8b84116680/p/include/ut2:180:39: error: reference to 'clog' is ambiguous
  180 |         static_assert(requires { std::clog << t; }, "[ERROR] No output supported: Consider #include <iostream> | ut::cfg<ut::override> = custom_cfg{} | #define UT_COMPILE_TIME_ONLY");
      |                                  ~~~~~^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/iostream:57:42: note: candidate found by name lookup is 'std::__1::clog'
   57 | extern _LIBCPP_EXPORTED_FROM_ABI ostream clog;
      |                                          ^
/Users/feignclaims/.conan2/p/b/boost44f8b84116680/p/include/ut2:169:47: note: candidate found by name lookup is 'std::clog'
  169 | extern basic_ostream<char, char_traits<char>> clog; // only used if defined
      |                                               ^
/Users/feignclaims/.conan2/p/b/boost44f8b84116680/p/include/ut2:181:22: error: reference to 'clog' is ambiguous
  181 |         return (std::clog << t);
      |                 ~~~~~^
/opt/homebrew/opt/llvm/bin/../include/c++/v1/iostream:57:42: note: candidate found by name lookup is 'std::__1::clog'
   57 | extern _LIBCPP_EXPORTED_FROM_ABI ostream clog;
      |                                          ^
/Users/feignclaims/.conan2/p/b/boost44f8b84116680/p/include/ut2:169:47: note: candidate found by name lookup is 'std::clog'
  169 | extern basic_ostream<char, char_traits<char>> clog; // only used if defined
      |                                               ^
/Users/feignclaims/.conan2/p/b/boost44f8b84116680/p/include/ut2:181:22: error: unknown type name 'clog'
  181 |         return (std::clog << t);
      |                      ^
/Users/feignclaims/.conan2/p/b/boost44f8b84116680/p/include/ut2:181:27: error: expected ')'
  181 |         return (std::clog << t);
      |                           ^
/Users/feignclaims/.conan2/p/b/boost44f8b84116680/p/include/ut2:181:16: note: to match this '('
  181 |         return (std::clog << t);
      |                ^
6 errors generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions