[Bug c++/72799] New: [C++11] ref-qualifiers are dropped from some function types

aoliva at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 3 21:23:00 GMT 2016


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

            Bug ID: 72799
           Summary: [C++11] ref-qualifiers are dropped from some function
                    types
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aoliva at gcc dot gnu.org
  Target Milestone: ---

// { dg-do compile }
// { dg-options "-std=c++11" }

// Make sure we don't drop ref-qualifiers...

typedef void rqft(void) const &;

struct S {
  rqft mf;
  rqft S::*mfpmf(void) &&;
};

void S::mf() const & {}

void (S::* S::mfpmf(void) &&)(void) const & { return &S::mf; } // ... here...

typedef void (S::*pmft1)(void) const &; // ... and here.

pmft1 pmf1 = &S::mf;

typedef rqft S::*pmft2;

pmft2 pmf2 = &S::mf;

/* gcc version 7.0.0 20160724-ish says:
.../gcc/testsuite/g++.dg/other/refqual-1.C:15:12: error: prototype for ‘void
(S::* S::mfpmf() &&)() const’ does not match any in class ‘S’
 void (S::* S::mfpmf(void) &&)(void) const & { return &S::mf; } // ... here...
            ^
.../gcc/testsuite/g++.dg/other/refqual-1.C:10:12: error: candidate is: void
(S::* S::mfpmf() &&)() const &
   rqft S::*mfpmf(void) &&;
            ^~~~~
.../gcc/testsuite/g++.dg/other/refqual-1.C:19:18: error: cannot convert ‘void
(S::*)() const &’ to ‘pmft1 {aka void (S::*)() const}’ in initialization
 pmft1 pmf1 = &S::mf;
                  ^~
*/


More information about the Gcc-bugs mailing list