llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.03k stars 11.58k forks source link

[clang] error : unknown type name 'not' #37048

Closed llvmbot closed 2 months ago

llvmbot commented 6 years ago
Bugzilla Link 37700
Version 6.0
OS other
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@steveire

Extended Description

Overview: I am building with the json.hpp file (from "JSON for Modern C++" library by nlohmann) with a Visual C++ project using the Clang/LLVM toolset in Visual Studio 2017 (version 15.7.2)and getting these errors in the json.hpp file (and then some).

Steps to reproduce: (You can try the attached Visual Studio project). 1.Create a new Visual Studio Solution in VS2017 and add a source file to it. 2.Put in the following code:

#include <nlohmann/json.hpp>

int main() {

}
  1. Set the toolset to "LLVM-vs2014" under Configuration Properties>General (you have to right-click the project and click "Properties" to get to this page).

  2. I set these variables like so (telling Clang to use the vcpkg libraries) -- (right-click the project and select "Properties", then go to Configuration Properties>VC++ Directories to find these): "Include Directories" variable to also have "C:\Program Files\vcpkg\installed\x86-windows\include".

       "Library Directories" variable to also have 
          "C:\Program Files\vcpkg\installed\x86-windows\lib"
  3. Build.

Actual results: Bugs like so


                  1>------ Build started: Project: SampleProject, Configuration: Debug Win32 ------
                  1>clang-cl.exe : warning : argument unused during compilation: '/ZI' [-Wunused-command-line-argument]
                  1>clang-cl.exe : warning : argument unused during compilation: '/Gm' [-Wunused-command-line-argument]
                  1>In file included from Source.cpp:2:
                  1>C:\Program Files\vcpkg\installed\x86-windows\include\nlohmann\json.hpp(322,66): error : unknown type name 'not'
                  1>template<class B> struct negation : std::integral_constant<bool, not B::value> {};
                  1>                                                                 ^
                  1>C:\Program Files\vcpkg\installed\x86-windows\include\nlohmann\json.hpp(322,80): error : expected class name
                  1>template<class B> struct negation : std::integral_constant<bool, not B::value> {};

Expected Results: Successful build.

Build Date and Hardware: Windows 10, x64 bit Visual Studio 2017 (version 15.7.2) LLVM-vs2014 toolset Here is the compiler version:

        C:\Program Files\LLVM\bin>clang-cl.exe --version
        clang version 6.0.0 (tags/RELEASE_600/final)
        Target: x86_64-pc-windows-msvc
        Thread model: posix
        InstalledDir: C:\Program Files\LLVM\bin

Additional Builds and Platforms: I highly suspect this is a compiler issue. I successfully compiled the project when using the Microsoft Visual C++ compiler (MSVC) version 19.14.

Additional Information: See attached Visual Studio Project.

steveire commented 5 years ago

I can't repro this with Clang 7.0.0.

Please try with that.

llvmbot commented 6 years ago

Sorry, couldn't attach the Visual Studio project (too large even when zipped).

llvmbot commented 2 months ago

@llvm/issue-subscribers-clang-frontend

Author: None (llvmbot)

| | | | --- | --- | | Bugzilla Link | [37700](https://llvm.org/bz37700) | | Version | 6.0 | | OS | other | | Reporter | LLVM Bugzilla Contributor | | CC | @DougGregor,@steveire | ## Extended Description Overview: I am building with the json.hpp file (from "JSON for Modern C++" library by nlohmann) with a Visual C++ project using the Clang/LLVM toolset in Visual Studio 2017 (version 15.7.2)and getting these errors in the json.hpp file (and then some). Steps to reproduce: (You can try the attached Visual Studio project). 1.Create a new Visual Studio Solution in VS2017 and add a source file to it. 2.Put in the following code: ```cpp #include <nlohmann/json.hpp> int main() { } ``` 3. Set the toolset to "LLVM-vs2014" under Configuration Properties>General (you have to right-click the project and click "Properties" to get to this page). 4. I set these variables like so (telling Clang to use the vcpkg libraries) -- (right-click the project and select "Properties", then go to Configuration Properties>VC++ Directories to find these): "Include Directories" variable to also have "C:\Program Files\vcpkg\installed\x86-windows\include". "Library Directories" variable to also have "C:\Program Files\vcpkg\installed\x86-windows\lib" 5. Build. Actual results: Bugs like so ``` 1>------ Build started: Project: SampleProject, Configuration: Debug Win32 ------ 1>clang-cl.exe : warning : argument unused during compilation: '/ZI' [-Wunused-command-line-argument] 1>clang-cl.exe : warning : argument unused during compilation: '/Gm' [-Wunused-command-line-argument] 1>In file included from Source.cpp:2: 1>C:\Program Files\vcpkg\installed\x86-windows\include\nlohmann\json.hpp(322,66): error : unknown type name 'not' 1>template<class B> struct negation : std::integral_constant<bool, not B::value> {}; 1> ^ 1>C:\Program Files\vcpkg\installed\x86-windows\include\nlohmann\json.hpp(322,80): error : expected class name 1>template<class B> struct negation : std::integral_constant<bool, not B::value> {}; ``` Expected Results: Successful build. Build Date and Hardware: Windows 10, x64 bit Visual Studio 2017 (version 15.7.2) LLVM-vs2014 toolset Here is the compiler version: C:\Program Files\LLVM\bin>clang-cl.exe --version clang version 6.0.0 (tags/RELEASE_600/final) Target: x86_64-pc-windows-msvc Thread model: posix InstalledDir: C:\Program Files\LLVM\bin Additional Builds and Platforms: I highly suspect this is a compiler issue. I successfully compiled the project when using the Microsoft Visual C++ compiler (MSVC) version 19.14. Additional Information: See attached Visual Studio Project.