https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126599
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
For
struct S { int s, t; };
template <auto M>
void foo (int);
void
bar ()
{
foo <(int S::*)nullptr> ();
foo <&S::s> ();
foo <&S::t> ();
}
we diagnose
pr126599.C: In function ‘void bar()’:
pr126599.C:7:27: error: no matching function for call to ‘foo<-1>()’
7 | foo <(int S::*)nullptr> ();
| ~~~~~~~~~~~~~~~~~~~~~~~~^~
• there is 1 candidate
• candidate 1: ‘template<auto M> void foo(int)’
pr126599.C:3:6:
3 | void foo (int);
| ^~~
• candidate expects 1 argument, 0 provided
pr126599.C:8:15: error: no matching function for call to ‘foo<&S::s>()’
8 | foo <&S::s> ();
| ~~~~~~~~~~~~^~
• there is 1 candidate
• candidate 1: ‘template<auto M> void foo(int)’
pr126599.C:3:6:
3 | void foo (int);
| ^~~
• candidate expects 1 argument, 0 provided
pr126599.C:9:15: error: no matching function for call to ‘foo<&S::t>()’
9 | foo <&S::t> ();
| ~~~~~~~~~~~~^~
• there is 1 candidate
• candidate 1: ‘template<auto M> void foo(int)’
pr126599.C:3:6:
3 | void foo (int);
| ^~~
• candidate expects 1 argument, 0 provided
&S::s and &S::t is printed for PTRMEM_CST, while -1 is printed for OFFSET_TYPE
INTEGER_CST:
216 /* A NULL pointer-to-data-member is represented by -1, not by
217 zero. */
218 tree val = (TYPE_PTRDATAMEM_P (type)
219 ? build_int_cst_type (type, -1)
220 : build_int_cst (type, 0));