From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A4F9138582A0; Tue, 1 Nov 2022 11:16:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4F9138582A0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667301410; bh=fdDOmiQqaJ/AtqJ+n8f6ke2kINKnPVdRsxa2PKTd0Kc=; h=From:To:Subject:Date:From; b=dLD5qX3vrY2f62dQMr5u0kBC5tAjHt1QdlzigtkgVvviRO/k4pspBsEPY5ZVeYpJe T5zeutOAa6wsJ6HbfDUA84nlEkHrFWEm1tqVPADeczkKBWO4kOsNJUm1IiKsNjqJow MTFOfof6jrLciPmG2w6mGui9nohBZiEUnNycfcsE= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107492] New: Unhelpful -Wignored-qualifiers warning in template specialization Date: Tue, 01 Nov 2022 11:16:49 +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: 12.2.1 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org 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 keywords 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=3D107492 Bug ID: 107492 Summary: Unhelpful -Wignored-qualifiers warning in template specialization Product: gcc Version: 12.2.1 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- GCC warns about this with -Wextra: template struct S { }; template<> struct S { }; template<> struct S { }; template constexpr bool is_same_v =3D false; template constexpr bool is_same_v =3D true; static_assert( ! is_same_v< void(*)(), const void(*)() > ); spec.cc:3:21: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 3 | template<> struct S { }; | ^~~~~ spec.cc:8:40: warning: type qualifiers ignored on function return type [-Wignored-qualifiers] 8 | static_assert( ! is_same_v< void(*)(), const void(*)() > ); | ^~~~~ The warning is wrong, the qualifiers are not ignored here. The two types are distinct, as shown by the fact that the explicit specializations are not redefinitions of each other, and the static assert passes.=