diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-10-03 01:20:27 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-10-03 01:20:27 +0000 |
| commit | 5258202a81598e8f6f97751a0b0045e5aa1b8978 (patch) | |
| tree | 1e99374adb67115d5e943784b0cb6d105ea48ade /clang/test | |
| parent | 30c8df02ba22a2f9b2af44714f382e2e4a4aafdb (diff) | |
| download | bcm5719-llvm-5258202a81598e8f6f97751a0b0045e5aa1b8978.tar.gz bcm5719-llvm-5258202a81598e8f6f97751a0b0045e5aa1b8978.zip | |
PR43519: don't inject a diagnostic when constant-evaulation of a
pointer-to-member call can't determine a callee.
We will have produced a diagnostic already if the callee is known to be
unevaluatable, and diagnosing here rejects valid code during potential
constant expression checking.
llvm-svn: 373553
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaCXX/constant-expression-cxx11.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp index bd7094f4d4f..27ad0f654f5 100644 --- a/clang/test/SemaCXX/constant-expression-cxx11.cpp +++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp @@ -1108,6 +1108,11 @@ namespace MemberPointer { static_assert((int Derived::*)(int Mid<0>::*)&Mid<0>::n != (int Derived::*)(int Mid<1>::*)&Mid<1>::n, ""); static_assert(&Mid<0>::n == (int Mid<0>::*)&Base::n, ""); + + constexpr int apply(const A &a, int (A::*f)() const) { + return (a.*f)(); + } + static_assert(apply(A(2), &A::f) == 5, ""); } namespace ArrayBaseDerived { |

