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

Build failure of msgpack_cpp11.cpp on g++6 #422

Closed
jamessan opened this issue Feb 15, 2016 · 11 comments · Fixed by #430
Closed

Build failure of msgpack_cpp11.cpp on g++6 #422

jamessan opened this issue Feb 15, 2016 · 11 comments · Fixed by #430

Comments

@jamessan
Copy link
Contributor

g++ -DHAVE_CONFIG_H -I. -I..  -I../include -pthread -DMSGPACK_DISABLE_LEGACY_NIL -DMSGPACK_DISABLE_LEGACY_CONVERT -Wdate-time -D_FORTIFY_SOURCE=2  -O3 -Wall -Wextra -Wno-mismatched-tags -Werror -g -O2 -Wformat -Werror=format-security -std=c++11 -g -c -o msgpack_cpp11.o msgpack_cpp11.cpp
In file included from ../include/msgpack/adaptor/msgpack_tuple.hpp:18:0,
                 from ../include/msgpack/type.hpp:22,
                 from ../include/msgpack/object.hpp:839,
                 from ../include/msgpack.hpp:10,
                 from msgpack_cpp11.cpp:1:
../include/msgpack/adaptor/detail/cpp11_msgpack_tuple.hpp: In instantiation of 'static msgpack::v1::type::tuple<T, Args ...> msgpack::v1::MsgpackTupleAsImpl<T, Args>::as(const msgpack::v1::object&) [with T = no_def_con_composite; Args = {}]':
../include/msgpack/adaptor/detail/cpp11_msgpack_tuple.hpp:161:47:   required from 'static msgpack::v1::type::tuple<Args ...> msgpack::v1::MsgpackTupleAs<Args>::as(const msgpack::v1::object&) [with Args = {no_def_con_composite}]'
../include/msgpack/adaptor/detail/cpp11_msgpack_tuple.hpp:154:40:   required from 'static msgpack::v1::type::tuple<T, Args ...> msgpack::v1::MsgpackTupleAsImpl<T, Args>::as(const msgpack::v1::object&) [with T = no_def_con; Args = {no_def_con_composite}]'
../include/msgpack/adaptor/detail/cpp11_msgpack_tuple.hpp:161:47:   required from 'static msgpack::v1::type::tuple<Args ...> msgpack::v1::MsgpackTupleAs<Args>::as(const msgpack::v1::object&) [with Args = {no_def_con, no_def_con_composite}]'
../include/msgpack/adaptor/detail/cpp11_msgpack_tuple.hpp:154:40:   required from 'static msgpack::v1::type::tuple<T, Args ...> msgpack::v1::MsgpackTupleAsImpl<T, Args>::as(const msgpack::v1::object&) [with T = no_def_con; Args = {no_def_con, no_def_con_composite}]'
../include/msgpack/adaptor/detail/cpp11_msgpack_tuple.hpp:161:47:   required from 'static msgpack::v1::type::tuple<Args ...> msgpack::v1::MsgpackTupleAs<Args>::as(const msgpack::v1::object&) [with Args = {no_def_con, no_def_con, no_def_con_composite}]'
../include/msgpack/adaptor/detail/cpp11_msgpack_tuple.hpp:207:43:   required from 'msgpack::v1::type::tuple<Args ...> msgpack::v1::adaptor::as<msgpack::v1::type::tuple<Args ...>, typename std::enable_if<msgpack::v1::detail::all_of_imp<msgpack::v1::has_as<Args>::value ...>::value>::type>::operator()(const msgpack::v1::object&) const [with Args = {no_def_con, no_def_con, no_def_con_composite}; typename std::enable_if<msgpack::v1::detail::all_of_imp<msgpack::v1::has_as<Args>::value ...>::value>::type = void]'
../include/msgpack/object.hpp:559:37:   required from 'typename std::enable_if<msgpack::v1::has_as<T>::value, T>::type msgpack::v1::object::as() const [with T = msgpack::v1::type::tuple<no_def_con, no_def_con, no_def_con_composite>; typename std::enable_if<msgpack::v1::has_as<T>::value, T>::type = msgpack::v1::type::tuple<no_def_con, no_def_con, no_def_con_composite>]'
msgpack_cpp11.cpp:504:92:   required from here
../include/msgpack/adaptor/detail/cpp11_msgpack_tuple.hpp:154:43: error: could not convert 'msgpack::v1::type::tuple_cat(Tuples&& ...) [with Tuples = {msgpack::v1::type::tuple<no_def_con_composite>, msgpack::v1::type::tuple<>}; decltype (std::tuple_cat((forward<typename std::remove_reference<Tuples>::type::base>)(msgpack::v1::type::tuple_cat::args)...)) = std::tuple<no_def_con_composite>; typename std::remove_reference<Tuples>::type::base = <type error>](msgpack::v1::MsgpackTupleAs<>::as((* & o)))' from 'std::__tuple_cat_result<std::tuple<no_def_con_composite>, std::tuple<> >::__type {aka std::tuple<no_def_con_composite>}' to 'msgpack::v1::type::tuple<no_def_con_composite>'
             MsgpackTupleAs<Args...>::as(o));
                                           ^
