N2800 P29の一部を訳してみました。
原文§ 2.13.7の2
2 A user-defined-literal is treated as a call to a literal operator or literal operator template (13.5.8). To
determine the form of this call for a given user-defined-literal L with ud-suffix X, the literal-operator-id
whose literal suffix identifier is X is looked up in the context of L using the rules for unqualified name
lookup (3.4.1). Let S be the set of declarations found by this lookup. S shall not be empty.
日本語訳§ 2.13.7の2
2 ユーザ定義のリテラルは、リテラルオペレーターかリテラルオペレーター・テンプレート(13.5.8)の呼び出しとして扱われます。
ud-suffix Xと与えられたユーザ定義のリテラルLのこの呼び出しの形式を決定するために、
そのリテラルオペレーター識別子(リテラル接尾辞識別子)であるXはUnqualified name lookup(3.4.1)の規則を使用して、
Lのコンテキストの中で見つけられます。
Sはこの規則によって見つかった宣言のセットとみなして下さい。Sは空ではないものとします。
原文§ 2.13.7の3
3 If L is a user-defined-integer-literal, let n be the literal without its ud-suffix. If S contains a literal operator
with parameter type unsigned long long, the literal L is treated as a call of the form
operator "" X(nULL)
Otherwise, S shall contain a raw literal operator or a literal operator template (13.5.8) but not both. If S
contains a raw literal operator the literal L is treated as a call of the form
operator "" X("n")
Otherwise (S contains a literal operator template), L is treated as a call of the form
operator "" X<’c1’, ’c2’, ... ’ck’>()
where n is the source character sequence c1c2...ck. [ Note: the sequence c1c2...ck can only contain characters
from the basic source character set. —end note ]
日本語訳§ 2.13.7の3
3 Lがユーザ定義の整数リテラル(user-defined-integer-literal)である場合は、nはud-suffixのないリテラルにしてください。
Sがunsigned long longのパラメーター・タイプをもつリテラルオペレーターの場合、リテラルのLは、以下の呼び出しとして扱われます。
operator "" X(nULL)
そうでなければ、Sはraw literal operatorあるいはリテラルオペレーター・テンプレート(13.5.8)を含むものとします、しかし両方ではない。(両方宣言してはならない?)
Sがraw literal operatorを含む場合、リテラルのLは、以下の呼び出しとして扱われます。
operator "" X("n")
そうでなければ(Sはリテラルオペレーター・テンプレートを含んでいます)、Lは以下の呼び出しとして扱われます。
operator "" X<'c1','c2'...'ck'>()
nが文字(source character)シーケンスc1c2..ckである場合
[注:シーケンスc1c2...ckは、ASCII文字セット(basic source character set)からの文字だけを含むことができます。-注終わり]
raw literal operatorは、そのタイプがconst char*である単一のパラメーターを持ったリテラルオペレーター。のことらしい
翻訳通して適当につくろってみただけ・・・。むずかしいですなぁ。
これを見ると以下の2つは同時には宣言できなくてどれか一つ定義したものが呼ばれることになるのかな。
unsigned long long int operator "" _il(const char*); template <char...> int operator "" _il();
つまり書ける組み合わせとしてはこうか
unsigned long long int operator "" _il(unsigned long long int); unsigned long long int operator "" _il(const char*);
こう
unsigned long long int operator "" _il(unsigned long long int); template <char...> int operator "" _il();
で、この場合§ 2.13.7の3に従うとどちらも
unsigned long long int operator "" _il(unsigned long long int);
しか呼ばれないのかな。
13.5.8の3に書いてある
3 The declaration of a literal operator shall have a parameter-declaration-clause equivalent to one of the following: const char* unsigned long long int long double const char*, std::size_t const wchar_t*, std::size_t const char16_t*, std::size_t const char32_t*, std::size_t
これらしか引数に取れないのね。つまり以下のパターンしか書けない
operator "" X(const char*); operator "" X(unsigned long long int); operator "" X(long double); operator "" X(const char*, std::size_t); operator "" X(const wchar_t*, std::size_t); operator "" X(const char16_t*, std::size_t); operator "" X(const char32_t*, std::size_t);
全然違ってたら指摘してください。
追記:
ところで、以下の例でN2765とN2800で違う
N2765
double operator "" _miles(double); // Error: invalid parameter-declaration-clause
N2800
double operator _miles(double); // error: invalid parameter-declaration-clause
_milesの前の""がなくなってる。誤記かな?