Skip to content
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

Compilation fails with clang 6.x-8.x in C++14 mode #1628

Closed
mmoelle1 opened this issue Jun 8, 2019 · 2 comments
Closed

Compilation fails with clang 6.x-8.x in C++14 mode #1628

mmoelle1 opened this issue Jun 8, 2019 · 2 comments
Labels
kind: bug solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@mmoelle1
Copy link

mmoelle1 commented Jun 8, 2019

Problem

A fresh checkout of the develop branch of the library fails to build with Clang 6.0.1, 7.0.1, and 8.0.0 under CentOS 7 when compiled in C++14 mode with the following error:

json/single_include/nlohmann/json.hpp:13192:38: error: too few template arguments for class template 'less'
    using object_comparator_t = std::less<>;
                                     ^
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/stl_function.h:231:12: note: template is declared here
    struct less : public binary_function<_Tp, _Tp, bool>
           ^
In file included from /home/mmoller/foo/json/test/src/unit-wstring.cpp:32:
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:13282:11: error: use of undeclared identifier 'object_comparator_t'
          object_comparator_t,
          ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:13674:9: error: unknown type name 'object_t'
        object_t* object;
        ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:13776:26: error: unknown type name 'object_t'
        json_value(const object_t& value)
                         ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:13782:20: error: unknown type name 'object_t'
        json_value(object_t&& value)
                   ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:15181:5: error: unknown type name 'object_t'
    object_t* get_impl_ptr(object_t* /*unused*/) noexcept
    ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:15181:28: error: unknown type name 'object_t'
    object_t* get_impl_ptr(object_t* /*unused*/) noexcept
                           ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:15187:21: error: unknown type name 'object_t'
    constexpr const object_t* get_impl_ptr(const object_t* /*unused*/) const noexcept
                    ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:15187:50: error: unknown type name 'object_t'
    constexpr const object_t* get_impl_ptr(const object_t* /*unused*/) const noexcept
                                                 ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:15827:33: error: use of undeclared identifier 'object_t'
    reference at(const typename object_t::key_type& key)
                                ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:15827:43: error: expected a qualified name after 'typename'
    reference at(const typename object_t::key_type& key)
                                          ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:15827:51: error: expected ')'
    reference at(const typename object_t::key_type& key)
                                                  ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:15827:17: note: to match this '('
    reference at(const typename object_t::key_type& key)
                ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:15878:39: error: use of undeclared identifier 'object_t'
    const_reference at(const typename object_t::key_type& key) const
                                      ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:15878:49: error: expected a qualified name after 'typename'
    const_reference at(const typename object_t::key_type& key) const
                                                ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:15878:57: error: expected ')'
    const_reference at(const typename object_t::key_type& key) const
                                                        ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:15878:23: note: to match this '('
    const_reference at(const typename object_t::key_type& key) const
                      ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:16008:41: error: use of undeclared identifier 'object_t'
    reference operator[](const typename object_t::key_type& key)
                                        ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:16008:51: error: expected a qualified name after 'typename'
    reference operator[](const typename object_t::key_type& key)
                                                  ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:16008:59: error: expected ')'
    reference operator[](const typename object_t::key_type& key)
                                                          ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:16008:25: note: to match this '('
    reference operator[](const typename object_t::key_type& key)
                        ^
/home/mmoller/foo/json/single_include/nlohmann/json.hpp:16057:47: error: use of undeclared identifier 'object_t'
    const_reference operator[](const typename object_t::key_type& key) const

Steps to reproduce:

$> CC=`which clang` CXX=`which clang++` cmake .. -DCMAKE_CXX_STANDARD=14
$> make

Remarks:

  • The same error occurs when using the master branch.
  • Compiling the same checkout GCC (tested with 4.8.5 and above) works fine.
@nlohmann
Copy link
Owner

nlohmann commented Jun 8, 2019

I cannot reproduce this - at least with Clang 7.0.0 on Ubuntu, I can execute the exact commands you provided without error.

@mmoelle1
Copy link
Author

mmoelle1 commented Jun 12, 2019 via email

@nlohmann nlohmann added the solution: proposed fix a fix for the issue has been proposed and waits for confirmation label Jun 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

No branches or pull requests

2 participants