From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2DF403858D20; Fri, 1 Sep 2023 20:08:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2DF403858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693598936; bh=erH4fkVIjCBH1ehluWEFR4SuFXgTkWKO4j1N6+U84oM=; h=From:To:Subject:Date:From; b=ZhoHhO4Oy9B73iWKwRrfKufyuBaSxPKUIPQ81oIkQmbLKyWYaMnT7Pw5Qr/hsHpyh tCFu2iICzEzCsC/M/cjQNimm7MOEOsq0nu3BgGADgPoUesB6V0IKP/GrpjR3c5gyJE TYSpzFOVghjRb9Q3nkoNuC7oJTpxrMVNWWrvA8wg= From: "pkeir at outlook dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/111272] New: Truncated error messages with -std=c++23 and -std=c++26 Date: Fri, 01 Sep 2023 20:08:55 +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: pkeir at outlook 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=3D111272 Bug ID: 111272 Summary: Truncated error messages with -std=3Dc++23 and -std=3Dc++26 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pkeir at outlook dot com Target Milestone: --- The C++14 code below requires the `constexpr` specifier on the `ft` member function. Compiling this with `-std=3Dc++14`, `-std=3Dc++17` or `-std=3Dc++= 20` will provide a helpful error message which identifies the need to add the `constexpr` specifier to `ft`. However, if `-std=3Dc++23`, or `-std=3Dc++26` are used, no message indicati= ng the need for `constexpr` on `ft` is displayed; and the message itself is trunca= ted: ending only in "...not usable as a 'constexpr' function because:". struct Jam { // constexpr // n.b. int ft() { return 42; } constexpr Jam() { ft(); } }; constexpr bool test() { Jam j; return true; } static_assert(test(), ""); The full truncated error message is: $ /opt/gcc-latest/bin/g++ -std=3Dc++26 -c truncated-constexpr-error-gcc.cpp= =20 truncated-constexpr-error-gcc.cpp:16:19: error: non-constant condition for static assertion 16 | static_assert(test(), ""); | ~~~~^~ truncated-constexpr-error-gcc.cpp:16:19: in =E2=80=98constexpr=E2=80=99 e= xpansion of =E2=80=98test()=E2=80=99 truncated-constexpr-error-gcc.cpp:12:7: error: =E2=80=98constexpr Jam::Jam(= )=E2=80=99 called in a constant expression 12 | Jam j; | ^ truncated-constexpr-error-gcc.cpp:7:3: note: =E2=80=98constexpr Jam::Jam()= =E2=80=99 is not usable as a =E2=80=98constexpr=E2=80=99 function because: 7 | Jam() { ft(); } | ^~~=