public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112423] New: A weird reported diagnosis about user-defined-literal
@ 2023-11-07 13:28 xmh970252187 at gmail dot com
  2023-11-09  4:05 ` [Bug c++/112423] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: xmh970252187 at gmail dot com @ 2023-11-07 13:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112423

            Bug ID: 112423
           Summary: A weird reported diagnosis about user-defined-literal
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xmh970252187 at gmail dot com
  Target Milestone: ---

#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 
> unable to find numeric literal operator 'operator""_to.'

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 "123_to." is parsed as a
user-defined-literal but a viable operator `operator""_to.` cannot be found,
which is wrong and misleading.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/112423] A weird reported diagnosis about user-defined-literal
  2023-11-07 13:28 [Bug c++/112423] New: A weird reported diagnosis about user-defined-literal xmh970252187 at gmail dot com
@ 2023-11-09  4:05 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-09  4:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112423

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
A dup of bug 108911.

*** This bug has been marked as a duplicate of bug 108911 ***

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-09  4:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-07 13:28 [Bug c++/112423] New: A weird reported diagnosis about user-defined-literal xmh970252187 at gmail dot com
2023-11-09  4:05 ` [Bug c++/112423] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).