Home
last modified time | relevance | path

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

12345678910>>...20

/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() const { return val; } in operator int()
11 constexpr operator long() const { return 43; } in operator long()
16 constexpr A a = 42;
23 constexpr OK() {} in OK()
24 constexpr operator int() const { return 8; } in operator int()
25 } constexpr ok;
28 constexpr Explicit() {} in Explicit()
29 constexpr explicit operator int() const { 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()
28constexpr int mi1; // expected-error {{non-static data member cannot be constexpr; did you intend …
29 static constexpr int mi2; // expected-error {{requires an initializer}}
30 …mutable constexpr int mi3 = 3; // expected-error-re {{non-static data member cannot be constexpr{{…
[all …]
Dp3.cpp17 constexpr Literal() {} in Literal()
31 constexpr T();
32 constexpr int f() const;
35 …virtual constexpr int ExplicitlyVirtual() const { return 0; } // expected-error {{virtual function… in ExplicitlyVirtual()
37constexpr int ImplicitlyVirtual() const { return 0; } // expected-error {{virtual function cannot … in ImplicitlyVirtual()
39 …virtual constexpr int OutOfLineVirtual() const; // expected-error {{virtual function cannot be con…
42constexpr NonLiteral NonLiteralReturn() const { return {}; } // expected-error {{constexpr functio… in NonLiteralReturn()
43 constexpr void VoidReturn() const { return; } in VoidReturn()
47 constexpr ~T(); // expected-error {{destructor cannot be marked constexpr}}
49 constexpr F NonLiteralReturn2; // ok until definition
[all …]
Dp4.cpp17 constexpr Literal() {} in Literal()
25 constexpr S(int, N::C) {} in S()
26constexpr S(int, NonLiteral, N::C) {} // expected-error {{constexpr constructor's 2nd parameter ty… in S()
27constexpr S(int, NonLiteral = 42) {} // expected-error {{constexpr constructor's 2nd parameter typ… in S()
30 constexpr S() = default;
31 constexpr S(Literal) = delete;
38constexpr T() {} // expected-error {{constexpr constructor not allowed in struct with virtual base… in T()
45constexpr C() {} // expected-error {{constexpr constructor not allowed in class with virtual base … in C()
51 constexpr U() in U()
62 constexpr V() { in V()
[all …]
Dp5.cpp7 constexpr int f(void *) { return 0; } in f()
8 constexpr int f(...) { return 1; } in f()
9 constexpr int g1() { return f(0); } in g1()
10 constexpr int g2(int n) { return f(n); } in g2()
11 constexpr int g3(int n) { return f(n*0); } in g3()
14 constexpr int c = 5;
15 constexpr int h() { return c; } in h()
17 constexpr int c = 0;
18 constexpr int g4() { return N::h(); } in g4()
31 constexpr int f(bool b) in f()
[all …]
Dp6.cpp17 constexpr Literal() {} in Literal()
27 constexpr int ImplicitlyVirtual() const { 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() const { return 0; } in F()
37 constexpr int d = ConstexprMember<int>().F(); // ok
38 constexpr int e = ConstexprMember<NonLiteral>().F(); // expected-error {{constant expression}} expe…
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.cpp6 constexpr int f(); // expected-warning {{C++14}}
7 constexpr int g() const;
8 constexpr int h(); // expected-warning {{C++14}}
10 static constexpr int Sf();
11 /*static*/ constexpr void *operator new(size_t) noexcept;
12 template<typename T> constexpr T tm(); // expected-warning {{C++14}}
13 template<typename T> static constexpr T ts();
28 constexpr int S::f() const { return 0; } in f()
29 constexpr int S::g() { return 1; } // expected-warning {{C++14}} in g()
30 constexpr int S::h() { return 0; } // expected-warning {{C++14}} in h()
[all …]
/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() const { 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 …]
Dconstant-expression-cxx1y.cpp5 constexpr S(int);
11 constexpr int &get(int n) { return arr[n]; } in get()
12 constexpr const int &get(int n) const { return arr[n]; } in get()
20 constexpr int e() {{{{}} return 5; }} in e()
24 constexpr int f() { in f()
28 constexpr S(E e) : e(e) {} in f()
29 constexpr int get() { return e; } in f()
38 constexpr int g(int k) { in g()
45 constexpr int h(int n) { in h()
49 constexpr int i(int n) { in i()
[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 object outside its lif… 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 …]
Dbuiltin-assume-aligned.cpp4 constexpr int *p = 0;
6 constexpr int *k = (int *) __builtin_assume_aligned(p, 16, n = 5);
8 constexpr void *l = __builtin_assume_aligned(p, 16);
12 constexpr int *c = (int *) __builtin_assume_aligned(p, 16);
16 constexpr void *m = __builtin_assume_aligned(&n, 16);
20 constexpr void *q1 = __builtin_assume_aligned(&n, 4, 2);
23 constexpr void *q2 = __builtin_assume_aligned(&n, 4, -2);
24 constexpr void *q3 = __builtin_assume_aligned(&n, 4, 4);
25 constexpr void *q4 = __builtin_assume_aligned(&n, 4, -4);
30 constexpr void *r1 = __builtin_assume_aligned(&ar1[2], 16);
[all …]
/external/clang/test/CXX/basic/basic.types/
Dp10.cpp9 constexpr void f() {} in f()
15 constexpr int f1(double) { return 0; } in f1()
19 constexpr int f2(S &) { return 0; } in f2()
24 static constexpr BeingDefined& t = beingdefined;
34 constexpr Incomplete incomplete = {}; // expected-error {{constexpr variable cannot have non-litera…
35 constexpr Incomplete incomplete2[] = {}; // expected-error {{constexpr variable cannot have non-lit…
36 constexpr ClassTemp<int> classtemplate = {};
37 constexpr ClassTemp<int> classtemplate2[] = {};
43 constexpr int f(UserProvDtor) { return 0; } // expected-error {{'UserProvDtor' is not a literal typ… in f()
45 constexpr NonTrivDtor();
[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()
73 struct Test : Ts... { constexpr Test() : Ts()..., n(5) {} int n; }; in Test()
77 extern constexpr Test1 t1 = Test1();
[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.inhctor/
Dp2.cpp12 constexpr A(X<1>) {} in A()
14 explicit constexpr A(X<3>) {} // expected-note 2{{here}} in A()
19 constexpr A a0c { X<0>{} }; // expected-error {{must be initialized by a constant expression}} expe…
20 constexpr A a0ic = { X<0>{} }; // expected-error {{must be initialized by a constant expression}} e…
24 constexpr A a1c { X<1>{} };
25 constexpr A a1ic = { X<1>{} };
29 constexpr A a2c { X<2>{} }; // expected-error {{must be initialized by a constant expression}} expe…
30 constexpr A a2ic = { X<2>{} }; // expected-error {{constructor is explicit}}
34 constexpr A a3c { X<3>{} };
35 constexpr A a3ic = { X<3>{} }; // expected-error {{constructor is explicit}}
[all …]
/external/libcxx/test/std/experimental/utilities/tuple/tuple.apply/
Dconstexpr_types.pass.cpp27 constexpr int f_int_0() { return 1; } in f_int_0()
28 constexpr int f_int_1(int x) { return x; } in f_int_1()
29 constexpr int f_int_2(int x, int y) { return (x + y); } in f_int_2()
33 constexpr A_int_0() {} in A_int_0()
34 constexpr int operator()() const { return 1; } in operator ()()
39 constexpr A_int_1() {} in A_int_1()
40 constexpr int operator()(int x) const { return x; } in operator ()()
45 constexpr A_int_2() {} in A_int_2()
46 constexpr int operator()(int x, int y) const { return (x + y); } in operator ()()
56 constexpr Tuple t{}; in test_0()
[all …]
/external/clang/test/CXX/drs/
Ddr14xx.cpp16 constexpr A() {} in A()
18 constexpr A a = A();
23 constexpr B() = default;
25 constexpr B b = B();
31 constexpr C c = C();
33 constexpr void f() { C c; } in f()
46 friend constexpr A::A() noexcept;
47 friend constexpr B::B() noexcept; // expected-error {{follows non-constexpr declaration}}
48 friend constexpr C::C() noexcept;
49 friend constexpr D::D() noexcept;
[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/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 …]
/external/libcxx/include/experimental/
Doptional26 constexpr in_place_t in_place{};
30 constexpr nullopt_t nullopt(unspecified);
37 constexpr bool operator==(const optional<T>&, const optional<T>&);
39 constexpr bool operator!=(const optional<T>&, const optional<T>&);
41 constexpr bool operator<(const optional<T>&, const optional<T>&);
43 constexpr bool operator>(const optional<T>&, const optional<T>&);
45 constexpr bool operator<=(const optional<T>&, const optional<T>&);
47 constexpr bool operator>=(const optional<T>&, const optional<T>&);
50 template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
51 template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;
[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&) const = default; // expected-error {{explicitly-defaulted copy …
10constexpr S1 &operator=(S1&&) const = default; // expected-error {{explicitly-defaulted move assig…
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/Modules/
Dredecl-add-after-load.cpp12 extern constexpr int function();
13 constexpr int test(bool b) { return b ? variable : function(); } in test()
18 extern constexpr int function();
21 constexpr int N_test(bool b) { return b ? N::variable : N::function(); } in N_test()
25 constexpr int C_test(bool b) { return b ? C::variable : C::function(); } in C_test()
30 static constexpr int function();
33 constexpr int D_test(bool b) { return b ? D::variable : D::function(); } in D_test()
39 constexpr int tu_variable_test = test(true);
40 constexpr int tu_function_test = test(false);
43 constexpr int ns_variable_test = N_test(true);
[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 …]

12345678910>>...20