samedi 24 février 2018

Userdefined integer literal not found

I am trying to create a userdefined literal but get the error message when using it. GCC says

unable to find numeric literal operator ‘operator""_uint’

while clang tells me

error: no matching literal operator for call to 'operator""_uint' with argument of type 'unsigned long long' or 'const char *', and no matching literal operator template

I reduced the code to following MWE:

#include <cinttypes>

unsigned int operator"" _uint(char const *, std::size_t) { return 0; }

int main() {
    return 1_uint;
}

Which gives the mentioned error as you can see on ideone.

Aucun commentaire:

Enregistrer un commentaire