public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57466] New: Argument deduction fails for 'const T*' when T is function type
@ 2013-05-30 10:07 redi at gcc dot gnu.org
  2013-05-30 11:03 ` [Bug c++/57466] " daniel.kruegler at googlemail dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2013-05-30 10:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57466
           Summary: Argument deduction fails for 'const T*' when T is
                    function type
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
            Blocks: 57465

(This is the root cause of PR 57465, but I have a workaround for the library.)


template<typename T>
  constexpr bool
  is_pointer(const T*)
  { return true; }

template<typename T>
  constexpr bool
  is_pointer(const T&)
  { return false; }

using F = void();

constexpr F* f = nullptr;

static_assert( is_pointer(f), "function pointer is a pointer" );

G++ fails the static assertion:

t.cc:15:1: error: static assertion failed: function pointer is a pointer
 static_assert( is_pointer(f), "function pointer is a pointer" );
 ^

The first function template should be instantiated as bool is_pointer(F*) but
instead deduction fails because:
   types 'const T' and 'F {aka void()}' have incompatible cv-qualifiers


Note deduction succeeds with an explicit template argument:

template<typename T>
  constexpr bool
  is_pointer(const T*)
  { return true; }

using F = void();

constexpr F* f = nullptr;

constexpr bool pass = is_pointer<F>(f);
constexpr bool fail = is_pointer(f);


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

* [Bug c++/57466] Argument deduction fails for 'const T*' when T is function type
  2013-05-30 10:07 [Bug c++/57466] New: Argument deduction fails for 'const T*' when T is function type redi at gcc dot gnu.org
@ 2013-05-30 11:03 ` daniel.kruegler at googlemail dot com
  2013-05-30 11:23 ` [Bug c++/57466] [DR 1584] " redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2013-05-30 11:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
I think this observation was the reason why I filed:

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

Notice that albeit the current CWG issue status contains a P/R, there is
indication for being some contradiction to the assertions made in

www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#503

(I have posted this to the CWG committee recently)
>From gcc-bugs-return-423423-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu May 30 11:14:39 2013
Return-Path: <gcc-bugs-return-423423-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 5093 invoked by alias); 30 May 2013 11:14:39 -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 5066 invoked by uid 48); 30 May 2013 11:14:35 -0000
From: "vladimir.fuka at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/57469] New: Erroneous warning for unused dummy arguments used in namelist
Date: Thu, 30 May 2013 11:14:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: fortran
X-Bugzilla-Version: 4.8.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: vladimir.fuka at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
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
Message-ID: <bug-57469-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-05/txt/msg02096.txt.bz2
Content-length: 1134

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

            Bug ID: 57469
           Summary: Erroneous warning for unused dummy arguments used in
                    namelist
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vladimir.fuka at gmail dot com

This code:

   subroutine read_command_line(line,a,b)
     character(*),intent(in) :: line
     intent(inout) :: a,b
     namelist /cmd/ a,b

     read(line,nml = cmd)
   end

produces this warning with gfortran-4.8 20130509:

gfortran warning.f90 -c -Wall
warning.f90:1.38:

   subroutine read_command_line(line,a,b)
                                      1
Warning: Unused dummy argument 'a' at (1)
warning.f90:1.40:

   subroutine read_command_line(line,a,b)
                                        1
Warning: Unused dummy argument 'b' at (1)




For intent(out) it produces:

Warning: Dummy argument 'a' at (1) was declared INTENT(OUT) but was not set

But i understand it may be correct.


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

* [Bug c++/57466] [DR 1584] Argument deduction fails for 'const T*' when T is function type
  2013-05-30 10:07 [Bug c++/57466] New: Argument deduction fails for 'const T*' when T is function type redi at gcc dot gnu.org
  2013-05-30 11:03 ` [Bug c++/57466] " daniel.kruegler at googlemail dot com
@ 2013-05-30 11:23 ` redi at gcc dot gnu.org
  2014-07-08 10:21 ` paolo.carlini at oracle dot com
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2013-05-30 11:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |SUSPENDED
   Last reconfirmed|                            |2013-05-30
            Summary|Argument deduction fails    |[DR 1584] Argument
                   |for 'const T*' when T is    |deduction fails for 'const
                   |function type               |T*' when T is function type
     Ever confirmed|0                           |1

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Ah yes, thanks!


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

* [Bug c++/57466] [DR 1584] Argument deduction fails for 'const T*' when T is function type
  2013-05-30 10:07 [Bug c++/57466] New: Argument deduction fails for 'const T*' when T is function type redi at gcc dot gnu.org
  2013-05-30 11:03 ` [Bug c++/57466] " daniel.kruegler at googlemail dot com
  2013-05-30 11:23 ` [Bug c++/57466] [DR 1584] " redi at gcc dot gnu.org
@ 2014-07-08 10:21 ` paolo.carlini at oracle dot com
  2014-07-09 21:23 ` paolo at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-07-08 10:21 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
DR1584 is Ready.


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

* [Bug c++/57466] [DR 1584] Argument deduction fails for 'const T*' when T is function type
  2013-05-30 10:07 [Bug c++/57466] New: Argument deduction fails for 'const T*' when T is function type redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-07-08 10:21 ` paolo.carlini at oracle dot com
@ 2014-07-09 21:23 ` paolo at gcc dot gnu.org
  2014-07-09 21:24 ` paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-07-09 21:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed Jul  9 21:23:06 2014
New Revision: 212410

URL: https://gcc.gnu.org/viewcvs?rev=212410&root=gcc&view=rev
Log:
/cp
2014-07-09  Paolo Carlini  <paolo.carlini@oracle.com>

    DR 1584
    PR c++/57466
    * pt.c (check_cv_quals_for_unify): Implement resolution, disregard
    cv-qualifiers of function types.

/testsuite
2014-07-09  Paolo Carlini  <paolo.carlini@oracle.com>

    DR 1584
    PR c++/57466
    * g++.dg/template/pr57466.C: New.
    * g++.dg/cpp0x/pr57466.C: Likewise.
    * g++.dg/template/unify6.C: Update.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/pr57466.C
    trunk/gcc/testsuite/g++.dg/template/pr57466.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/template/unify6.C


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

* [Bug c++/57466] [DR 1584] Argument deduction fails for 'const T*' when T is function type
  2013-05-30 10:07 [Bug c++/57466] New: Argument deduction fails for 'const T*' when T is function type redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-07-09 21:23 ` paolo at gcc dot gnu.org
@ 2014-07-09 21:24 ` paolo.carlini at oracle dot com
  2014-08-15 16:24 ` paolo at gcc dot gnu.org
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-07-09 21:24 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org
   Target Milestone|---                         |4.10.0

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.10.


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

* [Bug c++/57466] [DR 1584] Argument deduction fails for 'const T*' when T is function type
  2013-05-30 10:07 [Bug c++/57466] New: Argument deduction fails for 'const T*' when T is function type redi at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-07-09 21:24 ` paolo.carlini at oracle dot com
@ 2014-08-15 16:24 ` paolo at gcc dot gnu.org
  2014-08-15 16:26 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo at gcc dot gnu.org @ 2014-08-15 16:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Fri Aug 15 16:23:47 2014
New Revision: 214027

URL: https://gcc.gnu.org/viewcvs?rev=214027&root=gcc&view=rev
Log:
/cp
2014-08-15  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/62072
    Revert:
    2014-07-09  Paolo Carlini  <paolo.carlini@oracle.com>

    DR 1584
    PR c++/57466
    * pt.c (check_cv_quals_for_unify): Implement resolution, disregard
    cv-qualifiers of function types.

/testsuite
2014-08-15  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/62072
    Revert:
    2014-07-09  Paolo Carlini  <paolo.carlini@oracle.com>

    DR 1584
    PR c++/57466
    * g++.dg/template/pr57466.C: New.
    * g++.dg/cpp0x/pr57466.C: Likewise.
    * g++.dg/template/unify6.C: Update.

    * g++.dg/cpp0x/sfinae52.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/sfinae52.C
Removed:
    trunk/gcc/testsuite/g++.dg/cpp0x/pr57466.C
    trunk/gcc/testsuite/g++.dg/template/pr57466.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/template/unify6.C


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

