This may be a lexer problem. The user literal should be designated as one fragment - the number plus suffix is ββone single token. In the case of numeric literals, characters that are allowed to clone include a decimal number. Lookup pp-number: section 2.10 - lex.ppnumber in the last draft of the standard. See how the preprocessor (lexer) scans the token:
30_au.to_light_years() digit digit identifier-nondigit . identifier-nondigit x 14 ( breaks the spell
So, the preprocessor sees 30_au.to_light_years as a big fancy (floating point) number. Then, during the parsing phase, we see digit, digit, identifier-nondigit... At this point, the remainder of '-' is passed forward as the suffix identifier.
Remember that number literals are interpreted after the preprocessor performs tokenization.
I think this is not really a flaw.
source share