File: p1.cpp

package info (click to toggle)
llvm-toolchain-6.0 1%3A6.0.1-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 598,080 kB
  • sloc: cpp: 3,046,253; ansic: 595,057; asm: 271,965; python: 128,926; objc: 106,554; sh: 21,906; lisp: 10,191; pascal: 6,094; ml: 5,544; perl: 5,265; makefile: 2,227; cs: 2,027; xml: 686; php: 212; csh: 117
file content (60 lines) | stat: -rw-r--r-- 3,847 bytes parent folder | download | duplicates (8)
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
55
56
57
58
59
60
// RUN:  %clang_cc1 -std=c++14 -fconcepts-ts -fcxx-exceptions -x c++ -verify %s

namespace A {
  template<typename T> concept bool C1() { return true; }

  template<typename T> concept bool C2 = true;
}

template<typename T> concept bool C3() { return (throw 0, true); }
static_assert(noexcept(C3<int>()), "function concept should be treated as if noexcept(true) specified");

template<typename T> concept bool D1(); // expected-error {{function concept declaration must be a definition}}

struct B {
  template<typename T> concept bool D2() { return true; } // expected-error {{concept declarations may only appear in namespace scope}}
};

struct C {
  template<typename T> static concept bool D3 = true; // expected-error {{concept declarations may only appear in namespace scope}}
};

concept bool D4() { return true; } // expected-error {{'concept' can only appear on the definition of a function template or variable template}}

concept bool D5 = true; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}

template<typename T>
concept bool D6; // expected-error {{variable concept declaration must be initialized}}

template<typename T>
concept bool D7() throw(int) { return true; } // expected-error {{function concept cannot have exception specification}}

// Tag
concept class CC1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
concept struct CS1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
concept union CU1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
concept enum CE1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
template <typename T> concept class TCC1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
template <typename T> concept struct TCS1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
template <typename T> concept union TCU1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
typedef concept int CI; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
void fpc(concept int i) {} // expected-error {{'concept' can only appear on the definition of a function template or variable template}}

concept bool; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}

template <typename T> concept bool VCEI{ true };
template concept bool VCEI<int>; // expected-error {{'concept' cannot be applied on an explicit instantiation}}
extern template concept bool VCEI<int>; // expected-error {{'concept' cannot be applied on an explicit instantiation}}

template <typename T> concept bool VCPS{ true };
template <typename T> concept bool VCPS<T *>{ true }; // expected-error {{'concept' cannot be applied on an partial specialization}}

template <typename T> concept bool VCES{ true };
template <> concept bool VCES<int>{ true }; // expected-error {{'concept' cannot be applied on an explicit specialization}}

template <typename T> concept bool FCEI() { return true; }
template concept bool FCEI<int>(); // expected-error {{'concept' cannot be applied on an explicit instantiation}}
extern template concept bool FCEI<int>(); // expected-error {{'concept' cannot be applied on an explicit instantiation}}

template <typename T> concept bool FCES() { return true; }
template <> concept bool FCES<bool>() { return true; } // expected-error {{'concept' cannot be applied on an explicit specialization}}