r321973 - Add tests for three-way self- and array comparison.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 7 14:03:44 PST 2018
Author: rsmith
Date: Sun Jan 7 14:03:44 2018
New Revision: 321973
URL: http://llvm.org/viewvc/llvm-project?rev=321973&view=rev
Log:
Add tests for three-way self- and array comparison.
Modified:
cfe/trunk/test/SemaCXX/compare-cxx2a.cpp
Modified: cfe/trunk/test/SemaCXX/compare-cxx2a.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/compare-cxx2a.cpp?rev=321973&r1=321972&r2=321973&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/compare-cxx2a.cpp (original)
+++ cfe/trunk/test/SemaCXX/compare-cxx2a.cpp Sun Jan 7 14:03:44 2018
@@ -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};
More information about the cfe-commits
mailing list