HomeSort by relevance Sort by last modified time
    Searched full:constexpr (Results 1 - 25 of 214) sorted by null

1 2 3 4 5 6 7 8 9

  /external/clang/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/
p1.cpp 11 constexpr int i1 = 0;
12 constexpr int f1() { return 0; }
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 notlit'}}
25 void f2(constexpr int i) {} // expected-error {{function parameter cannot be constexpr}}
41 class C2 {} constexpr; \/\/ expected-error {{class cannot be marked constexpr}} variable in typeref:class:C2
42 struct S2 {} constexpr; \/\/ expected-error {{struct cannot be marked constexpr}} variable in typeref:struct:S2
43 union U2 {} constexpr; \/\/ expected-error {{union cannot be marked constexpr}} variable in typeref:union:U2
44 enum E2 {} constexpr; \/\/ expected-error {{enum cannot be marked constexpr}} variable in typeref:enum:E2
    [all...]
p6.cpp 17 constexpr Literal() {}
27 constexpr int ImplicitlyVirtual() { return 0; }
30 constexpr int a = ImplicitVirtualFromDependentBase<S>().ImplicitlyVirtual(); // expected-error {{constant expression}} expected-note {{cannot evaluate virtual function call}}
31 constexpr int b = ImplicitVirtualFromDependentBase<T>().ImplicitlyVirtual(); // ok
32 constexpr int c = ImplicitVirtualFromDependentBase<S>().ImplicitVirtualFromDependentBase<S>::ImplicitlyVirtual();
35 constexpr R F() { return 0; }
37 constexpr int d = ConstexprMember<int>().F(); // ok
38 constexpr int e = ConstexprMember<NonLiteral>().F(); // expected-error {{constant expression}}
41 constexpr ConstexprCtor(P...) {}
43 constexpr ConstexprCtor<> f1() { return {}; } // o
    [all...]
