From: Richard Smith Date: Sun, 7 Jan 2018 22:03:44 +0000 (+0000) Subject: Add tests for three-way self- and array comparison. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=14e7dfb47e5e419c5415992caf7cf7514e970d1e;p=clang Add tests for three-way self- and array comparison. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321973 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/SemaCXX/compare-cxx2a.cpp b/test/SemaCXX/compare-cxx2a.cpp index 61d35021cc..d88e3bae41 100644 --- a/test/SemaCXX/compare-cxx2a.cpp +++ b/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};