Menu

#188 Internal error while compiling advanced C++11 code

None
pending
nobody
None
1
2014-04-22
2013-06-12
No

ERROR! The markdown supplied could not be parsed correctly. Did you forget to surround a code snippet with "~~~~"?

I'm writing advanced c++11 code involving variadic templates and delegate constructors.  I wrote some code.  Checked it with the compiler, which passed syntax-wise.  Then I wrote a test case to actually use the code, and your compiler crapped out with a internal error.

I got the installation of your program with Code::Blocks.  Its version is Release 12.11 rev 8629 with wx2.8.12 (Windows, Unicode) 32-bit.  When I tried to get the version of MinGW used, I got 4.7.2 on the command line, but that may have been from my regular MinGW installation.  (I don't know how to access the Code-Blocks one.)

The compiler output was:

//=====
-------------- Build: Debug in ComplexTests (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions  -std=c++11 -g -DBOOST_ALL_NO_LIB    -I..\..\GitHub\Complex\include -I..\..\Repositories\boost-trunk  -c C:\Users\Daryle\Documents\GitHub\Complex\test\complex_rt_test.cpp -o obj\Debug\GitHub\Complex\test\complex_rt_test.o
In file included from C:\Users\Daryle\Documents\GitHub\Complex\test\complex_rt_test.cpp:15:0:
..\..\GitHub\Complex\include/boost/math/complex_rt.hpp: In instantiation of 'constexpr boost::math::complex_rt<Number, Rank>::complex_rt(std::integral_constant<unsigned int, Start>, const boost::math::complex_rt<T, R>&, const boost::math::complex_rt<U, R>& ...) [with unsigned int Start = 1u; T = int; unsigned int R = 0u; U = {int, int}; <template-parameter-2-5> = void; Number = int; unsigned int Rank = 1u]':
..\..\GitHub\Complex\include/boost/math/complex_rt.hpp:480:19:   required from 'constexpr boost::math::complex_rt<Number, Rank>::complex_rt(std::integral_constant<unsigned int, Start>, const boost::math::complex_rt<T, R>&, const boost::math::complex_rt<U, R>& ...) [with unsigned int Start = 2u; T = int; unsigned int R = 0u; U = {int, int, int}; <template-parameter-2-5> = void; Number = int; unsigned int Rank = 1u]'
..\..\GitHub\Complex\include/boost/math/complex_rt.hpp:464:34:   required from 'constexpr boost::math::complex_rt<Number, Rank>::complex_rt(std::integral_constant<unsigned int, 0u>, const boost::math::complex_rt<T, R>&, const boost::math::complex_rt<U, R>& ...) [with T = int; unsigned int R = 0u; U = {int, int, int}; <template-parameter-2-4> = void; Number = int; unsigned int Rank = 2u]'
..\..\GitHub\Complex\include/boost/math/complex_rt.hpp:366:79:   required from 'boost::math::complex_rt<Number, Rank>::complex_rt(const boost::math::complex_rt<T, R>&, const boost::math::complex_rt<U, R>& ...) [with T = int; unsigned int R = 0u; U = {int, int, int}; <template-parameter-2-4> = void; <template-parameter-2-5> = void; Number = int; unsigned int Rank = 2u]'
C:\Users\Daryle\Documents\GitHub\Complex\test\complex_rt_test.cpp:866:64:   required from here
..\..\GitHub\Complex\include/boost/math/complex_rt.hpp:480:19:   in constexpr expansion of '((boost::math::complex_rt<int, 1u>*)this)->boost::math::complex_rt<Number, Rank>::complex_rt<int, int, {}>((std::integral_constant<unsigned int, 0u>{}, std::integral_constant<unsigned int, 0u>()), (* & rest#0), (* & rest#1))'
..\..\GitHub\Complex\include/boost/math/complex_rt.hpp:480:19: internal compiler error: in adjust_temp_type, at cp/semantics.c:6369
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://tdm-gcc.tdragon.net/bugs> for instructions.
Process terminated with status 1 (0 minutes, 5 seconds)
2 errors, 5 warnings (0 minutes, 5 seconds)
 
//=====

The error was in a private constructor template of the unspecialized version of complex_rt: template <size_type Start, typename T, size_type R, typename ...U, typename = enable_if<( Start >= (1ULL << R))>::type > complex_rt( integral_constant<size_type, Start>, complex_rt<T, R> const &, complex_rt<U, R> const &...)

I've attached the preprocessor output (which was a pain to get).

I'll fix my code with a work-around (if possible) and upload it to my GitHub space.  Then I'll tell you where you can look at it.
1 Attachments

Discussion

  • Daryle L. Walker

    I've uploaded the file.

    Go to: https://github.com/CTMacUser/Complex
    Go to file: include/boost/math/complex_rt.hpp
    Use commit SHA: 3789d15948601c0e8003584041c482e11f0ac8e8
    (on branch: master)

    Remove the preprocessor work-around blocks at lines: 368, 371-375, 438, and 491 (numbering according to the GitHub web site file browser).

    The constructor chain is exercised by function "test_subbarrage_conversion" in file "test/complex_rt_test.cpp".

     
  • Daryle L. Walker

    I've narrowed down the error.

    Same file as before, but with Commit-SHA ada0c7702136ed6e83a37b8216769a200643bce2. I added the constructor at line 460 (which is exercised by function "test_explicit_conversions" in the unit test file), but that caused another internal compiler error in the constructor at line 330. I fixed that by changing the implementation, sort-of fixing the code that I blocked out.

    That code is in lines 553-598. I get the internal-compiler error when I de-comment either of the two "constexpr" specifiers (lines 560 and 566). The error is marked at line 581. The constructor at that line is the one that calls the other two (plus the constructor at line 553).

     
  • John E.

    John E. - 2013-09-28
    • status: open --> pending
     
  • John E.

    John E. - 2013-09-28

    I need preprocessed source per the instructions at http://tdm-gcc.tdragon.net/bugs, attached to this bug.

     
  • John E.

    John E. - 2014-04-22

    This appears to have been fixed in the 4.8.1 release; can you confirm?

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB