Issue 71535
Summary A weird reported diagnosis about user-defined-literal
Labels new issue
Assignees
Reporter xmh0511
    ````cpp
#include <iostream>
struct A{
 void foo(){}
};
A operator ""_to(const char* ptr){
 std::cout<< ptr;
    return A{};
}
int main(){
    123_to. foo();
}
````

The reported diagnosis is 
> no matching literal operator for call to 'operator""_to.' with argument of type 'unsigned long long' or 'const char *', and no matching literal operator template




Well, `123_to.` is a single preprocessing token(i.e. *pp-number*), which is then converted to a token in translation phase 7([lex.phases] p1.7), however, the pp-number is neither a valid integer-literal, floating-point-literal, nor a user-defined-literal. The diagnosis implies that the *pp-number* `123_to.` can be parsed as a user-defined-literal but a viable operator `operator""_to.` cannot be found, which is wrong and misleading. 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to