c++ - Are C++14 digit separators allowed in user defined literals? -


while clang compiles following line, g++ 6.1 complains digit separator (see live example on coliru):

auto time = 01'23s; 

which compiler, if any, correct according c++14 standard (n3796)?

otherwise, allowing digit separators (§2.14.2) implementation detail in user-defined literals (§2.14.8) of <chrono> library (§20.12.5.8)? imho should not, since these literals defined on unsigned long long parameters.

i remember howard hinnant using 10'000s example during cppcon 2016 talk "a <chrono> tutorial" (at 42 minutes in talk).


(please note, did not intend code "1 minute , 23 seconds", only correct accident, since octal literal 0123 64 + 16 + 3 == 83. purpose should write

auto time = 1min + 23s; 

but possible misleading interpretation not part of question.)

if @ grammar, user-defined-integer-literal can octal-literal ud-suffix, , octal-literal defined either 0 or octal-literal ’opt octal-digit.

n4140 §2.14.8

user-defined-literal:

  • user-defined-integer-literal
  • [...]

user-defined-integer-literal:

  • octal-literal ud-suffix
  • [...]

n4140 §2.14.2

octal-literal:

  • 0
  • octal-literal ’opt octal-digit

so 01'23s valid literal.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -