diff options
author | John McCall <rjmccall@apple.com> | 2010-08-24 22:52:39 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-08-24 22:52:39 +0000 |
commit | fb97e75e627599aaa7a613778134e290f9de663b (patch) | |
tree | 18855c1b8c3f75781ed9dd333e7754ae1931766d /test/CXX/class/class.mfct | |
parent | 4153a060f4cd03e9db1349328a158e9d898a2610 (diff) |
When trying to resolve the address of an overloaded expression,
only form pointers-to-member if the expression has the appropriate
form. This avoids assertions later on on invalid code, but also
allows us to properly resolve mixed-staticity overloads.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111987 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/class/class.mfct')
-rw-r--r-- | test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp b/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp index c81e4ef1b1..7e09bc8aef 100644 --- a/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp +++ b/test/CXX/class/class.mfct/class.mfct.non-static/p3.cpp @@ -91,3 +91,28 @@ namespace test2 { a.test3(); // expected-note {{in instantiation}} } } + +namespace test3 { + struct A { + void foo(void (A::*)(int)); // expected-note {{passing argument to parameter here}} + template<typename T> void g(T); + + void test() { + foo(&g<int>); // expected-error {{cannot initialize a parameter}} + } + }; +} + +// This should succeed. +namespace test4 { + struct A { + static void f(void (A::*)()); + static void f(void (*)(int)); + void g(); + static void g(int); + + void test() { + f(&g); + } + }; +} |