p2.cpp 3 // constexpr functions and constexpr constructors are implicitly inline.
5 constexpr S(int n);
6 constexpr int g();
10 constexpr S::S(int n) : n(n) {}
12 constexpr S f(S s) {
16 constexpr int S::g() {
p9.cpp 3 // A constexpr specifier used in an object declaration declares the object as
5 constexpr int a = 0;
9 constexpr int *b = &i;
12 constexpr int &c = i;
15 constexpr int (*d)(int) = 0;
18 // A variable declaration which uses the constexpr specifier shall have an
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'}} expected-note 3{{has no constexpr constructors}}
22 constexpr double &ni3; // expected-error {{declaration of reference variable 'ni3' requires an initializer}
    [all...]
p4.cpp 11 struct NonLiteral { // expected-note 2{{no constexpr constructors}}
16 constexpr Literal() {}
21 // In the definition of a constexpr constructor, each of the parameter types
24 constexpr S(int, N::C) {}
25 constexpr S(int, NonLiteral, N::C) {} // expected-error {{constexpr constructor's 2nd parameter type 'NonLiteral' is not a literal type}}
26 constexpr S(int, NonLiteral = 42) {} // expected-error {{constexpr constructor's 2nd parameter type 'NonLiteral' is not a literal type}}
29 constexpr S() = default;
30 constexpr S(Literal) = delete
    [all...]
p3.cpp 11 struct NonLiteral { // expected-note 2{{no constexpr constructors}}
16 constexpr Literal() {}
27 // The definition of a constexpr function shall satisfy the following
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 cannot be constexpr}}
36 constexpr int ImplicitlyVirtual() { return 0; } // expected-error {{virtual function cannot be constexpr}}
    [all...]
p8.cpp 4 constexpr int f();
5 constexpr int g() const;
6 static constexpr int Sf();
19 class debug_flag { // expected-note {{not an aggregate and has no constexpr constructors}}
22 constexpr bool is_on(); // expected-error {{non-literal type 'std_example::debug_flag' cannot have constexpr members}}
27 constexpr int bar(int x, int y) // expected-note {{here}}
29 int bar(int x, int y) // expected-error {{non-constexpr declaration of 'bar' follows constexpr declaration}}
34 // The constexpr specifier is allowed for static member functions of non-literal types
    [all...]
p5.cpp 2 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -fcxx-exceptions -Wno-invalid-constexpr %s
6 constexpr int f(void *) { return 0; }
7 constexpr int f(...) { return 1; }
8 constexpr int g1() { return f(0); }
9 constexpr int g2(int n) { return f(n); }
10 constexpr int g3(int n) { return f(n*0); }
13 constexpr int c = 5;
14 constexpr int h() { return c; }
16 constexpr int c = 0;
17 constexpr int g4() { return N::h();
    [all...]
  /external/clang/test/CXX/special/class.copy/
p13-0x.cpp 4 // constexpr constructor, the implicitly-defined constructor is constexpr.
6 constexpr Constexpr1() : n(0) {}
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) {}
19 constexpr Constexpr2 c2a = Constexpr2(Constexpr2()); // ok
20 constexpr Constexpr2 c2b = Constexpr2(Constexpr2(c2a)); // ok
24 // all special constructors are constexpr, move ctor calls ce2's copy cto
    [all...]
  /external/clang/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/
p2.cpp 3 // An explicitly-defaulted function may be declared constexpr only if it would
4 // have been implicitly declared as constexpr.
6 constexpr S1() = default; // expected-error {{defaulted definition of default constructor is not constexpr}}
7 constexpr S1(const S1&) = default;
8 constexpr S1(S1&&) = default;
9 constexpr S1 &operator=(const S1&) = default; // expected-error {{explicitly-defaulted copy assignment operator may not have}}
10 constexpr S1 &operator=(S1&&) = default; // expected-error {{explicitly-defaulted move assignment operator may not have}}
11 constexpr ~S1() = default; // expected-error {{destructor cannot be marked constexpr}}
    [all...]
  /external/clang/test/CXX/special/class.ctor/
p6-0x.cpp 3 // Implicitly-defined default constructors are constexpr if the implicit
12 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 declaration}}
19 friend constexpr NonConstexpr2::NonConstexpr2(); // expected-error {{follows non-constexpr declaration}
    [all...]
  /external/clang/test/CXX/class/class.static/class.static.data/
p3.cpp 3 struct NonLit { // expected-note 3{{no constexpr constructors}}
8 static constexpr int a = 0;
9 static constexpr int b; // expected-error {{declaration of constexpr static data member 'b' requires an initializer}}
11 static constexpr int c = 0;
15 static constexpr double e = 0.0; // ok
16 static const double f = 0.0; // expected-warning {{extension}} expected-note {{use 'constexpr' specifier}}
17 static char *const g = 0; // expected-error {{requires 'constexpr' specifier}}
21 constexpr int S::a;
22 constexpr int S::b = 0
    [all...]
  /external/clang/test/CXX/basic/basic.types/
p10.cpp 8 constexpr int f1(double) { return 0; }
12 constexpr int f2(S &) { return 0; }
18 static constexpr BeingDefined& t = beingdefined;
28 constexpr Incomplete incomplete = {}; // expected-error {{constexpr variable cannot have non-literal type 'const Incomplete'}}
29 constexpr Incomplete incomplete2[] = {}; // expected-error {{constexpr variable cannot have non-literal type 'Incomplete const[]'}}
30 constexpr ClassTemp<int> classtemplate = {};
31 constexpr ClassTemp<int> classtemplate2[] = {};
35 constexpr int f(); // expected-error {{non-literal type 'UserProvDtor' cannot have constexpr members}
    [all...]
  /external/clang/test/CXX/dcl.dcl/
p4-0x.cpp 4 constexpr S(bool b) : b(b) {}
5 constexpr explicit operator bool() { return b; }
9 constexpr operator int() { return 1; }
12 constexpr operator int() { return 1; } // expected-note {{candidate}}
13 constexpr operator long() { return 0; } // expected-note {{candidate}}
  /external/clang/test/SemaCXX/
constexpr-value-init.cpp 4 constexpr A() : a(b + 1), b(a + 1) {} // expected-note {{uninitialized}}
12 constexpr A a; // ok, zero initialization preceeds static initialization
14 constexpr A a; // expected-error {{constant expression}} expected-note {{in call to 'A()'}}
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() {
    [all...]
constexpr-printing.cpp 4 constexpr int extract(const S &s);
7 constexpr S() : n(extract(*this)), m(0) {} // expected-note {{in call to 'extract(s1)'}}
8 constexpr S(int k) : n(k), m(extract(*this)) {}
12 constexpr int extract(const S &s) { return s.n; } // expected-note {{read of uninitialized object is not allowed in a constant expression}}
14 constexpr S s1; // ok
16 constexpr S s1; // expected-error {{constant expression}} expected-note {{in call to 'S()'}}
17 constexpr S s2(10);
23 constexpr T() : arr() {}
27 constexpr U(const int *p) : T(), another(), p(p) {}
28 constexpr U(const U &u) : T(), another(), p(u.p) {
    [all...]
constexpr-strlen.cpp 9 # 10 "SemaCXX/constexpr-strlen.cpp" 2
10 constexpr int n = __builtin_strlen("hello"); // ok
11 constexpr int m = strlen("hello"); // expected-error {{constant expression}} expected-note {{non-constexpr function 'strlen' cannot be used in a constant expression}}
constexpr-factorial.cpp 3 constexpr unsigned oddfac(unsigned n) {
6 constexpr unsigned k = oddfac(123);
cxx0x-constexpr-const.cpp 3 constexpr int x = 1;
4 constexpr int id(int x) { return x; }
discrim-union.cpp 7 template<typename T> constexpr T &&forward(typename remove_reference<T>::type &t) noexcept { return static_cast<T&&>(t); }
8 template<typename T> constexpr T &&forward(typename remove_reference<T>::type &&t) noexcept { return static_cast<T&&>(t); }
9 template<typename T> constexpr typename remove_reference<T>::type &&move(T &&t) noexcept { return static_cast<typename remove_reference<T>::type&&>(t); }
31 constexpr either_impl(select<0>, T &&t) : val(move(t)) {}
34 constexpr either_impl(select<N>, U &&u) : rest(select<N-1>(), move(u)) {}
36 constexpr static unsigned index(type<T>) { return 0; }
38 constexpr static unsigned index(type<U> t) {
49 constexpr const T &get(select<0>) { return val; }
50 template<unsigned N> constexpr const decltype(static_cast<const rest_t&>(rest).get(select<N-1>{})) get(select<N>) {
60 constexpr a(U &&...u) : value{forward<U>(u)...} {
    [all...]
constant-expression-cxx11.cpp 13 template<typename T> constexpr T id(const T &t) { return t; }
14 template<typename T> constexpr T min(const T &a, const T &b) {
17 template<typename T> constexpr T max(const T &a, const T &b) {
20 template<typename T, size_t N> constexpr T *begin(T (&xs)[N]) { return xs; }
21 template<typename T, size_t N> constexpr T *end(T (&xs)[N]) { return xs + N; }
24 constexpr int zero() { return 0; }
38 constexpr B *p = &d;
39 constexpr C *q = &d;
45 constexpr B &pp = d;
46 constexpr C &qq = d
    [all...]
  /external/clang/test/PCH/
cxx11-constexpr.cpp 10 constexpr B(char) {}
13 struct C { // expected-note {{not an aggregate and has no constexpr constructors}}
19 constexpr D(int n) : B('x'), k(2*n+1) {}
26 constexpr int f(C c) { return 0; } // expected-error {{not a literal type}}
27 constexpr B b; // expected-error {{constant expression}} expected-note {{non-constexpr}}
  /external/clang/test/Parser/
cxx11-type-specifier.cpp 6 operator constexpr int(); // expected-error{{type name does not allow constexpr}}
12 (void) new constexpr int; // expected-error{{type name does not allow constexpr}}
13 } catch (constexpr int) { // expected-error{{type name does not allow constexpr}}
  /external/clang/test/CXX/expr/expr.const/
p2-0x.cpp 7 // expression, function invocation substitution (7.1.5 [dcl.constexpr])
8 // replaces each occurrence of this in a constexpr member function with a
20 // - an invocation of a function other than a constexpr constructor for a
21 // literal class or a constexpr function [ Note: Overload resolution (13.3)
25 int n : f(); // expected-error {{constant expression}} expected-note {{non-constexpr function 'f' cannot be used in a constant expression}}
28 constexpr NonConstexpr2(); // expected-note {{here}}
40 int n : NonConstexpr4().n; // expected-error {{constant expression}} expected-note {{non-constexpr constructor 'NonConstexpr4' cannot be used in a constant expression}}
43 // - an invocation of an undefined constexpr function or an undefined
44 // constexpr constructor;
46 constexpr UndefinedConstexpr()
    [all...]
  /external/clang/test/CXX/lex/lex.literal/lex.ext/
p8.cpp 4 constexpr const char *operator "" _id(const char *p, size_t) { return p; }
5 constexpr const char *s = "foo"_id "bar" "baz"_id "quux";
7 constexpr bool streq(const char *p, const char *q) {
12 constexpr const char *operator "" _trim(const char *p, size_t n) {
15 constexpr const char *t = " " " "_trim " foo";

Completed in 346 milliseconds

1 2 3 4 5 6 7 8 9