Bug 55842 - [4.7/4.8 Regression] C++11 ICE with boost multi-precision and boost variant
Summary: [4.7/4.8 Regression] C++11 ICE with boost multi-precision and boost variant
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.7.3
Assignee: Jason Merrill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-01 16:06 UTC by koraq
Modified: 2013-02-09 19:01 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.6.3
Known to fail: 4.7.0, 4.8.0
Last reconfirmed: 2013-01-02 00:00:00


Attachments
Preprocessed source (318.31 KB, application/octet-stream)
2013-01-01 16:09 UTC, koraq
Details
Sample code to reproduce the problem (140 bytes, text/x-c++src)
2013-01-01 16:11 UTC, koraq
Details

Note You need to log in before you can comment on or make changes to this bug.
Description koraq 2013-01-01 16:06:25 UTC
Compiling the attached sample file leads to an internal compiler error.
The problem only occurs with GCC-4.7 from Debian Unstable 4.7.2-1 and the upcoming 4.8 from Debian Experimental 4.8-20121218-1. Tested on an amd64 system.

I'm using a checkout of the latest boost release tree.

The command to reproduce the issue is:
gcc-4.8 -std=c++11 -c -I/src/boost/release test.cpp

This results in the following output:
In file included from /src/boost/release/boost/config.hpp:57:0,
                 from /src/boost/release/boost/variant/detail/config.hpp:16,
                 from /src/boost/release/boost/variant/variant.hpp:23,
                 from /src/boost/release/boost/variant.hpp:17,
                 from test.cpp:2:
/src/boost/release/boost/type_traits/has_nothrow_constructor.hpp: In instantiation of 'const bool boost::detail::has_nothrow_constructor_imp<boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<64u, 0u> > >::value':
/src/boost/release/boost/type_traits/has_nothrow_constructor.hpp:32:1:   required from 'struct boost::has_nothrow_constructor<boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<64u, 0u> > >'
/src/boost/release/boost/mpl/aux_/nested_type_wknd.hpp:26:31:   required from 'struct boost::mpl::aux::nested_type_wknd<boost::has_nothrow_constructor<boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<64u, 0u> > > >'
/src/boost/release/boost/mpl/not.hpp:39:8:   required from 'struct boost::mpl::not_<boost::has_nothrow_constructor<boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<64u, 0u> > > >'
/src/boost/release/boost/mpl/aux_/nested_type_wknd.hpp:26:31:   required from 'struct boost::mpl::aux::nested_type_wknd<boost::mpl::apply1<boost::mpl::protect<boost::detail::variant::find_fallback_type_pred>, boost::mpl::l_iter<boost::mpl::l_item<mpl_::long_<1l>, boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<64u, 0u> >, boost::mpl::l_end> > > >'
/src/boost/release/boost/mpl/aux_/preprocessed/gcc/and.hpp:23:8:   required from 'struct boost::mpl::aux::and_impl<true, boost::mpl::apply1<boost::mpl::protect<boost::detail::variant::find_fallback_type_pred>, boost::mpl::l_iter<boost::mpl::l_item<mpl_::long_<1l>, boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<64u, 0u> >, boost::mpl::l_end> > >, mpl_::bool_<true>, mpl_::bool_<true>, mpl_::bool_<true> >'
/src/boost/release/boost/mpl/aux_/preprocessed/gcc/and.hpp:48:8:   [ skipping 5 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/src/boost/release/boost/mpl/aux_/preprocessed/gcc/iter_fold_if_impl.hpp:101:135:   required from 'struct boost::mpl::aux::iter_fold_if_impl<boost::mpl::l_iter<boost::mpl::l_item<mpl_::long_<1l>, boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<64u, 0u> >, boost::mpl::l_end> >, mpl_::int_<0>, boost::mpl::protect<boost::mpl::next<mpl_::na> >, boost::mpl::protect<boost::mpl::aux::iter_fold_if_pred<boost::mpl::protect<boost::detail::variant::find_fallback_type_pred>, boost::mpl::l_iter<boost::mpl::l_end> >, 0>, mpl_::na, boost::mpl::always<mpl_::bool_<false> > >'
/src/boost/release/boost/mpl/iter_fold_if.hpp:81:12:   required from 'struct boost::mpl::iter_fold_if<boost::mpl::l_item<mpl_::long_<1l>, boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<64u, 0u> >, boost::mpl::l_end>, mpl_::int_<0>, boost::mpl::protect<boost::mpl::next<mpl_::na> >, boost::mpl::protect<boost::detail::variant::find_fallback_type_pred>, mpl_::na, mpl_::na>::result_'
/src/boost/release/boost/mpl/iter_fold_if.hpp:104:11:   required from 'struct boost::mpl::iter_fold_if<boost::mpl::l_item<mpl_::long_<1l>, boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<64u, 0u> >, boost::mpl::l_end>, mpl_::int_<0>, boost::mpl::protect<boost::mpl::next<mpl_::na> >, boost::mpl::protect<boost::detail::variant::find_fallback_type_pred>, mpl_::na, mpl_::na>'
/src/boost/release/boost/variant/variant.hpp:189:17:   required from 'struct boost::detail::variant::find_fallback_type<boost::mpl::l_item<mpl_::long_<1l>, boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<64u, 0u> >, boost::mpl::l_end> >'
/src/boost/release/boost/variant/variant.hpp:1271:17:   required from 'class boost::variant<boost::multiprecision::number<boost::multiprecision::backends::cpp_int_backend<64u, 0u> > >'
test.cpp:10:27:   required from here
/src/boost/release/boost/type_traits/has_nothrow_constructor.hpp:24:32: internal compiler error: in nothrow_spec_p, at cp/except.c:1265
    BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_NOTHROW_CONSTRUCTOR(T));
                                ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
Preprocessed source stored into /tmp/cc6oBMd0.out file, please attach this to your bugreport.
Comment 1 koraq 2013-01-01 16:09:52 UTC
Created attachment 29069 [details]
Preprocessed source

The attachment failed the first time (compressed else it is too large).
Comment 2 koraq 2013-01-01 16:11:08 UTC
Created attachment 29070 [details]
Sample code to reproduce the problem
Comment 3 Marc Glisse 2013-01-01 18:30:52 UTC
template <class=void> struct number {
  number() noexcept(noexcept(0)) { }
};
const int z=__has_nothrow_constructor(number<>);
Comment 4 Richard Biener 2013-01-02 10:35:07 UTC
Confirmed.
Comment 5 Jason Merrill 2013-01-03 20:36:32 UTC
Author: jason
Date: Thu Jan  3 20:36:14 2013
New Revision: 194869

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194869
Log:
	PR c++/55842
	* semantics.c (trait_expr_value): Call maybe_instantiate_noexcept.

Added:
    trunk/gcc/testsuite/g++.dg/ext/has_nothrow_constructor-2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
Comment 6 Jason Merrill 2013-01-03 20:37:31 UTC
Author: jason
Date: Thu Jan  3 20:37:10 2013
New Revision: 194871

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=194871
Log:
	PR c++/55842
	* semantics.c (trait_expr_value): Call maybe_instantiate_noexcept.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/ext/has_nothrow_constructor-2.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/semantics.c
Comment 7 Jason Merrill 2013-01-03 20:43:06 UTC
Fixed.
Comment 8 koraq 2013-02-09 19:01:13 UTC
Thanks for fixing it, I can confirm this issue has been fixed. I ran into a similar problem and filed it as bug 56268.