summaryrefslogtreecommitdiffstats
path: root/test/libcxx/utilities/tuple
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-01-13 22:02:08 +0000
committerEric Fiselier <eric@efcs.ca>2017-01-13 22:02:08 +0000
commitebaf7dab14c3bf1c4f995d9ad1199b6c2784a8ca (patch)
treef65c289da0bd7205d5042d29be1efd31a85b20d8 /test/libcxx/utilities/tuple
parentccb58d0a2c539a5cec75a30f09243fd3064939a6 (diff)
downloadexternal_libcxx-ebaf7dab14c3bf1c4f995d9ad1199b6c2784a8ca.tar.gz
external_libcxx-ebaf7dab14c3bf1c4f995d9ad1199b6c2784a8ca.tar.bz2
external_libcxx-ebaf7dab14c3bf1c4f995d9ad1199b6c2784a8ca.zip
Add _LIBCPP_DIAGNOSE_WARNING and _LIBCPP_DIAGNOSE_ERROR macros.
Clang recently added a `diagnose_if(cond, msg, type)` attribute which can be used to generate diagnostics when `cond` is a constant expression that evaluates to true. Otherwise no attribute has no effect. This patch adds _LIBCPP_DIAGNOSE_ERROR/WARNING macros which use this new attribute. Additionally this patch implements a diagnostic message when a non-const-callable comparator is given to a container. Note: For now the warning version of the diagnostic is useless within libc++ since warning diagnostics are suppressed by the system header pragma. I'm going to work on fixing this. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@291961 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/libcxx/utilities/tuple')
-rw-r--r--test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp b/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp
index a35dfd696..c18822bbe 100644
--- a/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp
+++ b/test/libcxx/utilities/tuple/tuple.tuple/diagnose_reference_binding.fail.cpp
@@ -30,4 +30,11 @@ int main() {
// bind rvalue to constructed non-rvalue
std::tuple<std::string &&> t2("hello"); // expected-note {{requested here}}
std::tuple<std::string &&> t3(std::allocator_arg, alloc, "hello"); // expected-note {{requested here}}
+
+ // FIXME: The below warnings may get emitted as an error, a warning, or not emitted at all
+ // depending on the flags used to compile this test.
+ {
+ // expected-warning@tuple:* 0+ {{binding reference member 'value' to a temporary value}}
+ // expected-error@tuple:* 0+ {{binding reference member 'value' to a temporary value}}
+ }
}