Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
906 stars 99 forks source link

No type/template in namespace 'std' for some C++17 features, but working for others #518

Open MylesAdams opened 5 years ago

MylesAdams commented 5 years ago

I've been trying a lot of things to fix this but I haven't been able to figure it out. For the most part everything with irony seems to work. But today I realized that some of the new C++17 features aren't recognized by irony, even though it compiles fine with the version of clang that I'm using.

I am currently on MacOS and using clang 7.0.0. Iit is telling me that no type/template in namespace 'std' for things like std::variant, std::optional, std::any, std::byte, std::filesystem. But it works for things like std::string_view.

otool -L ./irony-server
./irony-server:
    /usr/local/opt/llvm/lib/libclang.dylib (compatibility version 1.0.0, current version 7.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.4)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)
[
{
  "directory": "/Users/mylesadams/Documents/Workspace/c++/CS170/CS170_SimpleShell/build",
  "command": "/usr/local/opt/llvm/bin/clang++   -I/usr/local/include    -std=c++17 -o CMakeFiles/simple_shell.dir/main.cpp.o -c /Users/mylesadams/Documents/Workspace/c++/CS170/CS170_SimpleShell/main.cpp",
  "file": "/Users/mylesadams/Documents/Workspace/c++/CS170/CS170_SimpleShell/main.cpp"
}
]

I've made sure that irony-server is using libclang from clang 7 installed with homebrew. Could it possibly be pointing to a wrong libc++?

Edit: I tried linking libc++ to homebrew installed libc++ as well and was successful, but it didn't fix the problem

otool -L irony-server
irony-server:
    /usr/local/opt/llvm/lib/libclang.dylib (compatibility version 1.0.0, current version 7.0.0)
    /usr/local/opt/llvm/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)
    /usr/lib/libc++abi.dylib (compatibility version 1.0.0, current version 400.17.0)

Oh and also, it doesn't complain about the includes, and when I jump to definition of the header with RTags, it is using the correct clang7 include path.