This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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;
                  ^~
*/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]