plateform stringclasses 1
value | repo_name stringclasses 2
values | name stringlengths 1 78 | ext stringclasses 2
values | path stringlengths 15 1.11k | size int64 1 8.55M | source_encoding stringclasses 11
values | md5 stringlengths 32 32 | text stringlengths 0 8.49M |
|---|---|---|---|---|---|---|---|---|
google | android | aggr2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/aggr2.C | 528 | utf_8 | a79ad2e50ca8d0ab6dd5b27254f204b5 | // PR c++/15172
// { dg-do run }
extern "C" int printf (const char *, ...);
extern "C" void abort ();
struct A {
static A* p;
A() { p = this; }
A(const A&);
~A() { if (this != p) abort (); }
void print () { }
};
A* A::p;
struct B {
A a;
};
B b = { A () };
struct A2 {
static A2* p;
A2() { p = thi... |
google | android | delete1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/delete1.C | 138 | utf_8 | 57fb26633dac122802c2c3429c4d6ed2 | // PR c++/19811
class C; // { dg-warning "forward" }
void foo(void *p) {
delete [] ((C*)p) ; // { dg-warning "problem|incomplete" }
}
|
google | android | delete2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/delete2.C | 769 | utf_8 | 468ee3e464fecbec120056e490e0ffe4 | // PR c++/15097
// { dg-do run }
typedef __SIZE_TYPE__ size_t;
extern "C" void * malloc (size_t);
extern "C" void free (void *);
extern "C" void abort(void);
void *saved;
void * operator new (size_t size)
{
void *p = malloc (size);
saved = p;
return p;
}
void operator delete (void *p)
{
if (p != saved)
... |
google | android | brace5 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/brace5.C | 122 | utf_8 | c67cb693c501dfa41dcf719d6d7498f1 | // PR c++/27491
// { dg-do compile }
// { dg-options "" }
int i = (int) { 0 };
int j = (int) { i };
int k = (int) { k };
|
google | android | value10 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/value10.C | 439 | utf_8 | 801e7374b2202b97ebe96c32d0c8ad82 | // PR c++/51331
// { dg-do run }
struct A {
A(): x(10) {}
virtual ~A() {}
int x;
};
struct B: public virtual A {
};
struct C: public virtual A {
};
struct D: public B, virtual public C {
D(): B(), C() {} // note an explicit call to C() which is auto-generated
};
int main() {
D* d = new D();
// Crash... |
google | android | aggr7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/aggr7.C | 173 | utf_8 | bee0927298bd1d13c118fdddbac5ee49 | // PR c++/50866
struct A { A(); ~A(); };
struct B { B(const char *, const A& = A()); ~B(); };
struct C {
B b1, b2;
};
void f()
{
C c = {
"a","b"
};
}
|
google | android | null1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/null1.C | 117 | utf_8 | 6e78c514e0d930771bc8bc83b1d03c3f | // PR c++/16489
// { dg-do compile { target { ! c++11 } } }
const int NULL = 0;
int main() {
double* p = NULL;
}
|
google | android | array33 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/array33.C | 277 | utf_8 | 4fbf3cf57f3093af3bafd6adf73e34db | // PR c++/55804
// { dg-do run }
int t = 0;
template <typename> struct vector {
vector() { t++; }
};
typedef vector<int> Arrays[1];
class C
{
vector<int> v_;
void Foo(const Arrays &);
};
Arrays a;
int main(void)
{
if (t!=1)
__builtin_abort ();
return 0;
}
|
google | android | new36 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new36.C | 1,925 | utf_8 | 9a5926ac1fac1582a28a1430529e44de | // Testcase for invocation of constructors/destructors in operator new[].
// { dg-do run }
#include <stdlib.h>
struct E {
virtual ~E() { }
};
struct S {
S();
~S();
};
static int count;
static int max;
static int throwAfter = -1;
static S *pS;
S::S()
{
if (throwAfter >= 0 && count >= throwAfter)
throw E... |
google | android | new21 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new21.C | 134 | utf_8 | c9a8d831104ecec8c5233bd81e720061 | // PR c++/32251
struct A {
A();
void operator delete(void *, ...);
};
void foo () {
new A; // { dg-warning "deallocation" }
}
|
google | android | new39 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new39.C | 1,013 | utf_8 | 64c11ad2b4bc456c7aa4dc3b3c0ab598 | // Testcase for overflow handling in operator new[].
// { dg-do run }
#include <stdlib.h>
#include <stdexcept>
struct without_new {
char bar[256];
};
struct with_new {
char bar[256];
void *operator new[] (size_t sz)
{
if (sz != -1)
abort ();
throw std::bad_alloc();
}
};
template <typename T>... |
google | android | copy6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/copy6.C | 126 | utf_8 | 5d48182e8fa2907f420bf1ef3d67dba3 | // PR c++/11878
struct A
{
virtual ~A();
};
template<typename T> struct B
{
T t;
};
void foo() { throw B<A>().t; }
|
google | android | pr60572 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/pr60572.C | 148 | utf_8 | f25ce72283c3004e08c0df4685ca2469 | // PR c++/60572
// { dg-do compile }
struct A
{
A x; // { dg-error "incomplete type" }
virtual ~A () {}
};
struct B : A
{
B () : A () {}
};
|
google | android | dso_handle2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/dso_handle2.C | 161 | utf_8 | e951c3480b33e9aad942efea284f5937 | // PR c++/58846
// { dg-options "-fuse-cxa-atexit" }
extern "C" { char* __dso_handle; }
struct A
{
~A();
};
A a; // { dg-error "conflicting declaration" }
|
google | android | const7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/const7.C | 356 | utf_8 | f694cbd4095c7b8994036f80614d6f8b | // { dg-do compile }
// { dg-options "-fdump-tree-gimple" }
struct s { int x, y; };
short offsets[1] = {
((char*) &(((struct s*)16)->y) - (char *)16),
};
// This ensures that we get a dump whether or not the bug is present.
void fn() { }
// { dg-final { scan-tree-dump-not "initialization" "gimple" } }
// { dg-fin... |
google | android | ctor10 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/ctor10.C | 168 | utf_8 | a7fab26ec8d16e90cb47357e7759a768 | // PR c++/48606
// { dg-do compile }
// { dg-options "-fkeep-inline-functions" }
struct S
{
int &ref;
S() : ref() {}; // { dg-error "value-initialization of" }
};
|
google | android | init-ref2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/init-ref2.C | 573 | utf_8 | c2e29d2071e0ec0563f5e74c45da4ecd | // Test for proper handling of local static references.
// { dg-do run }
int r;
int c;
int f ()
{
// Test that we only initialize i once.
if (++c > 1)
++r;
return 42;
}
const int *p;
void g ()
{
static const int &i = f();
// Test that i points to the same place in both calls.
if (p && p != &i)
++r;
... |
google | android | dso_handle1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/dso_handle1.C | 231 | utf_8 | b34354a9fccb98f99f3ac0bc14d8f157 | // PR c++/17042
// { dg-do assemble }
/* { dg-require-weak "" } */
// { dg-options "-fuse-cxa-atexit" }
struct A
{ A(); ~A(); };
A a;
extern "C" { void* __dso_handle __attribute__ ((__weak__)); }
void f()
{ __dso_handle = 0; }
|
google | android | synth3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/synth3.C | 240 | utf_8 | 52d51052f7365f93dd3959b1a93894f2 | // Test that synthesizing the C copy constructor doesn't require B<int> to
// be complete.
template <class T>
struct B
{
typename T::NT nt;
};
struct A
{
A ();
A (const A&);
A (const B<int>&);
};
struct C: A { };
C c; |
google | android | new9 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new9.C | 235 | utf_8 | d9b779b618b81e9ea527baf5e2af4c4e | // PR 12337
class A {};
template <typename T>
class X : public A {
public:
X(T&);
};
class B {
public:
bool foo(A*);
template <typename T>
bool foo(T& t) { return foo(new X<T>(t)); }
};
int main()
{
B x, y;
x.foo(y);
}
|
google | android | new19 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new19.C | 1,253 | utf_8 | 2e14de5f82a334a88354de9073763969 | // { dg-do compile }
// { dg-options "-O2 -fstrict-aliasing -fdump-tree-pre-details" }
// Make sure we hoist invariants out of the loop even in the presence
// of placement new. This is similar to code in tramp3d.
typedef __SIZE_TYPE__ size_t;
inline void* operator new(size_t, void* __p) throw() { return __p; }
te... |
google | android | new5 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new5.C | 278 | utf_8 | 165b53a00e07117f81b4b42f0b88ed5c | // { dg-do run }
#include <new>
void * operator new[](std::size_t, std::nothrow_t const &) throw()
{ return 0; }
struct X {
struct Inner { ~Inner() {} };
X() {
Inner * ic = new (std::nothrow) Inner[1]; // SegFault here
}
};
int main() {
X table;
}
|
google | android | brace3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/brace3.C | 50 | utf_8 | c46d05cc9ceeb4d3a8a4d25cd908ba7a | int array[2][1] = { {0} {1} }; // { dg-error "" }
|
google | android | ref3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/ref3.C | 156 | utf_8 | e21984c05c21d067e3b20b37c68bec76 | struct Base { };
struct Derived : public Base { };
struct Choose {
operator Base&();
operator Derived&();
};
void f()
{
Choose c;
Base& ref = c;
}
|
google | android | assign1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/assign1.C | 389 | utf_8 | 590b4fffc5e2d0c7af7852413ab82a9e | // PR c++/13009
// { dg-do run }
struct A {
char a;
};
struct B: public virtual A {
#if 0 // this piece of code works around the problem
B& operator= (const B& other)
{
A::operator= (other);
}
#endif
};
struct C: public B {
char c;
};
int main() {
B b;
b.a = 'b';
C c;
c.a = c.c = 'c';
... |
google | android | array35 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/array35.C | 61 | utf_8 | bd32f6af7d9d02e0682b0f754b742b73 | // PR c++/58868
static struct { const int i; } a[] = { 1 };
|
google | android | init-ref1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/init-ref1.C | 553 | utf_8 | 61b6e6a5b24a1cf0c1d82d1bad6d7600 | // Test case for GNATS bug 787.
// { dg-do run }
#include <stdio.h>
#include <stdlib.h>
static int calls;
int &foo (int &arg)
{
calls++;
arg=0;
return arg;
}
int &identity (int &x)
{
return x;
}
int main()
{
int a;
calls = 0;
int &b = ++foo (a);
if (calls > 1)
abort ();
if (&a != &b)
abort ();... |
google | android | new3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new3.C | 142 | utf_8 | 2326f60a4e882ff67a8dd2802f7a0b8b | // Test that new-expressions at file scope work properly.
struct A { static char* p; };
int i = 1;
char* A::p = new char[i];
void foo() {}
|
google | android | placement4 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/placement4.C | 514 | utf_8 | 4e76efb079bdce4887766fb38dfed9eb | // PR c++/34158
typedef __SIZE_TYPE__ size_t;
extern "C" void* malloc (size_t);
extern "C" void free (void *);
template <class T> class undef;
struct A {
A() { throw 1; }
};
template<typename T> class Pool { };
void *operator new(size_t size,Pool<int>& pool)
{
return malloc(size);
}
template<typename T>
void ... |
google | android | dtor3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/dtor3.C | 187 | utf_8 | 5f5e01bbe7cb4844fd36654728665aa4 | // PR c++/17976
// { dg-do run }
extern "C" void abort();
struct A
{
static int i;
A(){}
~A(){i++;if(i>1)abort();}
};
int A::i = 0;
A a;
extern A a;
int main()
{
return 0;
}
|
google | android | pm3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/pm3.C | 175 | utf_8 | b8f980c062ec4b3f73dffbda8276ec70 | // PR c++/12218
// { dg-do run }
struct C { int i, j; };
typedef int C::*mPtr;
extern const mPtr should_be_0 = &C::i;
extern const mPtr should_be_4 = &C::j;
int main () {
}
|
google | android | uninitialized1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/uninitialized1.C | 543 | utf_8 | 585231b1429c62b0b3227010bfd6ff41 | // PR c++/58126
struct A { // { dg-error "uninitialized" "" { target c++11 } }
const int value1; // { dg-message "should be initialized" }
int& value2; // { dg-message "should be initialized" }
};
struct B : A { }; // { dg-error "deleted" "" { target c++11 } }
A a; // { dg-error "deleted|uninitialized const mem... |
google | android | ctor9 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/ctor9.C | 124 | utf_8 | c55d67e7ef83de8fc0fa30f01b68f5f7 | // PR c++/38427
// { dg-do compile }
struct S
{
int &ref;
S() : ref() {}; // { dg-error "value-initialization of" }
};
|
google | android | array7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/array7.C | 154 | utf_8 | 02cf876b0b0d2594118addc046b9112a | struct S {
virtual void v () {}
void f (const float g[3]);
float h[3];
};
void g () {
S s1, s2;
s1 = s2;
}
void S::f (const float g[3]) {}
|
google | android | new1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new1.C | 300 | utf_8 | 3dd2b2682d04e72fb7a9a8d137ec7e9d | // { dg-do compile }
typedef __SIZE_TYPE__ size_t;
class bar {
int i;
public :
void * operator new ( size_t , void * storage );
};
class foo {
int storage[ 5 ];
public:
void mem ( ) {
bar *s = new ( ( void * ) & storage ) bar;
}
}; |
google | android | pr48859 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/pr48859.C | 177 | utf_8 | 880ee6b08cc835f2a1db0bae613e7a23 | // PR c++/48859
// { dg-do compile }
struct HasConstructor {
HasConstructor() {}
};
class ConstMember {
const HasConstructor empty_;
};
void foo() {
new ConstMember;
}
|
google | android | pr29571 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/pr29571.C | 444 | utf_8 | ec7555402d268fd3f81a050a1f2d0808 | // PR c++/29571
struct A
{
static const int i = 0/0 + ""; // { dg-warning "division by zero" }
// { dg-error "constant|conversion|initializ" "" { target *-*-* } 5 }
static const int j = int(i);
};
// Currently G++ complains about a non-constant initializer for 'j' in
// C++11 mode, but not C++98. Either way is... |
google | android | bitfield3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/bitfield3.C | 86 | utf_8 | ba9cb6a74a0589c86569f80ab3a2d5fc | // PR c++/43663
struct S
{
S(): i(0) {}
int i : 3;
};
S s;
const int& cr(s.i);
|
google | android | ctor2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/ctor2.C | 515 | utf_8 | c92e60dfdc4e6ad1fcc8d9290be36f5f | // { dg-do run }
// PR 9629. The vtable is not set up until the base initializers have
// run.
struct A {
static A *a;
A ();
};
A *A::a;
A::A () {a = this;}
struct B {
static A *a;
B (A *);
};
A *B::a;
B::B(A *a_) {a = a_;}
struct C : virtual public A, public B {
C();
};
C::C () : B(this) {}
struct D : virtua... |
google | android | explicit2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/explicit2.C | 84 | utf_8 | e783ed344c98de89907152442388d920 | // PR c++/60417
struct A { explicit A(int = 0); };
int main()
{
A a[1] = { };
}
|
google | android | array21 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/array21.C | 126 | utf_8 | 82e7666faf93a80c3bc11a5a97422e83 | // PR c++/27722
void foo()
{
const int x[] = 0; // { dg-error "initializer" }
++x; // { dg-error "read-only|operand" }
}
|
google | android | array36 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/array36.C | 95 | utf_8 | f39111fa11b0d25bd84e443cd5df726a | // PR c++/60224
struct A {};
void foo()
{
bool b[] = (int (A::*)())0; // { dg-error "" }
}
|
google | android | ref8 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/ref8.C | 167 | utf_8 | 7d3e4afff4fce557d4ee66f8d865c7d9 | struct A {
A operator=(const A&);
};
A operator*(A, A);
A& operator+=(A& a, const A& b)
{
return a = a * b; // { dg-error "non-const reference" }
}
|
google | android | synth2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/synth2.C | 311 | utf_8 | 618d3b43c166ae26e9e340c6831a133c | // PR c++/34180
struct G {
G(); // { dg-message "" "candidate" }
G(G&); // { dg-message "" "candidate" }
};
class A // { dg-error "" }
// { dg-message "candidate" "candidate note" { target *-*-* } 8 }
{
const G g;
};
int main()
{
A a;
A b = a; // { dg-message "required here|deleted" }
}
|
google | android | placement3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/placement3.C | 384 | utf_8 | 61be8418b83a05d14bee83b0c4c26ff7 | typedef __SIZE_TYPE__ size_t;
extern "C" void *malloc (size_t);
int i;
struct S {
S(int) {
throw 3;
}
void *operator new(size_t s, int) {
++i;
return malloc (s);
}
void operator delete(void *, int) {
--i;
}
void operator delete(void *, int, int) ;
};
int main () {
try {
new... |
google | android | array37 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/array37.C | 101 | utf_8 | 19db4c9c603da402ed789531b2bde44e | struct A
{
int i;
A(int);
};
struct B
{
virtual void f();
A ar[3];
};
extern B b;
B b2(b);
|
google | android | new25 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new25.C | 957 | utf_8 | ccfb55277b45e67e6b5a86c7f05fd0a8 | // PR c++/31988
#include <new>
class C
{
public:
void* operator new(std::size_t = 32) throw (std::bad_alloc); // { dg-error "first parameter" }
void* operator new[](std::size_t = 32) throw (std::bad_alloc); // { dg-error "first parameter" }
void* operator new(std::size_t = 32, const std::nothrow_t&) throw(); // ... |
google | android | empty1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/empty1.C | 575 | utf_8 | d2ea13322f402d3ce506a9a1106ee836 | // { dg-do run }
// padding. Which clobbers whatever they overlay.
class EmptyBase0 {};
class EmptyBase1 : public EmptyBase0 {};
class Base1
{
public:
unsigned int t_;
Base1(unsigned int t) : t_(t) {}
};
class PEPE : public Base1, public EmptyBase1
{
public:
PEPE(unsigned int t)
: Base1(t), EmptyBase1(EmptyBase1()) {... |
google | android | new28 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new28.C | 266 | utf_8 | 7fc4838fffcb429888d20344300ac8d6 | // PR c++/43951
// { dg-do run }
// { dg-options "-O2" }
extern "C" void abort ();
class Foo
{
public:
Foo () : xxx (1) {};
const int xxx;
};
Foo *
bar ()
{
return new Foo;
}
int
main ()
{
Foo *p = bar ();
if (p->xxx != 1)
abort ();
return 0;
}
|
google | android | reference3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/reference3.C | 308 | utf_8 | 8c2a05e86a5eb2a7a53230fcaf761060 | // { dg-do compile }
// This code used to be accepted but it is invalid as there is no
// value initialization of a reference type.
// PR c++/36695
template <typename T>
T f()
{
T a = T(); // { dg-error "value-initialization of reference" }
}
int &a = f<int&>(); // { dg-message "required from here" }
|
google | android | new22 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new22.C | 96 | utf_8 | f7a95da9dc93980c45559b153a887a60 | // PR c++/29001
void* operator new (__SIZE_TYPE__) { return; } // { dg-error "with no value" }
|
google | android | new40 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new40.C | 1,853 | utf_8 | da4643a687fa7e83ca35fe341489f792 | // Testcase for overflow handling in operator new[].
// Optimization of unnecessary overflow checks.
// In C++11 we throw bad_array_new_length instead.
// { dg-options -std=c++03 }
// { dg-do run }
#include <assert.h>
#include <stdlib.h>
#include <stdexcept>
static size_t magic_allocation_size
= 1 + (size_t (1) << ... |
google | android | cleanup3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/cleanup3.C | 394 | utf_8 | 509f15d49c50b3d63a59c36aae604afa | // Check that on targets with "__cxa_atexit" we use destructors,
// rather than cleanup functions, to destroy objects with static
// storage duration.
// { dg-require-effective-target "cxa_atexit" }
// Cleanup functions generated by G++ have the "_tcf" prefix.
// { dg-final { scan-assembler-not "_tcf" } }
struct S { ... |
google | android | array17 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/array17.C | 115 | utf_8 | bebae7e64d01c783fefaf2f358272230 | // { dg-do compile }
class StringMap {
const char empty_str[1];
public:
StringMap() : empty_str() {}
};
|
google | android | static-init3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/static-init3.C | 177 | utf_8 | eac75da8029ebf097e358f87837418c2 | // PR c++/55137
// s should have constant initialization.
// { dg-final { scan-assembler-not "GLOBAL" } }
struct S {
int b;
};
struct S s = { -1 + (int)(sizeof(int) - 1) };
|
google | android | array10 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/array10.C | 124 | utf_8 | 52be26e8b242500ae671c570de13a1a7 | // { dg-do compile }
// { dg-options "" }
typedef int __attribute__((vector_size (8))) vec;
vec foo[] = { (vec) {1, 2} };
|
google | android | member1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/member1.C | 443 | utf_8 | 0160b85e4a1a6610929a08c40f60df4d | // Bug 20789: ICE on invalid
template<typename> struct A;
template<int> struct B {};
template<typename T> struct C
{
static const int i = A<T>::i; // { dg-error "incomplete" }
static const int j = i;
B<j> b;
};
C<int> c;
int i = C<int>::i;
int j = C<int>::j; |
google | android | aggr8 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/aggr8.C | 120 | utf_8 | 8eaf6042526686e7717214b420cfcaf5 | // PR c++/51009
struct A
{
~A();
};
struct B
{
A a;
B(const A& = A());
};
struct C
{
B b1, b2;
};
C c = {};
|
google | android | new23 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new23.C | 452 | utf_8 | c6bfe3c407b3ca0eac5cfe23b9a35d23 | // PR c++/33025
// { dg-do run }
// { dg-options "-O2" }
typedef __SIZE_TYPE__ size_t;
inline void *operator new (size_t, void *p) throw () { return p; }
extern "C" void abort ();
int
main()
{
const unsigned num = 10;
unsigned *data = new unsigned[2 * num];
unsigned *ptr = data;
for (unsigned i = 0; i < 2 * n... |
google | android | no-elide1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/no-elide1.C | 139 | utf_8 | ad6fea2e4a044bf966634965459eed1f | // PR c++/47503
// { dg-options "-fno-elide-constructors" }
struct A
{
int i;
A ();
};
struct B
{
A a;
B (A &aa) : a (aa) { }
};
|
google | android | ref16 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/ref16.C | 220 | utf_8 | f44963a0cd9c1736b28dd8d5a81a4a94 | // PR c++/35548
// { dg-do run }
int c;
struct A
{
A() { ++c; }
A(const A&) { ++c; }
~A() { --c; }
};
A f()
{
return A();
}
int i;
const A* ap;
int main()
{
const A& ar = i ? *ap : f();
return (c == 0);
}
|
google | android | attrib1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/attrib1.C | 128 | utf_8 | 3eee77105967418a88d56f0c30243408 | // { dg-do run }
void f() __attribute((__constructor__));
int i;
void f() { i = 1; }
int main(int, char **)
{
return 1-i;
}
|
google | android | static3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/static3.C | 258 | utf_8 | 004975a4245800f0c34b34b9565fc427 | // { dg-do run }
struct T
{
static void (*handler)();
static void func() {}
};
bool fail;
struct S {
S() {
if (T::handler != T::func)
fail = true;
}
};
static S s;
void (*T::handler)() = func;
int main()
{
if (fail)
return 1;
}
|
google | android | ctor1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/ctor1.C | 710 | utf_8 | 77ceed5edeb6a109374c44ef23679bef | // { dg-do run }
// From WindRiver SPR 80797
// We were inadvertently SAVE_EXPRing volatile arrays during delete[]
struct A
{
A *ptr;
static int ok;
A () {ptr = this;}
~A () {ok = ptr == this;}
};
int A::ok = -1;
struct B
{
B *ptr;
static int ok;
B () {ptr = this;}
~B () {ok = ptr == this;}
};
int... |
google | android | dtor2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/dtor2.C | 191 | utf_8 | aa6675ad7ca1b7ce6a63c598c59f89a0 | // { dg-do run }
extern "C" void abort ();
struct A
{
~A();
};
A::~A () {
abort ();
}
struct B
{
~B();
};
B::~B () {
if(true) return;
A a;
}
int main()
{
B b;
return 0;
}
|
google | android | copy7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/copy7.C | 108 | utf_8 | 401730d1bb87c3edf85010755fe8a2ff | // CWG 5
struct C { };
C c;
struct A {
A(const A&);
A(const C&);
};
const volatile A a = c; // Okay
|
google | android | aggr9 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/aggr9.C | 71 | utf_8 | a7bd0d962c09abd6aa73b256f57ea748 | // PR c++/53661
enum Code {
SUCCESS = 0
};
Code a;
int r[] = {a};
|
google | android | bitfield2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/bitfield2.C | 421 | utf_8 | f93344289d2f2663e5df449820c5dae4 | // PR c++/13371
// Bug: We were failing to properly protect the lhs on the line marked
// "here" from multiple evaluation.
// { dg-do run }
extern "C" int printf (const char *, ...);
enum E { E1, E2 };
struct A
{
E e : 8;
unsigned char c;
};
A ar[2];
int c;
int f()
{
++c;
printf ("f()\n");
return 0;
}
... |
google | android | ctor6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/ctor6.C | 343 | utf_8 | ecc9c501210a7d0fcb63a6b4e75e71ee | // PR c++/21340
struct Base{};
struct Iterator : virtual Base {};
bool operator==(const Iterator&, const Iterator&);
struct IteratorI : Iterator {};
struct Obj
{
bool operator==(const Obj&) const;
};
template <int>bool dummy()
{
Obj lhs, rhs;
return lhs == rhs;
}
int
main(int argc, char** argv)
{
IteratorI* it... |
google | android | brace4 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/brace4.C | 117 | utf_8 | fa25c5dda11ffc85ea36955456c3fbe8 | // PR c++/16859
// { dg-do compile }
// { dg-options "-pedantic" }
int a[] = { }; // { dg-error "zero-size array" }
|
google | android | cleanup2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/cleanup2.C | 394 | utf_8 | 7d94225f3f0c383bec9dd200a01a0b33 | // PR c++/12526
// We decided that the call to strcmp has no side-effects because strcmp is
// pure, even though the first argument has side-effects. As a result, we
// stripped the CLEANUP_POINT_EXPR. Hilarity ensued.
extern "C" int strcmp (const char *, const char *);
struct A {
A(int);
const char *str();
... |
google | android | ref9 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/ref9.C | 603 | utf_8 | ded575d1c35757dbf89f635e5a86910d | // { dg-do run }
struct ex;
struct basic {
int refcount;
ex eval() const;
basic() : refcount(0) {}
};
struct ex {
basic *bp;
ex() : bp(0) { }
ex(const basic &);
virtual ~ex();
void construct_from_basic(const basic &);
};
ex basic::eval() const {
throw 1;
}
inline ex::ex(const basic &b) { construct... |
google | android | new29 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new29.C | 302 | utf_8 | ea98cc4326612e97a8fabdee28dcf0ba | // PR c++/43951
// { dg-do run }
// { dg-options "-O2" }
extern "C" void abort ();
class Foo
{
public:
Foo () : xxx (1) {};
const int xxx;
};
struct Foo2
{
Foo foo;
};
Foo2 *
bar ()
{
return new Foo2;
}
int
main ()
{
Foo2 *p = bar ();
if (p->foo.xxx != 1)
abort ();
return 0;
}
|
google | android | new16 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new16.C | 640 | utf_8 | c52e42cacc9e8e4d847ceae5031544ca | // { dg-do run }
// { dg-options "-O2 -fstrict-aliasing" }
// Test that we don't let TBAA reorder an assignment across a
// placement new.
// See PR 29286.
typedef __SIZE_TYPE__ size_t;
inline void* operator new(size_t, void* __p) throw() { return __p; }
void __attribute__((noinline)) bar() {}
long __attribute__((... |
google | android | union2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/union2.C | 195 | utf_8 | a2a29bef6924e38f49965c48ff606491 | // PR c++/15938
// { dg-do compile }
// { dg-options "" }
typedef union
{
struct { int i; };
struct { char c; };
} A;
A a = { 0 };
A b = {{ 0 }};
A c = {{{ 0 }}}; // { dg-error "braces" }
|
google | android | pr44086 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/pr44086.C | 435 | utf_8 | f660de16a9cf160558064bb92eb21901 | // PR c++/44086
// { dg-do compile }
struct A // { dg-error "uninitialized" "" { target c++11 } }
{
int const i : 2; // { dg-message "should be initialized" }
};
void f()
{
A a; // { dg-error "deleted|uninitialized const" }
new A; // { dg-error "deleted|uninitialized const" }
A(); ... |
google | android | const3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/const3.C | 119 | utf_8 | 88f5c7af426aec933b525e2bb17b1b0d | // { dg-do run }
struct S {
static const int i = 3;
};
const int S::i;
int main () {
if (!S::i)
return 1;
}
|
google | android | static4 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/static4.C | 98 | utf_8 | 4e0fdfa0a67cd3c3e1f1a9752829fecf | // PR c++/51461
struct A
{
static const A a = 0; // { dg-error "incomplete|non-integral" }
};
|
google | android | reference2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/reference2.C | 339 | utf_8 | 0960bd0fd309b441dfe952c9d328620e | // { dg-do compile }
// This code used to be accepted but it is invalid as there is no
// value initialization of a reference type.
// PR c++/36695
// We should we able to diagnostic this without instantiating the template
template <int a1>
int f()
{
typedef int& T;
T a = T(); // { dg-error "value-initialization ... |
google | android | save1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/save1.C | 236 | utf_8 | 7d8b7ff14410173fd3e1cb0594f72583 | // PR c++/8748
// We were wrapping the ARRAY_REF in a SAVE_EXPR, causing us to try to make a bitwise
// copy of b[0].
struct A
{
int i;
};
struct B : A
{
virtual ~B();
};
struct C
{
B b[1];
};
void foo() { C().b[0].i; }
|
google | android | brace2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/brace2.C | 315 | utf_8 | cb65ff3ec35d4444e4db0bd1bdadc8e2 | // { dg-do compile }
// [dcl.init] paragraph 13.
int x = { 2 };
const char * y = { "hello" };
int a = 2;
int b = { 2,3 }; // { dg-error "requires one element in initializer" }
int c = { { 2 } } ; // { dg-error "braces around scalar initializer" }
int d = {}; // { dg-error "initializer" "" { target { ! c++11 } } }
|
google | android | ptrmem1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/ptrmem1.C | 91 | utf_8 | d92713305e498425e3152fff2c8acf2d | // PR c++/16853
struct A {};
struct B {};
int B::* b;
int A::* a = b; // { dg-error "" }
|
google | android | new30 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new30.C | 288 | utf_8 | fb29671d73953facd665408d3e39029d | // PR c++/40975
struct data_type
{
// constructor required to reproduce compiler bug
data_type() {}
};
struct ptr_type
{
// array new as default argument required to reproduce compiler bug
ptr_type (data_type* ptr = new data_type[1]) { delete[] ptr; }
};
ptr_type obj;
|
google | android | dtor1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/dtor1.C | 517 | utf_8 | 0282b33cfb0b201499908c95a2e9b57d | // { dg-do run }
extern "C" void abort ();
int d = 5;
struct B
{
int x;
B (int i) : x (i) { }
~B () { if (d-- != x) abort (); }
};
struct C1 : public B {
C1 (int i) : B (i) {}
};
struct C2 : public B {
C2 (int i) : B (i) {}
};
struct D : public B {
D (int i) : B (i) {}
};
struct E : public B {
E (i... |
google | android | void1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/void1.C | 42 | utf_8 | 4e0802398e368eb04b3feac9c0b1b5d4 | // PR c++/48569
int main()
{
void();
}
|
google | android | new34 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new34.C | 135 | utf_8 | a3216a95d614cdbac63bafe50438a3b0 | // PR c++/53356
struct A { A(); ~A(); };
struct B {
operator const A () const;
};
A* cause_ICE() {
return new A((A(),A()));
}
|
google | android | enum2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/enum2.C | 104 | utf_8 | ca9a6dc8d27f3cf82314cfcd92133441 | #include <limits.h>
enum test {
z = 0,
c = UINT_MAX + 1LL
} x = z;
int main() {
return x != z;
}
|
google | android | copy2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/copy2.C | 71 | utf_8 | c268699333b239c371d1bdc906ea54ad | // { dg-do compile }
struct S { S (); };
volatile S s[1] = { S () };
|
google | android | new17 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new17.C | 709 | utf_8 | 0e5c6faf49d015ce24e47a142ef72ec9 | // { dg-do compile }
// { dg-options "-O2 -fstrict-aliasing -fdump-tree-optimized" }
// Test that placement new does not introduce an unnecessary memory
// barrier.
// See PR 29286.
typedef __SIZE_TYPE__ size_t;
inline void* operator new(size_t, void* __p) throw() { return __p; }
template <class T, int D>
class Vec... |
google | android | pr55497 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/pr55497.C | 139 | utf_8 | 72601c1b850b49dd7447dc271d916d5a | // PR c++/55497
// { dg-options "-g" }
int get();
struct B
{
B()
{
static const int v = get();
char BUFFER[v];
}
};
B b;
|
google | android | synth4 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/synth4.C | 96 | utf_8 | 1a08d73d34d484903191c07901fa5549 | // PR c++/45822
struct A
{
A(int);
};
struct B
{
B(A = 0);
};
struct C
{
B b;
};
C c;
|
google | android | ref4 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/ref4.C | 245 | utf_8 | f21f65304dbc9a97b63efafb7bb1a6df | // { dg-do run }
int c;
struct Base {
Base() {}
Base(const Base &) { ++c; }
Base & operator = (const Base &);
};
struct Derived : public Base {};
const Base &b = Derived();
int main()
{
return c; // No copies should be required.
}
|
google | android | new20 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new20.C | 199 | utf_8 | 9b183ec2b575bdf5465306fc4e259b43 | // PR c++/31743
typedef int A[];
A* p = new A; // { dg-error "invalid use of array with unspecified bounds" }
A* q = new (A); // { dg-error "invalid use of array with unspecified bounds" }
|
google | android | ref13 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/ref13.C | 94 | utf_8 | 9fd35f214b88e04577c6edb14b23477c | // PR c++/28338
void foo()
{
{ static const int& i = 0; }
{ static const int& i = 0; }
}
|
google | android | lifetime1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/lifetime1.C | 378 | utf_8 | 0867c022db8ad55482b727ba001b7cf2 | // PR c++/48370
// { dg-do run }
extern "C" void abort();
int last = 4;
struct A {
int i;
A(int i): i(i) { }
~A() { if (i > last) abort(); last = i; }
};
struct D { int i; };
struct B: D, A { B(int i): A(i) { } };
struct E: D, virtual A { E(int i): A(i) { } };
struct C
{
const A& ar1;
const A& ar2;
co... |
google | android | new12 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new12.C | 64 | utf_8 | bd503383d6a9825355b68023ee042168 | // PR c++/18369
void breakme ()
{
int *v = new (int [5]);
}
|
google | android | array31 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/array31.C | 94 | utf_8 | d66c992a20c3561fa8622cdd1936d442 | // PR c++/54501
// { dg-options "" }
struct A
{
int i[0];
int j;
};
struct A a = { 1 };
|
google | android | bitfield1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/bitfield1.C | 370 | utf_8 | f3383f08918eed93161c080f618e55e8 | // Check that we handle bitfields as complex lvalues properly.
struct A
{
int i: 2;
int j: 2;
int k: 2;
};
A a, a2;
bool b;
void f ();
int main ()
{
(f(), a.j) = 1;
(f(), a).j = 2; // { dg-warning "overflow" }
(b ? a.j : a2.k) = 3; // { dg-warning "overflow" }
(b ? a : a2).j = 0;
++(a.j) = 1;
(a.... |
google | android | new14 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new14.C | 94 | utf_8 | f61f4940bc97502688606d4b7f1701a2 | // PR c++/23491
struct X
{
int m;
};
void f(int n)
{
const X *p = new const X[1] () ;
}
|
google | android | new26 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/init/new26.C | 584 | utf_8 | d20a83f8968c6c9a1d648762dc1a9e2c | // PR c++/33407
// { dg-do run }
// { dg-options "-O2 -fstrict-aliasing" }
extern "C" void * malloc(__SIZE_TYPE__);
extern "C" void abort(void);
void *p;
void __attribute__((noinline)) init(void)
{
p = malloc(4);
}
inline void *operator new(__SIZE_TYPE__)
{
return p;
}
inline void operator delete (void*) {}
in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.