diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/template/ptrmem8.C')
-rw-r--r-- | gcc/testsuite/g++.dg/template/ptrmem8.C | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/ptrmem8.C b/gcc/testsuite/g++.dg/template/ptrmem8.C new file mode 100644 index 000000000..d0473f5cc --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ptrmem8.C @@ -0,0 +1,24 @@ +// { dg-do compile } +// Origin: <marco dot franzen at bigfoot dot com> +// PR c++/10126: Handle ptmf default conversions while matching a template +// argument + +struct B +{ + int I () const; + int I (); +}; + +struct D : B {}; + +template <int (D::*fun)() const> int Get(); // { dg-message "note" } + +int main () +{ + Get<&B::I>(); // { dg-error "not a valid template argument" "not valid" } + // { dg-error "no match" "no match" { target *-*-* } 18 } + // { dg-message "note" "note" { target *-*-* } 18 } + Get<&D::I>(); // { dg-error "not a valid template argument" "not valid" } + // { dg-error "no match" "no match" { target *-*-* } 21 } + // { dg-message "note" "note" { target *-*-* } 21 } +} |