@redboltz
Copy link
Contributor

Could you tell me g++ version and libstdc++ version?

@jamessan
Copy link
Contributor Author

Toolchain package versions: binutils_2.26-4 dpkg-dev_1.18.4 g++-6_6-20160109-1 gcc-6_6-20160109-1 libc6-dev_2.22-0experimental0 libstdc++-5-dev_5.3.1-8 libstdc++-6-dev_6-20160109-1 libstdc++6_6-20160109-1 linux-libc-dev_4.4.1-1~exp1

Here's the full build log.

@jamessan
Copy link
Contributor Author

g++6 defaults to -std=gnu++14 instead of -std=gnu++98, so that may help determine why the compile errors are happening.

@redboltz
Copy link
Contributor

Thank you for the information. I've just set up g++6 environment on my Linux 4.3.3-2-ARCH #1 SMP PREEMPT Wed Dec 23 20:09:18 CET 2015 x86_64 GNU/Linux.

I reproduced the same compile error on the environment. I set -std=c++11 explicitly and got the same error.

I will start debugging on the environment.

@redboltz redboltz changed the title Build failure of msgpack_cpp11.cpp on hppa systems Build failure of msgpack_cpp11.cpp on g++6 Feb 17, 2016
@redboltz
Copy link
Contributor

It seems that the compile error in not related to hppa and related to g++6. I updated the title of the issue.
See #425.

@redboltz
Copy link
Contributor

Here is a simple code that reproduces the error:

#include <msgpack.hpp>

struct foo {
    int i;
    MSGPACK_DEFINE(i);
};

// `as` specialization for `foo`
namespace msgpack {
MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) {
    namespace adaptor {
    template <>
    struct as<foo> {
        foo operator()(msgpack::object const& o) const {
            if (o.type != msgpack::type::ARRAY) throw msgpack::type_error();
            if (o.via.array.size != 1) throw msgpack::type_error();
            return foo {o.via.array.ptr[0].as<int>()};
        }
    };
    } // adaptor
} // MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS)
} // msgpack

int main() {
    msgpack::object o;
    auto val1 = o.as<std::tuple<foo>>(); // OK
    auto val2 = o.as<msgpack::type::tuple<foo>>(); // ERROR
}

@redboltz
Copy link
Contributor

The following code cannot compile on g++6. It seems that the cause of the issue.

#include <tuple>

template <typename... Types>
struct my_tuple : std::tuple<Types...> {
    // inheriting constructor
    using std::tuple<Types...>::tuple;
};

int main() {
    std::tuple<int> st;
    my_tuple<int> mt(st);
}

@redboltz
Copy link
Contributor

I reported the issue. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69853

redboltz added a commit to redboltz/msgpack-c that referenced this issue Feb 17, 2016
Replaced the inheriting constructor with a forwarding constructor.
Removed the template constructors that are covered by the forwarding constructor.
@redboltz
Copy link
Contributor

The issue I reported to gcc bugzilla is suspended. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69853#c2
I understand the situation and started looking for a workaround. I implemented #426. It works on my g++6 environment. @jamessan and @ueno, could you test #426?

@ueno
Copy link
Contributor

ueno commented Feb 19, 2016

Thanks, #426 compiles fine with the mock command on Fedora:

$ mock -r fedora-rawhide-x86_64 --install git
$ mock -r fedora-rawhide-x86_64 --shell
# gcc --version
gcc (GCC) 6.0.0 20160212 (Red Hat 6.0.0-0.11)
...
# git clone -b fix_422 git://github.com/redboltz/msgpack-c.git
# cd msgpack-c
# ./bootstrap && ./configure && make && make check

though the patch doesn't cleanly apply to the 1.4.0 release. Do you have any plan on the new release with it?

redboltz added a commit that referenced this issue Feb 20, 2016
@redboltz
Copy link
Contributor

@ueno, thank you for testing. I merged it.

though the patch doesn't cleanly apply to the 1.4.0 release. Do you have any plan on the new release with it?

It is due to #415. That PR is a preparation for version 2.0. It has been merged to the master branch.

I created the branch named cpp-1.4, and will backport #426 and #423 to cpp-1.4. Then I will release that as version 1.4.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants