File: compare-modules-cxx2a.cpp

package info (click to toggle)
llvm-toolchain-11 1%3A11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 995,808 kB
  • sloc: cpp: 4,767,656; ansic: 760,916; asm: 477,436; python: 170,940; objc: 69,804; lisp: 29,914; sh: 23,855; f90: 18,173; pascal: 7,551; perl: 7,471; ml: 5,603; awk: 3,489; makefile: 2,573; xml: 915; cs: 573; fortran: 503; javascript: 452
file content (54 lines) | stat: -rw-r--r-- 1,500 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// RUN: %clang_cc1 -triple x86_64-apple-darwin -fcxx-exceptions -verify -std=c++2a -fmodules -I%S/Inputs %s -fno-modules-error-recovery

#pragma clang module build compare
module compare {
  explicit module cmp {}
  explicit module other {}
}
#pragma clang module contents
#pragma clang module begin compare.cmp
#include "std-compare.h"
#pragma clang module end
#pragma clang module endbuild

struct CC { CC(...); };

void a() { void(0 <=> 0); } // expected-error {{include <compare>}}

struct A {
  CC operator<=>(const A&) const = default; // expected-error {{include <compare>}}
};
auto va = A() <=> A(); // expected-note {{required here}}

#pragma clang module import compare.other

// expected-note@std-compare.h:* 2+{{not reachable}}

void b() { void(0 <=> 0); } // expected-error 1+{{missing '#include "std-compare.h"'; 'strong_ordering' must be defined}}

struct B {
  CC operator<=>(const B&) const = default; // expected-error 1+{{missing '#include "std-compare.h"'; 'strong_ordering' must be defined}}
};
auto vb = B() <=> B(); // expected-note {{required here}}

#pragma clang module import compare.cmp

void c() { void(0 <=> 0); }

struct C {
  CC operator<=>(const C&) const = default;
};
auto vc = C() <=> C();


#pragma clang module build compare2
module compare2 {}
#pragma clang module contents
#pragma clang module begin compare2
#include "std-compare.h"
#pragma clang module end
#pragma clang module endbuild

#pragma clang module import compare2

void g() { void(0.0 <=> 0.0); }