public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65880] New: Member function issue with argument "pointer to const array of member function pointers"
@ 2015-04-24 17:47 habanero_pizza at yahoo dot com
  2015-06-19 18:16 ` [Bug c++/65880] [5/6 Regression] " jason at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: habanero_pizza at yahoo dot com @ 2015-04-24 17:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65880
           Summary: Member function issue with argument "pointer to const
                    array of member function pointers"
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: habanero_pizza at yahoo dot com
                CC: habanero_pizza at yahoo dot com
              Host: i686-pc-linux-gnu
            Target: i686-pc-linux-gnu
             Build: i686-pc-linux-gnu

Created attachment 35396
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35396&action=edit
Test case source:  fails if OKAY is not defined...

When a member function takes an argument of the form:

  type (classname::* const *ptr)(void)

AND the implementation of the function appears BEFORE its reference by another
member function, the compiler believes (at reference time) that the argument
type should be:

  type (classname::* *ptr)(void)

That is, the "const" seems to get dropped from the declaration.  However, if
the implementation of the function appears AFTER references by other member
functions, the code compiles correctly.

This seems to be a new issue with gcc 5.1.0, as 4.9.2 compiles the problem case
properly.

Example run demonstrating the problem:

$ i386-eabi-g++ -v -save-temps -o test-const-mfp-table-arg
test-const-mfp-table-arg.cc
Using built-in specs.
COLLECT_GCC=i386-eabi-g++
COLLECT_LTO_WRAPPER=/usr/local/i386-eabi-5.1.0/libexec/gcc/i686-pc-linux-gnu/5.1
.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../../gcc-5.1.0/configure --prefix=/usr/local/i386-eabi-5.1.0
-
-program-prefix=i386-eabi- --enable-languages=c,c++
--with-gmp=/usr/local/i386-e
abi-5.1.0 --with-mpfr=/usr/local/i386-eabi-5.1.0
--with-mpc=/usr/local/i386-eabi
-5.1.0 --with-isl=/usr/local/i386-eabi-5.1.0 --with-zlib=/usr/local
--enable-lto
 --enable-gold
Thread model: posix
gcc version 5.1.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'test-const-mfp-table-arg'
'-shared-
libgcc' '-mtune=generic' '-march=pentiumpro'
 /usr/local/i386-eabi-5.1.0/libexec/gcc/i686-pc-linux-gnu/5.1.0/cc1plus -E
-quie
t -v -D_GNU_SOURCE test-const-mfp-table-arg.cc -mtune=generic -march=pentiumpro 
-fpch-preprocess -o test-const-mfp-table-arg.ii
ignoring nonexistent directory
"/usr/local/i386-eabi-5.1.0/lib/gcc/i686-pc-linux
-gnu/5.1.0/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/usr/local/i386-eabi-5.1.0/lib/gcc/i686-pc-linux-gnu/5.1.0/../../../../include/
c++/5.1.0

/usr/local/i386-eabi-5.1.0/lib/gcc/i686-pc-linux-gnu/5.1.0/../../../../include/
c++/5.1.0/i686-pc-linux-gnu

/usr/local/i386-eabi-5.1.0/lib/gcc/i686-pc-linux-gnu/5.1.0/../../../../include/
c++/5.1.0/backward
 /usr/local/i386-eabi-5.1.0/lib/gcc/i686-pc-linux-gnu/5.1.0/include
 /usr/local/include
 /usr/local/i386-eabi-5.1.0/include
 /usr/local/i386-eabi-5.1.0/lib/gcc/i686-pc-linux-gnu/5.1.0/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'test-const-mfp-table-arg'
'-shared-
libgcc' '-mtune=generic' '-march=pentiumpro'
 /usr/local/i386-eabi-5.1.0/libexec/gcc/i686-pc-linux-gnu/5.1.0/cc1plus
-fprepro
cessed test-const-mfp-table-arg.ii -quiet -dumpbase test-const-mfp-table-arg.cc 
-mtune=generic -march=pentiumpro -auxbase test-const-mfp-table-arg -version -o
t
est-const-mfp-table-arg.s
GNU C++ (GCC) version 5.1.0 (i686-pc-linux-gnu)
        compiled by GNU C version 5.1.0, GMP version 5.1.3, MPFR version 3.1.2, 
MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 5.1.0 (i686-pc-linux-gnu)
        compiled by GNU C version 5.1.0, GMP version 5.1.3, MPFR version 3.1.2, 
MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 8a9e49c211f4d1d2fc149d62c24d84d4
test-const-mfp-table-arg.cc: In member function ‘bool Test::barl()’:
test-const-mfp-table-arg.cc:67:20: error: invalid conversion from ‘bool
(Test::*
 const*)()’ to ‘bool (Test::**)()’ [-fpermissive]
     return fool(fms);
                    ^
test-const-mfp-table-arg.cc:40:6: note:   initializing argument 1 of ‘bool
Test:
:fool(bool (Test::**)())’
 bool Test::fool(bool (Test::* const *fms)(void))
      ^

Preprocessor output (test-const-mfp-table-arg.ii):

# 1 "test-const-mfp-table-arg.cc"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test-const-mfp-table-arg.cc"


class Test
{
  public:
    Test();
    ~Test();

    bool barl(void);

  private:
    bool fool(bool (Test::* const *fms)(void));
    bool foo(void);
    bool bar(void);
};

Test::Test()
{
}

Test::~Test()
{
}
# 40 "test-const-mfp-table-arg.cc"
bool Test::fool(bool (Test::* const *fms)(void))
{
    bool retval = false;

    int i = 0;
    bool (Test::*f)(void) = fms[i++];

    while (f) {
        retval = (this->*f)();
        if (retval) break;
        f = fms[i++];
    }

    return retval;
}


bool Test::barl(void)
{
    static bool (Test::* const fms[])(void) = {
        &Test::foo,
        &Test::bar,
        0
    };



    return fool(fms);
}


bool Test::foo(void)
{
    return false;
}

bool Test::bar(void)
{
    return true;
}

int main(int argc, const char *argv[])
{
    Test t;
    return t.barl();
}
>From gcc-bugs-return-484579-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Apr 24 19:07:59 2015
Return-Path: <gcc-bugs-return-484579-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 94480 invoked by alias); 24 Apr 2015 19:07:58 -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 94443 invoked by uid 48); 24 Apr 2015 19:07:55 -0000
From: "LpSolit at netscape dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug web/64968] Upgrade GCC Bugzilla to 5.0
Date: Fri, 24 Apr 2015 19:07:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: web
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: LpSolit at netscape dot net
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: LpSolit at netscape dot net
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.isobsolete attachments.created
Message-ID: <bug-64968-4-Hoe3gMEzTK@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64968-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64968-4@http.gcc.gnu.org/bugzilla/>
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
X-SW-Source: 2015-04/txt/msg02131.txt.bz2
Content-length: 695

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

Frédéric Buclin <LpSolit at netscape dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #35354|0                           |1
        is obsolete|                            |

--- Comment #10 from Frédéric Buclin <LpSolit at netscape dot net> ---
Created attachment 35397
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35397&action=edit
GCC extension for 5.0, v2.0.1

This updated extension includes a RESTRICT_LOGIN boolean constant to easily
enable/disable user account creation restrictions.
>From gcc-bugs-return-484580-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Apr 24 19:12:22 2015
Return-Path: <gcc-bugs-return-484580-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 101067 invoked by alias); 24 Apr 2015 19:12:22 -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 101012 invoked by uid 55); 24 Apr 2015 19:12:18 -0000
From: "jason at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/50800] Internal compiler error in finish_member_declarations, possibly related to may_alias attribute
Date: Fri, 24 Apr 2015 19:12:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.6.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: jason at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: jason at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.8.5
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-50800-4-sA4vVt4Jxq@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-50800-4@http.gcc.gnu.org/bugzilla/>
References: <bug-50800-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: 2015-04/txt/msg02132.txt.bz2
Content-length: 622

https://gcc.gnu.org/bugzilla/show_bug.cgi?idP800

--- Comment #14 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Apr 24 19:11:45 2015
New Revision: 222419

URL: https://gcc.gnu.org/viewcvs?rev"2419&root=gcc&view=rev
Log:
    PR c++/50800
gcc/
    * tree.c (build_reference_type_for_mode): Don't pass can_alias_all
    down when building TYPE_CANONICAL.
    (build_pointer_type_for_mode): Likewise.
gcc/cp/
    * typeck.c (structural_comptypes): Don't check TYPE_REF_CAN_ALIAS_ALL.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/tree.c


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

* [Bug c++/65880] [5/6 Regression] Member function issue with argument "pointer to const array of member function pointers"
  2015-04-24 17:47 [Bug c++/65880] New: Member function issue with argument "pointer to const array of member function pointers" habanero_pizza at yahoo dot com
@ 2015-06-19 18:16 ` jason at gcc dot gnu.org
  2015-06-19 18:25 ` jason at gcc dot gnu.org
  2015-06-22 17:36 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2015-06-19 18:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Jun 19 18:15:36 2015
New Revision: 224678

URL: https://gcc.gnu.org/viewcvs?rev=224678&root=gcc&view=rev
Log:
        PR c++/65880
        * decl.c (build_ptrmemfunc_type): Check TYPE_GET_PTRMEMFUNC_TYPE after
        cv-qualifiers.
        * typeck.c (merge_types): build_ptrmemfunc_type before applying
        quals and attributes.

Added:
    trunk/gcc/testsuite/g++.dg/overload/pmf3.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/typeck.c


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

* [Bug c++/65880] [5/6 Regression] Member function issue with argument "pointer to const array of member function pointers"
  2015-04-24 17:47 [Bug c++/65880] New: Member function issue with argument "pointer to const array of member function pointers" habanero_pizza at yahoo dot com
  2015-06-19 18:16 ` [Bug c++/65880] [5/6 Regression] " jason at gcc dot gnu.org
