gcc/testsuite/g++.dg/template/crash72.C
raw| 1 | // PR c++/29225 |
| 2 | // { dg-do compile } |
| 3 | |
| 4 | template <typename L, typename R> bool operator< (L x, R y); |
| 5 | struct T { int t (); }; |
| 6 | class S {}; |
| 7 | |
| 8 | struct U |
| 9 | { |
| 10 | typedef int (T::* M) (); |
| 11 | M m; |
| 12 | |
| 13 | bool operator() (S &x) |
| 14 | { |
| 15 | T a; |
| 16 | return (a.*m) < x; // { dg-error "invalid use of non-static member" } |
| 17 | } |
| 18 | }; |
| 19 | |
| 20 | void foo (S &x) |
| 21 | { |
| 22 | U m; |
| 23 | m.m = &T::t; |
| 24 | m (x); |
| 25 | } |