diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-01-07 22:03:44 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2018-01-07 22:03:44 +0000 |
commit | 32f39731c234fb81fcdf630c3655368be0dfb08d (patch) | |
tree | 886bcd6f829597f70d4688b7dbf8875c87fcb695 /clang | |
parent | abbb8ada4536f88a36a01d1afb084452c269ea5a (diff) | |
download | bcm5719-llvm-32f39731c234fb81fcdf630c3655368be0dfb08d.tar.gz bcm5719-llvm-32f39731c234fb81fcdf630c3655368be0dfb08d.zip |
Add tests for three-way self- and array comparison.
llvm-svn: 321973
Diffstat (limited to 'clang')
-rw-r--r-- | clang/test/SemaCXX/compare-cxx2a.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/compare-cxx2a.cpp b/clang/test/SemaCXX/compare-cxx2a.cpp index 61d35021cc1..d88e3bae415 100644 --- a/clang/test/SemaCXX/compare-cxx2a.cpp +++ b/clang/test/SemaCXX/compare-cxx2a.cpp @@ -3,6 +3,14 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -pedantic -verify -Wsign-compare -std=c++2a %s +void self_compare() { + int a; + int b[3], c[3]; + (void)(a <=> a); // expected-warning {{self-comparison always evaluates to 'std::strong_ordering::equal'}} + (void)(b <=> b); // expected-warning {{self-comparison always evaluates to 'std::strong_ordering::equal'}} + (void)(b <=> c); // expected-warning {{array comparison always evaluates to a constant}} +} + void test0(long a, unsigned long b) { enum EnumA {A}; enum EnumB {B}; |