From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6EA49385842A; Fri, 23 Feb 2024 04:23:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6EA49385842A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708662219; bh=tloZX8tbsO2ejxL+/rg2W6ncDzwa8KT7Lycj+wrzrnc=; h=From:To:Subject:Date:From; b=JKQJg7piVzwL+r6wRWf997MPEuNXNK725ce1UCVV4zYrgPIoRf/mnePNDMWdUGuTD fI+dLA5wivOm0U5r4njSqnMZq5tNBpkG8nI70kAvPRGDHzcDKK548GIYAiBo1h71OJ 9F0HCivhHAC8Bqgb7wxtCXB9lKULA3nGUTUBINFg= From: "jlame646 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114067] New: GCC gives wrong diagnostic in the definition of a static data member of same class type Date: Fri, 23 Feb 2024 04:23:38 +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: jlame646 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=3D114067 Bug ID: 114067 Summary: GCC gives wrong diagnostic in the definition of a static data member of same class type Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jlame646 at gmail dot com Target Milestone: --- The following program produces wrong diagnostic with gcc and clang: ``` struct A{ int x; static const A a{1}; }; ``` GCC says `in-class initialization of static data member 'const A A::a' of incomplete type`. While the actual problem is not that `A` is incomplete but that it is not an integral or enumeration type.=20 Only msvc gives correct diagnostic saying: ``` error C2864: 'A::a': a static data member with an in-class initializer must have non-volatile const integral type or be specified as 'inline' ``` So I think gcc should say something similar to msvc instead of saying that = `A` being incomplete is the problem.=