[llvm-bugs] [Bug 37700] New: [clang] error : unknown type name 'not'

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 6 07:54:47 PDT 2018


            Bug ID: 37700
           Summary: [clang] error : unknown type name 'not'
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: other
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: danchen at infinera.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

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() {


   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
   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:
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> {};
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.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180606/a9a37f61/attachment.html>

More information about the llvm-bugs mailing list