File: p2.cpp

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-11
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,418,840 kB
  • sloc: cpp: 5,290,826; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,898; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,913; xml: 953; cs: 573; fortran: 539
file content (16 lines) | stat: -rw-r--r-- 718 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// RUN: %clang_cc1 -std=c++2a -verify %s

namespace PR44761 {
  template<typename T> concept X = (sizeof(T) == sizeof(T));

  template<typename T> struct A {
    bool operator<(const A&) const & requires X<T>; // #1
    int operator<=>(const A&) const & requires X<T> && X<int> = delete; // #2
  };
  bool k1 = A<int>() < A<int>(); // not ordered by constraints: prefer non-rewritten form
  bool k2 = A<float>() < A<float>(); // prefer more-constrained 'operator<=>'
  // expected-error@-1 {{deleted}}
  // expected-note@#1 {{candidate}}
  // expected-note@#2 {{candidate function has been explicitly deleted}}
  // expected-note@#2 {{candidate function (with reversed parameter order) has been explicitly deleted}}
}