* [Bug c++/57466] [DR 1584] Argument deduction fails for 'const T*' when T is function type
  2013-05-30 10:07 [Bug c++/57466] New: Argument deduction fails for 'const T*' when T is function type redi at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2014-08-15 16:24 ` paolo at gcc dot gnu.org
@ 2014-08-15 16:26 ` paolo.carlini at oracle dot com
  2015-04-22 11:59 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-08-15 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Patch reverted, unfortunately.


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

* [Bug c++/57466] [DR 1584] Argument deduction fails for 'const T*' when T is function type
  2013-05-30 10:07 [Bug c++/57466] New: Argument deduction fails for 'const T*' when T is function type redi at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2014-08-15 16:26 ` paolo.carlini at oracle dot com
@ 2015-04-22 11:59 ` jakub at gcc dot gnu.org
  2015-07-16  9:16 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-22 11:59 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.0                         |5.2

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 5.1 has been released.


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

* [Bug c++/57466] [DR 1584] Argument deduction fails for 'const T*' when T is function type
  2013-05-30 10:07 [Bug c++/57466] New: Argument deduction fails for 'const T*' when T is function type redi at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2015-04-22 11:59 ` jakub at gcc dot gnu.org
@ 2015-07-16  9:16 ` rguenth at gcc dot gnu.org
  2021-08-05  3:14 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-16  9:16 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.2                         |5.3

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 5.2 is being released, adjusting target milestone to 5.3.


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

* [Bug c++/57466] [DR 1584] Argument deduction fails for 'const T*' when T is function type
  2013-05-30 10:07 [Bug c++/57466] New: Argument deduction fails for 'const T*' when T is function type redi at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2015-07-16  9:16 ` rguenth at gcc dot gnu.org
@ 2021-08-05  3:14 ` pinskia at gcc dot gnu.org
  2021-08-05 15:33 ` redi at gcc dot gnu.org
  2022-01-09  0:46 ` pinskia at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-05  3:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #17)
> Fine by me.
> 
> EDG agrees with GCC, but Clang accepts the original example. I guess they'll
> change when 1584 gets resolved.

clang started to reject in clang 7.0.0.

Is there anything else that needs to be done?

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

* [Bug c++/57466] [DR 1584] Argument deduction fails for 'const T*' when T is function type
  2013-05-30 10:07 [Bug c++/57466] New: Argument deduction fails for 'const T*' when T is function type redi at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2021-08-05  3:14 ` pinskia at gcc dot gnu.org
@ 2021-08-05 15:33 ` redi at gcc dot gnu.org
  2022-01-09  0:46 ` pinskia at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-05 15:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The core issue is still open, for some reason.

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

* [Bug c++/57466] [DR 1584] Argument deduction fails for 'const T*' when T is function type
  2013-05-30 10:07 [Bug c++/57466] New: Argument deduction fails for 'const T*' when T is function type redi at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2021-08-05 15:33 ` redi at gcc dot gnu.org
@ 2022-01-09  0:46 ` pinskia at gcc dot gnu.org
  11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-09  0:46 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.5                         |---

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

end of thread, other threads:[~2022-01-09  0:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-30 10:07 [Bug c++/57466] New: Argument deduction fails for 'const T*' when T is function type redi at gcc dot gnu.org
2013-05-30 11:03 ` [Bug c++/57466] " daniel.kruegler at googlemail dot com
2013-05-30 11:23 ` [Bug c++/57466] [DR 1584] " redi at gcc dot gnu.org
2014-07-08 10:21 ` paolo.carlini at oracle dot com
2014-07-09 21:23 ` paolo at gcc dot gnu.org
2014-07-09 21:24 ` paolo.carlini at oracle dot com
2014-08-15 16:24 ` paolo at gcc dot gnu.org
2014-08-15 16:26 ` paolo.carlini at oracle dot com
2015-04-22 11:59 ` jakub at gcc dot gnu.org
2015-07-16  9:16 ` rguenth at gcc dot gnu.org
2021-08-05  3:14 ` pinskia at gcc dot gnu.org
2021-08-05 15:33 ` redi at gcc dot gnu.org
2022-01-09  0:46 ` 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).