Opened 7 years ago

Closed 5 years ago

#11606 closed Bugs (fixed)

Compile errors with Clang 3.7 (and earlier)

Reported by: nikkikom@… Owned by: Joel de Guzman
Milestone: Boost 1.60.0 Component: fusion
Version: Boost 1.59.0 Severity: Problem
Keywords: Cc:

Description

The problem is complicated and most probably belongs to Boost.Fusion. However I'm not very sure, and technically all tests from fusion compile, it's the test from spirit repository fails. So, I'm posting it under the spirit component.

The spirit/repository/test/qi/keywords.cpp does not compile with recent clang@apple with default preprocessor definitions. I'm attaching the compiler log with this ticket.

The only way I can compile it is to use BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK preprocessor flag, unfortunately with flags triggers another branch of compile errors related to fusion's result_of helper. To fix BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK compile errors the file boost/fusion/support/detail/result_of.hpp should be modified as follows:

Was:

#if !defined(BOOST_RESULT_OF_USE_DECLTYPE) || defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)

Should:

#if 1 || (!defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK) \
  && !defined(BOOST_RESULT_OF_USE_DECLTYPE)) \
    || defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)

Attachments (2)

compile-log.txt (189.0 KB ) - added by Nikki Chumakov <nikkikom@…> 7 years ago.
Compile log
clang-version.txt (103 bytes ) - added by Nikki Chumakov <nikkikom@…> 7 years ago.
Clang version

Download all attachments as: .zip

Change History (12)

by Nikki Chumakov <nikkikom@…>, 7 years ago

Attachment: compile-log.txt added

Compile log

by Nikki Chumakov <nikkikom@…>, 7 years ago

Attachment: clang-version.txt added

Clang version

comment:1 by Nikki Chumakov <nikkikom@…>, 7 years ago

Sorry, was wrong correction line. The right one is:

#if (!defined(BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK) \
  && !defined(BOOST_RESULT_OF_USE_DECLTYPE)) \
    || defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)

comment:2 by Kohei Takahashi <flast@…>, 7 years ago

Component: spiritfusion

Can I get a minimal reproducible code (or your keywords.cpp)?

BTW, I'm planning to remove fusion's result_of hacks and becoming SFINAE-friendly. It should fix the issue.

comment:3 by Nikki Chumakov <nikkikom@…>, 7 years ago

Thank you for the fast reply.

keywords.cpp was the one of the standard tests in spirit repository. Here is the direct link to github for this file: https://github.com/boostorg/spirit/blob/master/repository/test/qi/keywords.cpp

I've read previously about the plans for fusion's "sfinae-fiction" but I also read this will require to reimplement a lot of code in it. So it may be a very time consuming task, as far as I understand.

By now I had to fork fusion into my code, fix result_of.hpp inside and use BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK. I would appreciate any solution that will not require the fusion fork with my custom fixes inside.

comment:4 by Kohei Takahashi <flast@…>, 7 years ago

Milestone: To Be DeterminedBoost 1.60.0

OK, I overhauled fusion::fold and it should work with decltype based result_of.

Also, I tested qi/keyworkds.cpp (with BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK) and compiled it successfully.

see: https://github.com/boostorg/fusion/pull/102

comment:5 by Nikki Chumakov <nikkikom@…>, 7 years ago

I am able to compile keywords.cpp with your fixes and with BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK, thank you very match.

However, I was not able to compile it with BOOST_RESULT_OF_USE_DECLTYPE. What it the reason?

in reply to:  4 ; comment:6 by Nikki Chumakov <nikkikom@…>, 7 years ago

Replying to Kohei Takahashi <flast@…>:

OK, I overhauled fusion::fold and it should work with decltype based result_of. Also, I tested qi/keyworkds.cpp (with BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK) and compiled it successfully. see: https://github.com/boostorg/fusion/pull/102

Could you please regenerate preprocessed files? There are some orphaned references to fusion::detail::result_of_with_decltype here https://github.com/Flast/fusion/blob/d3449ab5e58d68c2a54d588f3bded4c1dcb2d16e/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp and in other files as well.

in reply to:  6 comment:7 by Kohei Takahashi <flast@…>, 7 years ago

Replying to Nikki Chumakov <nikkikom@…>:

Replying to Kohei Takahashi <flast@…>:

OK, I overhauled fusion::fold and it should work with decltype based result_of. Also, I tested qi/keyworkds.cpp (with BOOST_RESULT_OF_USE_TR1_WITH_DECLTYPE_FALLBACK) and compiled it successfully. see: https://github.com/boostorg/fusion/pull/102

Could you please regenerate preprocessed files? There are some orphaned references to fusion::detail::result_of_with_decltype here https://github.com/Flast/fusion/blob/d3449ab5e58d68c2a54d588f3bded4c1dcb2d16e/include/boost/fusion/algorithm/iteration/detail/preprocessed/fold.hpp and in other files as well.

Preprocessed files make often pull-request a huge change and to be hard to review it. I'll open a additional PR which only contains preprocessed files after it is merged.

in reply to:  5 comment:8 by Kohei Takahashi <flast@…>, 7 years ago

Replying to Nikki Chumakov <nikkikom@…>:

However, I was not able to compile it with BOOST_RESULT_OF_USE_DECLTYPE. What it the reason?

I'm not sure is the keywords.hpp aware SFINAE-friendly result_of?

comment:9 by Nikita Kniazev <nok.raven@…>, 5 years ago

comment:10 by Joel de Guzman, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.