public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56693] New: Fail to ignore const qualification on top of a function type.
@ 2013-03-22 23:30 cassio.neri at gmail dot com
  2013-03-23 12:20 ` [Bug c++/56693] " daniel.kruegler at googlemail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: cassio.neri at gmail dot com @ 2013-03-22 23:30 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56693

             Bug #: 56693
           Summary: Fail to ignore const qualification on top of a
                    function type.
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: cassio.neri@gmail.com


The following code:

void f() {}

template <typename T> void g(const T*) { }

int main() {
    g(f);
}

raises an error with this note:

    types 'const T' and 'void()' have incompatible cv-qualifiers

Attempting to instantiate g creates a function that takes a pointer to a const
T where T = void(). Since there's no such thing as a "const function", this
explains the note. However, C++11 8.3.5/6 says

"The effect of a cv-qualifier-seq in a function declarator is not the same as
adding cv-qualification on top of the function type. In the latter case, the
cv-qualifiers are ignored."

Hence, the const qualifier should be ignored and the code should compile. (It
does compile with clang and visual studio.)

For more information see:
http://stackoverflow.com/questions/15578298/can-a-const-t-match-a-pointer-to-free-function


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

* [Bug c++/56693] Fail to ignore const qualification on top of a function type.
  2013-03-22 23:30 [Bug c++/56693] New: Fail to ignore const qualification on top of a function type cassio.neri at gmail dot com
@ 2013-03-23 12:20 ` daniel.kruegler at googlemail dot com
  2013-03-23 15:03 ` [Bug c++/56693] [DR 1584] " redi at gcc dot gnu.org
  2021-08-12  4:06 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-03-23 12:20 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56693

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2013-03-23 12:20:30 UTC ---
This looks like

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1584

to me
>From gcc-bugs-return-418198-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sat Mar 23 12:23:41 2013
Return-Path: <gcc-bugs-return-418198-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 30047 invoked by alias); 23 Mar 2013 12:23:41 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 30020 invoked by uid 48); 23 Mar 2013 12:23:33 -0000
From: "dominiq at lps dot ens.fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libfortran/56696] [4.8/4.9 Regression] Formatted (list-directed)  input fails to signal end of record
Date: Sat, 23 Mar 2013 12:23:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libfortran
X-Bugzilla-Keywords:
X-Bugzilla-Severity: major
X-Bugzilla-Who: dominiq at lps dot ens.fr
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields: Status Last reconfirmed CC Summary Ever Confirmed
Message-ID: <bug-56696-4-rmBgjtF5O9@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-56696-4@http.gcc.gnu.org/bugzilla/>
References: <bug-56696-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-03/txt/msg01639.txt.bz2
Content-length: 1189


http://gcc.gnu.org/bugzilla/show_bug.cgi?idV696

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-03-23
                 CC|                            |jvdelisle at gcc dot
                   |                            |gnu.org
            Summary|Formatted (list-directed)   |[4.8/4.9 Regression]
                   |input fails to signal end   |Formatted (list-directed)
                   |of record                   |input fails to signal end
                   |                            |of record
     Ever Confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2013-03-23 12:23:33 UTC ---
The test works for revision 194721 (2012-12-26), but not for revision 194897
(2013-01-04). From the change log, it seems likely to be revision 194809
(pr55818). Revisions 194724 (pr48960) and 194734 (pr48976) are also in the
range, but don't seem related.


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

* [Bug c++/56693] [DR 1584] Fail to ignore const qualification on top of a function type.
  2013-03-22 23:30 [Bug c++/56693] New: Fail to ignore const qualification on top of a function type cassio.neri at gmail dot com
  2013-03-23 12:20 ` [Bug c++/56693] " daniel.kruegler at googlemail dot com
@ 2013-03-23 15:03 ` redi at gcc dot gnu.org
  2021-08-12  4:06 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2013-03-23 15:03 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56693

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |SUSPENDED
   Last reconfirmed|                            |2013-03-23
            Summary|Fail to ignore const        |[DR 1584] Fail to ignore
                   |qualification on top of a   |const qualification on top
                   |function type.              |of a function type.
     Ever Confirmed|0                           |1


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

* [Bug c++/56693] [DR 1584] Fail to ignore const qualification on top of a function type.
  2013-03-22 23:30 [Bug c++/56693] New: Fail to ignore const qualification on top of a function type cassio.neri at gmail dot com
  2013-03-23 12:20 ` [Bug c++/56693] " daniel.kruegler at googlemail dot com
  2013-03-23 15:03 ` [Bug c++/56693] [DR 1584] " redi at gcc dot gnu.org
@ 2021-08-12  4:06 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-12  4:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---

Notes from the May, 2015 meeting:

The consensus of CWG was that the cv-qualification of the argument and
parameter must match, so the original example should be rejected.

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

end of thread, other threads:[~2021-08-12  4:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-22 23:30 [Bug c++/56693] New: Fail to ignore const qualification on top of a function type cassio.neri at gmail dot com
2013-03-23 12:20 ` [Bug c++/56693] " daniel.kruegler at googlemail dot com
2013-03-23 15:03 ` [Bug c++/56693] [DR 1584] " redi at gcc dot gnu.org
2021-08-12  4:06 ` 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).