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

            Bug ID: 93420
           Summary: Deducing "T C::* const&" from a non-const
                    pointer-to-member-function fails
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com
  Target Milestone: ---

struct S {};

template<typename C, typename T>        
void check(T C::* const&);

int (S::*f)();

using t = decltype(check(f));

Rejected by GCC:

<source>:8:27: error: no matching function for call to 'check(int (S::*&)())'

    8 | using t = decltype(check(f));

      |                           ^

<source>:4:6: note: candidate: 'template<class C, class T> void check(T C::*
const&)'

    4 | void check(T C::* const&);

      |      ^~~~~

<source>:4:6: note:   template argument deduction/substitution failed:

<source>:8:27: note:   types 'T C::* const' and 'int (S::*)()' have
incompatible cv-qualifiers

    8 | using t = decltype(check(f));

      |                           ^

This appears to be the cause of PR69243, which was worked around in the
library.

Reply via email to