diff options
| author | Jan Korous <jkorous@apple.com> | 2018-04-18 13:38:39 +0000 |
|---|---|---|
| committer | Jan Korous <jkorous@apple.com> | 2018-04-18 13:38:39 +0000 |
| commit | 536d2e30721e2b1690ac4018c033e36c096820bb (patch) | |
| tree | 03707003da395d5fa2faa264afe3a18047adf3ee /clang/test/SemaCXX/overloaded-builtin-operators-cxx17.cpp | |
| parent | d501a609c408530bbfe4a12fb3e5c1702a5de66a (diff) | |
| download | bcm5719-llvm-536d2e30721e2b1690ac4018c033e36c096820bb.tar.gz bcm5719-llvm-536d2e30721e2b1690ac4018c033e36c096820bb.zip | |
[Sema] Disable built-in increment operator for bool in overload resolution in C++17
Following: https://llvm.org/svn/llvm-project/cfe/trunk@329804
For C++17 the wording of [over.built] p4 excluded bool:
For every pair (T , vq), where T is an arithmetic type other than bool, there exist
candidate operator functions of the form
vq T & operator++(vq T &);
T operator++(vq T &, int);
Differential Revision: https://reviews.llvm.org/D45569
llvm-svn: 330254
Diffstat (limited to 'clang/test/SemaCXX/overloaded-builtin-operators-cxx17.cpp')
| -rw-r--r-- | clang/test/SemaCXX/overloaded-builtin-operators-cxx17.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/overloaded-builtin-operators-cxx17.cpp b/clang/test/SemaCXX/overloaded-builtin-operators-cxx17.cpp new file mode 100644 index 00000000000..05f85f88ccd --- /dev/null +++ b/clang/test/SemaCXX/overloaded-builtin-operators-cxx17.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only -fshow-overloads=best -verify -triple x86_64-linux-gnu -std=c++17 %s + +struct BoolRef { + operator bool&(); +}; + +void foo(BoolRef br) { + // C++ [over.built]p3: Increment for bool was removed in C++17. + bool b = br++; // expected-error{{cannot increment value of type 'BoolRef'}} +}
\ No newline at end of file |

