https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69905
Tad Ashlock <tad.ashlock at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tad.ashlock at gmail dot com
--- Comment #2 from Tad Ashlock <tad.ashlock at gmail dot com> ---
I can confirm this problem, and add a little more detail. Here's the code I
used:
#include <chrono>
using namespace std::chrono_literals;
int main ()
{
auto const test1 = 1100s;
auto const test2 = 1'000s;
auto const test3 = 1'100s;
return 0;
}
The test1 and test2 assignments compile, indicating that 1100 seconds isn't too
large of a number, and 1'000 is accepted. It turns out that a non-0 digit
following the separator is causing the problem.
But test3 fails with the message:
g++ -std=c++14 test.cc
In file included from /opt/tools/gcc/6.1.0/include/c++/6.1.0/chrono:42:0,
from test.cc:1:
/opt/tools/gcc/6.1.0/include/c++/6.1.0/bits/parse_numbers.h: In instantiation
of ‘struct std::__parse_int::_Number_help<10u, 100ull, '\'', '1', '0', '0'>’:
/opt/tools/gcc/6.1.0/include/c++/6.1.0/bits/parse_numbers.h:195:57: required
from ‘struct std::__parse_int::_Number_help<10u, 1000ull, '1', '\'', '1', '0',
'0'>’
/opt/tools/gcc/6.1.0/include/c++/6.1.0/bits/parse_numbers.h:208:12: required
from ‘struct std::__parse_int::_Number<10u, '1', '\'', '1', '0', '0'>’
/opt/tools/gcc/6.1.0/include/c++/6.1.0/bits/parse_numbers.h:248:12: required
from ‘struct std::__parse_int::_Parse_int<'1', '\'', '1', '0', '0'>’
/opt/tools/gcc/6.1.0/include/c++/6.1.0/chrono:808:67: required from
‘constexpr _Dur std::literals::chrono_literals::__check_overflow() [with _Dur =
std::chrono::duration<long int>; char ..._Digits = {'1', '\'', '1', '0', '0'}]’
/opt/tools/gcc/6.1.0/include/c++/6.1.0/chrono:837:61: required from
‘constexpr std::chrono::seconds std::literals::chrono_literals::operator""s()
[with char ..._Digits = {'1', '\'', '1', '0', '0'}; std::chrono::seconds =
std::chrono::duration<long int>]’
test.cc:7:24: required from here
/opt/tools/gcc/6.1.0/include/c++/6.1.0/bits/parse_numbers.h:196:7: error:
static assertion failed: integer literal does not fit in unsigned long long
static_assert((type::value / _Pow) == __digit::value,
^~~~~~~~~~~~~