@ 2015-06-19 18:25 ` jason at gcc dot gnu.org
  2015-06-22 17:36 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2015-06-19 18:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Fri Jun 19 18:24:29 2015
New Revision: 224683

URL: https://gcc.gnu.org/viewcvs?rev=224683&root=gcc&view=rev
Log:
        PR c++/65880
        * decl.c (build_ptrmemfunc_type): Check TYPE_GET_PTRMEMFUNC_TYPE after
        cv-qualifiers.

Added:
    branches/gcc-5-branch/gcc/testsuite/g++.dg/overload/pmf3.C
Modified:
    branches/gcc-5-branch/gcc/cp/ChangeLog
    branches/gcc-5-branch/gcc/cp/decl.c


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

* [Bug c++/65880] [5/6 Regression] Member function issue with argument "pointer to const array of member function pointers"
  2015-04-24 17:47 [Bug c++/65880] New: Member function issue with argument "pointer to const array of member function pointers" habanero_pizza at yahoo dot com
  2015-06-19 18:16 ` [Bug c++/65880] [5/6 Regression] " jason at gcc dot gnu.org
  2015-06-19 18:25 ` jason at gcc dot gnu.org
@ 2015-06-22 17:36 ` jason at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2015-06-22 17:36 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|---                         |FIXED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org
   Target Milestone|---                         |5.2

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2015-06-22 17:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-24 17:47 [Bug c++/65880] New: Member function issue with argument "pointer to const array of member function pointers" habanero_pizza at yahoo dot com
2015-06-19 18:16 ` [Bug c++/65880] [5/6 Regression] " jason at gcc dot gnu.org
2015-06-19 18:25 ` jason at gcc dot gnu.org
2015-06-22 17:36 ` jason 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).