diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-11-30 20:34:28 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-11-30 20:34:28 +0000 |
commit | e63176229a74ea43a824d1d55b826aa71345305e (patch) | |
tree | ece2a30b31a0e12a059178275e40ce861c3b7c3f /test | |
parent | 34c87211f9f1059a90ecf0ad1323d38335e8b19a (diff) | |
download | clang-e63176229a74ea43a824d1d55b826aa71345305e.tar.gz |
[MS Compat] Adjust thiscall to cdecl when deducing template arguments
Function types can be extracted from member pointer types.
However, the type is not appropriate without first adjusting the calling
convention.
This fixes PR25661.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@254323 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/SemaCXX/calling-conv-compat.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/SemaCXX/calling-conv-compat.cpp b/test/SemaCXX/calling-conv-compat.cpp index cebac9fad6..20d93b41e1 100644 --- a/test/SemaCXX/calling-conv-compat.cpp +++ b/test/SemaCXX/calling-conv-compat.cpp @@ -370,6 +370,19 @@ X<fun_cdecl >::p tmpl6 = &A::method_thiscall; X<fun_stdcall >::p tmpl7 = &A::method_stdcall; X<fun_fastcall>::p tmpl8 = &A::method_fastcall; +// Make sure we adjust thiscall to cdecl when extracting the function type from +// a member pointer. +template <typename> struct Y; + +template <typename Fn, typename C> +struct Y<Fn C::*> { + typedef Fn *p; +}; + +void __cdecl f_cdecl(); +Y<decltype(&A::method_thiscall)>::p tmpl9 = &f_cdecl; + + } // end namespace MemberPointers // Test that lambdas that capture nothing convert to cdecl function pointers. |