Home
last modified time | relevance | path

Searched refs:constexpr (Results 1 – 25 of 79) sorted by relevance

1234

/external/clang/test/CXX/expr/expr.const/
Dp2-0x.cpp28 constexpr NonConstexpr2(); // expected-note {{here}}
46 constexpr UndefinedConstexpr();
47 static constexpr int undefinedConstexpr1(); // expected-note {{here}}
55 static constexpr const int &id_ref(const int &n) { in id_ref()
61 constexpr const int *address_of(const int &a) { in address_of()
64 constexpr const int *return_param(int n) { // expected-note {{declared here}} in return_param()
78 constexpr T(const int &r) : in T()
83 constexpr int n = 0;
84 constexpr T t1(n); // ok
85constexpr T t2(0); // expected-error {{must be initialized by a constant expression}} expected-not…
[all …]
Dp5-0x.cpp9 constexpr A(int i) : val(i) { } in A()
10 constexpr operator int() { return val; } in operator int()
11 constexpr operator long() { return 43; } in operator long()
16 constexpr A a = 42;
23 constexpr OK() {} in OK()
24 constexpr operator int() { return 8; } in operator int()
25 } constexpr ok;
28 constexpr Explicit() {} in Explicit()
29 constexpr explicit operator int() { return 4; } // expected-note 4{{here}} in operator int()
30 } constexpr expl;
[all …]
/external/clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/
Dp1.cpp11 constexpr int i1 = 0;
12 constexpr int f1() { return 0; } in f1()
14 constexpr static int mi1 = 0;
17 constexpr int s1::mi2 = 0;
21 constexpr extern int i2; // expected-error {{constexpr variable declaration must be a definition}}
23 constexpr notlit nl1; // expected-error {{constexpr variable cannot have non-literal type 'const no…
25 void f2(constexpr int i) {} // expected-error {{function parameter cannot be constexpr}} in f2()
28 constexpr int mi1; // expected-error {{non-static data member cannot be constexpr}}
29 static constexpr int mi2; // expected-error {{requires an initializer}}
32 typedef constexpr int CI; // expected-error {{typedef cannot be constexpr}}
[all …]
Dp4.cpp16 constexpr Literal() {} in Literal()
24 constexpr S(int, N::C) {} in S()
25constexpr S(int, NonLiteral, N::C) {} // expected-error {{constexpr constructor's 2nd parameter ty… in S()
26constexpr S(int, NonLiteral = 42) {} // expected-error {{constexpr constructor's 2nd parameter typ… in S()
29 constexpr S() = default;
30 constexpr S(Literal) = delete;
37constexpr T() {} // expected-error {{constexpr constructor not allowed in struct with virtual base… in T()
44constexpr C() {} // expected-error {{constexpr constructor not allowed in class with virtual base … in C()
50 constexpr U() in U()
61 constexpr V() { in V()
[all …]
Dp3.cpp16 constexpr Literal() {} in Literal()
30 constexpr T();
31 constexpr int f(); // expected-error {{non-literal type 'T' cannot have constexpr members}}
34 …virtual constexpr int ExplicitlyVirtual() { return 0; } // expected-error {{virtual function canno… in ExplicitlyVirtual()
36constexpr int ImplicitlyVirtual() { return 0; } // expected-error {{virtual function cannot be con… in ImplicitlyVirtual()
39constexpr NonLiteral NonLiteralReturn() { return {}; } // expected-error {{constexpr function's re… in NonLiteralReturn()
40constexpr void VoidReturn() { return; } // expected-error {{constexpr function's return type 'void… in VoidReturn()
41 constexpr ~T(); // expected-error {{destructor cannot be marked constexpr}}
43 constexpr F NonLiteralReturn2; // ok until definition
46constexpr int NonLiteralParam(NonLiteral) { return 0; } // expected-error {{constexpr function's 1… in NonLiteralParam()
[all …]
Dp5.cpp6 constexpr int f(void *) { return 0; } in f()
7 constexpr int f(...) { return 1; } in f()
8 constexpr int g1() { return f(0); } in g1()
9 constexpr int g2(int n) { return f(n); } in g2()
10 constexpr int g3(int n) { return f(n*0); } in g3()
13 constexpr int c = 5;
14 constexpr int h() { return c; } in h()
16 constexpr int c = 0;
17 constexpr int g4() { return N::h(); } in g4()
30 constexpr int f(bool b) in f()
[all …]
Dp6.cpp17 constexpr Literal() {} in Literal()
27 constexpr int ImplicitlyVirtual() { return 0; } in ImplicitlyVirtual()
30 constexpr int a = ImplicitVirtualFromDependentBase<S>().ImplicitlyVirtual(); // expected-error {{co…
31 constexpr int b = ImplicitVirtualFromDependentBase<T>().ImplicitlyVirtual(); // ok
32 constexpr int c = ImplicitVirtualFromDependentBase<S>().ImplicitVirtualFromDependentBase<S>::Implic…
35 constexpr R F() { return 0; } in F()
37 constexpr int d = ConstexprMember<int>().F(); // ok
38 constexpr int e = ConstexprMember<NonLiteral>().F(); // expected-error {{constant expression}}
41 constexpr ConstexprCtor(P...) {} in ConstexprCtor()
43 constexpr ConstexprCtor<> f1() { return {}; } // ok in f1()
[all …]
Dp9.cpp5 constexpr int a = 0;
9 constexpr int *b = &i;
12 constexpr int &c = i;
15 constexpr int (*d)(int) = 0;
20 constexpr int ni1; // expected-error {{default initialization of an object of const type 'const int…
21 constexpr struct C { C(); } ni2; // expected-error {{cannot have non-literal type 'const struct C'}…
22 constexpr double &ni3; // expected-error {{declaration of reference variable 'ni3' requires an init…
24 constexpr int nc1 = i; // expected-error {{constexpr variable 'nc1' must be initialized by a consta…
25 constexpr C nc2 = C(); // expected-error {{cannot have non-literal type 'const C'}}
27 constexpr int &nc3 = f(); // expected-error {{constexpr variable 'nc3' must be initialized by a con…
[all …]
Dp8.cpp4 constexpr int f();
5 constexpr int g() const;
6 static constexpr int Sf();
22constexpr bool is_on(); // expected-error {{non-literal type 'std_example::debug_flag' cannot have…
27 constexpr int bar(int x, int y) // expected-note {{here}} in bar()
37 static constexpr bool isDebugFlag();
/external/clang/test/SemaCXX/
Dconstant-expression-cxx11.cpp13 template<typename T> constexpr T id(const T &t) { return t; } in id()
14 template<typename T> constexpr T min(const T &a, const T &b) { in min()
17 template<typename T> constexpr T max(const T &a, const T &b) { in max()
20 template<typename T, size_t N> constexpr T *begin(T (&xs)[N]) { return xs; } in begin()
21 template<typename T, size_t N> constexpr T *end(T (&xs)[N]) { return xs + N; } in end()
24 constexpr int zero() { return 0; } in zero()
38 constexpr B *p = &d;
39 constexpr C *q = &d;
45 constexpr B &pp = d;
46 constexpr C &qq = d;
[all …]
Dconstexpr-printing.cpp4 constexpr int extract(const S &s);
7 constexpr S() : n(extract(*this)), m(0) {} // expected-note {{in call to 'extract(s1)'}} in S()
8 constexpr S(int k) : n(k), m(extract(*this)) {} in S()
12 constexpr int extract(const S &s) { return s.n; } // expected-note {{read of uninitialized object i… in extract()
14 constexpr S s1; // ok
16 constexpr S s1; // expected-error {{constant expression}} expected-note {{in call to 'S()'}} in f()
17 constexpr S s2(10); in f()
23 constexpr T() : arr() {} in T()
27 constexpr U(const int *p) : T(), another(), p(p) {} in U()
28 constexpr U(const U &u) : T(), another(), p(u.p) {} in U()
[all …]
Dconstexpr-nqueens.cpp9 constexpr Board() : State(0), Failed(false) {} in Board()
10 constexpr Board(const Board &O) : State(O.State), Failed(O.Failed) {} in Board()
11 constexpr Board(uint64_t State, bool Failed = false) : in Board()
13 constexpr Board addQueen(int Row, int Col) { in addQueen()
16 constexpr int getQueenRow(int Col) { in getQueenRow()
19 constexpr bool ok(int Row, int Col) { in ok()
22 constexpr bool okRecurse(int Row, int Col, int CheckCol) { in okRecurse()
29 constexpr bool at(int Row, int Col) { in at()
32 constexpr bool check(const char *, int=0, int=0);
35 constexpr Board buildBoardRecurse(int N, int Col, const Board &B);
[all …]
Ddiscrim-union.cpp7 template<typename T> constexpr T &&forward(typename remove_reference<T>::type &t) noexcept { return… in forward()
8 template<typename T> constexpr T &&forward(typename remove_reference<T>::type &&t) noexcept { retur… in forward()
9 template<typename T> constexpr typename remove_reference<T>::type &&move(T &&t) noexcept { return s… in move()
31 constexpr either_impl(select<0>, T &&t) : val(move(t)) {} in either_impl()
34 constexpr either_impl(select<N>, U &&u) : rest(select<N-1>(), move(u)) {} in either_impl()
36 constexpr static unsigned index(type<T>) { return 0; } in index()
38 constexpr static unsigned index(type<U> t) { in index()
49 constexpr const T &get(select<0>) { return val; } in get()
50 …template<unsigned N> constexpr const decltype(static_cast<const rest_t&>(rest).get(select<N-1>{}))… in get()
60 constexpr a(U &&...u) : value{forward<U>(u)...} {} in a()
[all …]
Dconstexpr-value-init.cpp4 constexpr A() : a(b + 1), b(a + 1) {} // expected-note {{uninitialized}} in A()
12 constexpr A a; // ok, zero initialization preceeds static initialization
14 constexpr A a; // expected-error {{constant expression}} expected-note {{in call to 'A()'}} in f()
17 constexpr B b1; // expected-error {{requires a user-provided default constructor}}
18 constexpr B b2 = B(); // ok
26 constexpr C c1; // expected-error {{requires a user-provided default constructor}}
27 constexpr C c2 = C(); // ok
28 constexpr D d1; // expected-error {{requires a user-provided default constructor}}
29 constexpr D d2 = D(); // ok with DR1452
35 constexpr Z() : V() {} in Z()
[all …]
Dcxx11-user-defined-literals.cpp9 constexpr LitKind operator"" _kind(char p) { return LitKind::Char; } in operator ""_kind()
10 constexpr LitKind operator"" _kind(wchar_t p) { return LitKind::WideChar; } in operator ""_kind()
11 constexpr LitKind operator"" _kind(char16_t p) { return LitKind::Char16; } in operator ""_kind()
12 constexpr LitKind operator"" _kind(char32_t p) { return LitKind::Char32; } in operator ""_kind()
13 constexpr LitKind operator"" _kind(const char *p, size_t n) { return LitKind::CharStr; } in operator ""_kind()
14 constexpr LitKind operator"" _kind(const wchar_t *p, size_t n) { return LitKind::WideStr; } in operator ""_kind()
15 constexpr LitKind operator"" _kind(const char16_t *p, size_t n) { return LitKind::Char16Str; } in operator ""_kind()
16 constexpr LitKind operator"" _kind(const char32_t *p, size_t n) { return LitKind::Char32Str; } in operator ""_kind()
17 constexpr LitKind operator"" _kind(unsigned long long n) { return LitKind::Integer; } in operator ""_kind()
18 constexpr LitKind operator"" _kind(long double n) { return LitKind::Floating; } in operator ""_kind()
[all …]
Dconstexpr-turing.cpp17 constexpr Tape() : l(0), val(false), r(0) {} in Tape()
18 constexpr Tape(const Tape &old, bool write) : in Tape()
20 constexpr Tape(const Tape &old, Dir dir) : in Tape()
29 constexpr Tape update(const Tape &old, bool write) { return Tape(old, write); } in update()
30 constexpr Tape move(const Tape &old, Dir dir) { return Tape(old, dir); } in move()
34 constexpr unsigned run(const State *tm, const Tape &tape, unsigned state) { in run()
42 constexpr State bb3[] = {
50 constexpr State bb4[] = {
/external/clang/test/CXX/basic/basic.types/
Dp10.cpp8 constexpr int f1(double) { return 0; } in f1()
12 constexpr int f2(S &) { return 0; } in f2()
18 static constexpr BeingDefined& t = beingdefined;
28 constexpr Incomplete incomplete = {}; // expected-error {{constexpr variable cannot have non-litera…
29 constexpr Incomplete incomplete2[] = {}; // expected-error {{constexpr variable cannot have non-lit…
30 constexpr ClassTemp<int> classtemplate = {};
31 constexpr ClassTemp<int> classtemplate2[] = {};
35constexpr int f(); // expected-error {{non-literal type 'UserProvDtor' cannot have constexpr membe…
40 constexpr NonTrivDtor();
41constexpr int f(); // expected-error {{non-literal type 'NonTrivDtor' cannot have constexpr member…
[all …]
/external/clang/test/CodeGenCXX/
Dconst-init-cxx11.cpp9 constexpr U(int x) : x(x) {} in U()
10 constexpr U(const char *y) : y(y) {} in U()
15 constexpr A(int n, double d, int x) : n(n), d(d), u(x) {} in A()
16 constexpr A(int n, double d, const char *y) : n(n), d(d), u(y) {} in A()
20 extern constexpr A a(1, 2.0, 3);
23 extern constexpr A b(4, 5, "hello");
38 constexpr C() : c(0) {} in C()
46 constexpr D() : d(5) {} in D()
62 struct Test : Ts... { constexpr Test() : Ts()..., n(5) {} int n; }; in Test()
66 extern constexpr Test1 t1 = Test1();
[all …]
/external/clang/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/
Dp2.cpp6constexpr S1() = default; // expected-error {{defaulted definition of default constructor is not c…
7 constexpr S1(const S1&) = default;
8 constexpr S1(S1&&) = default;
9constexpr S1 &operator=(const S1&) = default; // expected-error {{explicitly-defaulted copy assign…
10constexpr S1 &operator=(S1&&) = default; // expected-error {{explicitly-defaulted move assignment …
11 constexpr ~S1() = default; // expected-error {{destructor cannot be marked constexpr}}
15 constexpr NoCopyMove() {} in NoCopyMove()
20 constexpr S2() = default;
21constexpr S2(const S2&) = default; // expected-error {{defaulted definition of copy constructor is…
22constexpr S2(S2&&) = default; // expected-error {{defaulted definition of move constructor is not …
[all …]
/external/clang/test/CXX/special/class.copy/
Dp13-0x.cpp6 constexpr Constexpr1() : n(0) {} in Constexpr1()
9 constexpr Constexpr1 c1a = Constexpr1(Constexpr1()); // ok
10 constexpr Constexpr1 c1b = Constexpr1(Constexpr1(c1a)); // ok
14 constexpr Constexpr2() = default;
15 constexpr Constexpr2(const Constexpr2 &o) : ce1(o.ce1) {} in Constexpr2()
19 constexpr Constexpr2 c2a = Constexpr2(Constexpr2()); // ok
20 constexpr Constexpr2 c2b = Constexpr2(Constexpr2(c2a)); // ok
27 constexpr Constexpr3 c3a = Constexpr3(Constexpr3()); // ok
28 constexpr Constexpr3 c3b = Constexpr3(Constexpr3(c3a)); // ok
31 constexpr NonConstexprCopy() = default;
[all …]
/external/clang/test/CXX/special/class.ctor/
Dp6-0x.cpp12 constexpr NonConstexpr1 nc1 = NonConstexpr1(); // ok, does not call constructor
13 constexpr NonConstexpr2 nc2 = NonConstexpr2(); // ok, does not call constructor
14 constexpr NonConstexpr2a nc2a = NonConstexpr2a(); // ok, does not call constructor
15 constexpr int nc2_a = NonConstexpr2().nl.a; // ok
16 constexpr int nc2a_a = NonConstexpr2a().a; // ok
18 …friend constexpr NonConstexpr1::NonConstexpr1(); // expected-error {{follows non-constexpr declara…
19 …friend constexpr NonConstexpr2::NonConstexpr2(); // expected-error {{follows non-constexpr declara…
23 constexpr Constexpr1 c1 = Constexpr1(); // ok
25 constexpr NonConstexpr3 nc3 = NonConstexpr3(); // expected-error {{non-literal type 'const NonConst…
30 constexpr Constexpr2 c2 = Constexpr2(); // ok
[all …]
/external/clang/test/CXX/class/class.static/class.static.data/
Dp3.cpp8 static constexpr int a = 0;
9 …static constexpr int b; // expected-error {{declaration of constexpr static data member 'b' requir…
11 static constexpr int c = 0;
15 static constexpr double e = 0.0; // ok
21 constexpr int S::a;
22 constexpr int S::b = 0;
25 constexpr int S::d = 0;
26 constexpr int S::d2;
30 static constexpr int a = 0;
31 …static constexpr int b; // expected-error {{declaration of constexpr static data member 'b' requir…
[all …]
/external/clang/test/SemaTemplate/
Dconstexpr-instantiate.cpp5 template<typename T> static constexpr T get() { return T(); } in get()
11 constexpr int j = A::get<int>();
13 template<typename T> constexpr int consume(T);
17 template<typename T> constexpr int consume(T) { return 0; } in consume()
19 constexpr int l = consume(0);
21constexpr int m = k; // expected-error {{constant expression}} expected-note {{initializer of 'k'}}
25 template<typename T> constexpr T f(T n) { return n; } in f()
36 template<typename T> constexpr T f(T n) { return n; } in f()
46 template<typename T> constexpr T f(T t) { return t; } in f()
65 constexpr int m = S<int>::k; // ok
[all …]
Dinstantiate-self.cpp20 friend constexpr int operator+(int, C) { return 4; } in operator +()
55 constexpr T f(T k) { return g(k); }
56 constexpr T g(T k) {
61 constexpr int x = A<int>().f(5);
65 template<typename T> constexpr T f(T);
66 template<typename T> constexpr T g(T t) {
70 template<typename T> constexpr T f(T t) {
79 template<typename T> constexpr T g(T t) {
82 template<typename T> constexpr T f(T t) {
/external/clang/test/Parser/
Dcxx11-user-defined-literals.cpp41 constexpr char operator"" _id(char c) { return c; } in operator ""_id()
42 constexpr wchar_t operator"" _id(wchar_t c) { return c; } in operator ""_id()
43 constexpr char16_t operator"" _id(char16_t c) { return c; } in operator ""_id()
44 constexpr char32_t operator"" _id(char32_t c) { return c; } in operator ""_id()
47 constexpr const char operator"" _id(const char *p, size_t n) { return *p; } in operator ""_id()
48 constexpr const wchar_t operator"" _id(const wchar_t *p, size_t n) { return *p; } in operator ""_id()
49 constexpr const char16_t operator"" _id(const char16_t *p, size_t n) { return *p; } in operator ""_id()
50 constexpr const char32_t operator"" _id(const char32_t *p, size_t n) { return *p; } in operator ""_id()
52 constexpr unsigned long long operator"" _id(unsigned long long n) { return n; } in operator ""_id()
53 constexpr long double operator"" _id(long double d) { return d; } in operator ""_id()

1234