From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B8AB83858D3C; Tue, 7 Nov 2023 13:28:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B8AB83858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1699363719; bh=8zY/nvv3KkvuDvnnK3c0XK5jz4jYpcu4iL4egIS36gw=; h=From:To:Subject:Date:From; b=s1rvneFRKWd9MxiVsmmjk6xQo2VotjCbYgMbLXUjv1kU5FIhK1EIibBEyQ4ff0/tn JS5FOW7sK99mlL55j1uE0M4TD+PJn2GCi365rmrD75htMGFh/+X7e6ZsigufYNp1U2 ME+TSUhM7BAZIepTsurLUzb1P3ETTNXRozsS9mGc= From: "xmh970252187 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112423] New: A weird reported diagnosis about user-defined-literal Date: Tue, 07 Nov 2023 13:28:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: xmh970252187 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112423 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 struct A{ void foo(){} }; A operator ""_to(const char* ptr){ std::cout<< ptr; return A{}; } int main(){ 123_to. foo(); } The reported diagnosis is=20 > unable to find numeric literal operator 'operator""_to.' Well, "123_to." is a single preprocessing token(i.e. pp-number), which is t= hen 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.=