c++/2559: Boost testsuite ICEs (long long template parameters)

pcarlini@unitus.it pcarlini@unitus.it
Mon Apr 16 09:06:00 GMT 2001


>Number:         2559
>Category:       c++
>Synopsis:       Boost testsuite ICEs (long long template parameters)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 16 09:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Paolo Carlini
>Release:        3.1 20010412 (experimental) and also Codesourcery on line
>Organization:
>Environment:
i686, Linux2.2.19, glibc2.2.2, binutils2.11	
>Description:
The following code, distilled from Boost 1.21.1 (www.boost.org) header file 
integer_traits.hpp, triggers an ICE:

-------

template<class T, T min_val, T max_val>
class integer_traits_base
{
public:
  static const bool is_integral = true;
};

template<class T>
class integer_traits
{
public:
  static const bool is_integral = false;
};

template<>
class integer_traits<long long>
  : public integer_traits_base<long long, (-9223372036854775807LL - 1),
9223372036854775807LL>
{ };

-------

Three Boost regression testsuite tests presently fail due to (at least) this problem, i.e. integer_traits_test.cpp, random_test.cpp, random_demo.cpp.
>How-To-Repeat:
The ICE appear connected to the sign of the large constants as template parameters: interestingly if the testcase is modified by changing their sign to *positive*, the compiler isuues "sorry, not implemented: mangling very large integers".

Gcc2.95.2 compiles this code, however I believe that such large constants are not valid in ANSI/ISO C++ (without long long extension), so the bug should be qualified as "ICE on illegal code". In my opinion, Boost should not rely on long long constants as template parameters.
 		
>Fix:

In the short term, seems far easier to fix Boost ;)
It should be relatively easy for the C++ gurus to fix the front end to catch large *negative* (vs. positive) integers template parameters and emit the proper diagnostics.
 
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-prs mailing list