OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/tags/gnu-src/gcc-4.5.1/gcc-4.5.1-or32-1.0rc1/gcc/testsuite/g++.dg/init
    from Rev 301 to Rev 338
    Reverse comparison

Rev 301 → Rev 338

/init-ref1.C
0,0 → 1,45
// Submitted by Erik Rozendaal <dlr@acm.org>
// 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 ();
if (a != 1)
abort ();
 
calls = 0;
int &c = ++identity (++foo (a));
if (calls > 1)
abort ();
if (&a != &c)
abort ();
if (a != 2)
abort ();
 
exit (0);
}
init-ref1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array0.C =================================================================== --- array0.C (nonexistent) +++ array0.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do compile } +// { dg-options "" } +// PR C++/24138 + +void foo() +{ + typedef struct { + unsigned char dir; + int data[0]; + } yanito; + static const yanito horse = { 1, { 2, 3 } }; // { dg-error "too many" } +}
array0.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: byval1.C =================================================================== --- byval1.C (nonexistent) +++ byval1.C (revision 338) @@ -0,0 +1,31 @@ +// PR c++/3948 +// Test that the destructor call for a value parameter gets the +// right address. + +// { dg-do run } + +void *p[2]; +int i; +int r; + +struct C +{ + int m; + + C() { p[i++] = this; } + ~C() { if (p[--i] != this) r = 1; } +}; + + +void Foo (C c) +{ + p[i++] = &c; +} + +int main () +{ + C c; + + Foo (c); + return r; +}
byval1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new25.C =================================================================== --- new25.C (nonexistent) +++ new25.C (revision 338) @@ -0,0 +1,29 @@ +// PR c++/31988 +#include + +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(); // { dg-error "first parameter" } + void* operator new[](std::size_t = 32, const std::nothrow_t&) throw(); // { dg-error "first parameter" } +}; + +class D +{ +public: + void* operator new(std::size_t, + const std::nothrow_t& = std::nothrow_t()) throw(); + void* operator new[](std::size_t, + const std::nothrow_t& = std::nothrow_t()) throw(); +}; + +class E +{ +public: + void* operator new(std::size_t = 0, + const std::nothrow_t& = std::nothrow_t()) throw(); // { dg-error "first parameter" } + void* operator new[](std::size_t = 0, + const std::nothrow_t& = std::nothrow_t()) throw(); // { dg-error "first parameter" } +};
new25.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array4.C =================================================================== --- array4.C (nonexistent) +++ array4.C (revision 338) @@ -0,0 +1,27 @@ +// { dg-do compile } +// Origin: Markus Breuer + +// PR c++/6944 +// Fail to synthesize copy constructor of multi-dimensional +// array of class. + +#include + +class Array +{ +public: + std::string m_array[10][20][30]; +}; + +Array func() +{ + Array result; + return result; // sorry, not implemented: cannot initialize multi-dimensional array with initializer +} + + +int main() +{ + Array arr = func(); +} +
array4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array8.C =================================================================== --- array8.C (nonexistent) +++ array8.C (revision 338) @@ -0,0 +1,12 @@ +struct A { + A (); +}; + +struct B { + A a1; + A a2; +}; + +A a; + +struct B b[] = { { a, a }, { a, a } };
array8.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: union1.C =================================================================== --- union1.C (nonexistent) +++ union1.C (revision 338) @@ -0,0 +1,5 @@ +// PR c++/14401 + +union U { + int& i; // { dg-error "" } +};
union1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: static3.C =================================================================== --- static3.C (nonexistent) +++ static3.C (revision 338) @@ -0,0 +1,26 @@ +// { 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; +}
static3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new2.C =================================================================== --- new2.C (nonexistent) +++ new2.C (revision 338) @@ -0,0 +1,17 @@ +// Origin: asharji@uwaterloo.ca + +// { dg-do compile } + +class bar { + public : + bar() { } + void * operator new ( __SIZE_TYPE__ , void * storage ) + { return (void *)1;} +}; + +class foo { + public: + void mem ( ) { + new ( 0 ) bar; + } +};
new2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref11.C =================================================================== --- ref11.C (nonexistent) +++ ref11.C (revision 338) @@ -0,0 +1,13 @@ +// PR c++/14230 + +struct A { + A (); + A (const A&); + A& operator= (const A&); +}; + +struct D { + A a; +}; + +const A& z = D().a;
ref11.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new6.C =================================================================== --- new6.C (nonexistent) +++ new6.C (revision 338) @@ -0,0 +1,8 @@ +// { dg-options "-fkeep-inline-functions" } + +struct B1 { virtual ~B1(); }; +struct B2 { virtual ~B2(); }; +struct D : B1, B2 {}; +struct X : D { X (); }; + +X::X () { new int; }
new6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: save1.C =================================================================== --- save1.C (nonexistent) +++ save1.C (revision 338) @@ -0,0 +1,20 @@ +// 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; }
save1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: global1.C =================================================================== --- global1.C (nonexistent) +++ global1.C (revision 338) @@ -0,0 +1,16 @@ +// PR c++/18416 + +class errarg { + enum { EMPTY } type; +public: + errarg(); +}; +extern errarg empty_errarg; +extern void errprint(const char *, + const errarg &arg1 = empty_errarg, + const errarg &arg2 = empty_errarg, + const errarg &arg3 = empty_errarg); +errarg::errarg() : type(EMPTY) +{ +} +errarg empty_errarg;
global1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array21.C =================================================================== --- array21.C (nonexistent) +++ array21.C (revision 338) @@ -0,0 +1,7 @@ +// PR c++/27722 + +void foo() +{ + const int x[] = 0; // { dg-error "size" } + ++x; +}
array21.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref15.C =================================================================== --- ref15.C (nonexistent) +++ ref15.C (revision 338) @@ -0,0 +1,34 @@ +// PR c++/20416. We correctly constructed the temporary S in foo(), +// but incorrectly destroyed it every time foo() was called. +// When using a wrapped target, there is no way to override the exit +// code after returning from main. +// { dg-do run { target unwrapped } } +extern "C" void abort (void); +extern "C" void _exit (int); + +int c, exiting; +struct S { + S() { ++c; } + S(const S &) { ++c; } + ~S() + { + if (!exiting) abort (); + _exit (0); + } +}; +void +foo (void) +{ + static const S &s = S(); +} +int main () +{ + if (c != 0) + abort (); + foo (); + foo (); + if (c != 1) + abort (); + exiting = 1; + return 1; +}
ref15.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: switch1.C =================================================================== --- switch1.C (nonexistent) +++ switch1.C (revision 338) @@ -0,0 +1,8 @@ +int f(int c) +{ + switch (c) + { + case d: /* { dg-error "'d' was not declared" } */ + int optBzip2 = true; + } +}
switch1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array25.C =================================================================== --- array25.C (nonexistent) +++ array25.C (revision 338) @@ -0,0 +1,49 @@ +// related to PR c++/38233 +// test for value-init of a member array +// { dg-do run } + +struct elt +{ + virtual void f(); + char c; +}; + +void elt::f() { } + +struct foo { + elt buffer[500]; + foo() ; + bool check () const; +}; + +foo::foo () + : buffer() +{} + +bool foo::check () const +{ + for (unsigned ix = sizeof (buffer)/ sizeof (buffer[0]); ix--;) + if (buffer[ix].c) + return false; + return true; +} + +inline void *operator new (__SIZE_TYPE__ size, void *p) +{ + return p; +} + +char heap[sizeof(elt[500])]; + +int main () +{ + for (unsigned ix = sizeof (heap); ix--;) + heap[ix] = ix; + + foo *f = new (heap) foo (); + if (!f->check ()) + return 3; + return 0; +} + +
array25.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dtor1.C =================================================================== --- dtor1.C (nonexistent) +++ dtor1.C (revision 338) @@ -0,0 +1,43 @@ +// { 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 (int i) : B (i) {} +}; + +struct A + : public C1, C2, virtual public D, virtual public E +{ + A () : D (0), E (1), C1 (2), C2 (3), x1(4), x2(5) {} + B x1; + B x2; +}; + + +int main () +{ + A a; + return 0; +}
dtor1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ctor4.C =================================================================== --- ctor4.C (nonexistent) +++ ctor4.C (revision 338) @@ -0,0 +1,20 @@ +// PR c++/17788 +// { dg-do compile } + +class foo { +public: + foo(); +}; + +class bar: public foo {// { dg-error "uninitialized" } +private: + int &a; +}; + +foo::foo() { +} + +int main(int argc, char **argv) +{ + bar x; // { dg-message "synthesized" } +}
ctor4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new13.C =================================================================== --- new13.C (nonexistent) +++ new13.C (revision 338) @@ -0,0 +1,11 @@ +// PR c++/22508 +// ICE on invalid operator new +// Origin: Flash Sheridan +// { dg-do compile } + +struct A +{ + void* operator new(__SIZE_TYPE__) throw(X); // { dg-error "" } +}; + +A* p = new A; // { dg-error "no suitable" }
new13.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref2.C =================================================================== --- ref2.C (nonexistent) +++ ref2.C (revision 338) @@ -0,0 +1,10 @@ +struct Base { + Base(); + Base(const Base &); + Base & operator = (const Base &); +}; + +struct Derived : public Base {}; + +Derived derived(); +const Base &b = derived();
ref2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: copy4.C =================================================================== --- copy4.C (nonexistent) +++ copy4.C (revision 338) @@ -0,0 +1,19 @@ +// PR c++/9342 +// We were failing to wrap def().user in a TARGET_EXPR, so copying it +// into the reference temp used a bitwise copy. + +struct QString +{ + QString( const QString & ); + QString &operator=( const QString & ); +}; +struct ServerSettings +{ + QString user; +}; +extern ServerSettings def(); +extern void arg( const QString& a ); +void startSession( bool b, QString s ) +{ + arg (b ? def().user : s); +}
copy4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: brace2.C =================================================================== --- brace2.C (nonexistent) +++ brace2.C (revision 338) @@ -0,0 +1,8 @@ +// { 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" }
brace2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: value3.C =================================================================== --- value3.C (nonexistent) +++ value3.C (revision 338) @@ -0,0 +1,31 @@ +// Testcase for value-initialization in new-expressions. +// { dg-do run } + +#include +#include + +// Make sure that we return memory that isn't already set to 0. +void *operator new(size_t s) +{ + void *p = malloc (s); + memset (p, 42, s); + return p; +} + +struct A { A() {} ~A() {} }; +struct B { A a; int i; }; + +int main() +{ + B *p = new B(); + if (p->i != 0) + abort(); + + p = new B[2](); + if (p[0].i != 0 || p[1].i != 0) + abort(); + + B(*p2)[2] = new B[2][2](); + if (p2[0][0].i != 0 || p2[0][1].i != 0) + abort(); +}
value3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ctor8.C =================================================================== --- ctor8.C (nonexistent) +++ ctor8.C (revision 338) @@ -0,0 +1,9 @@ +// PR c++/29039 + +typedef struct S { + int &r; +}; // { dg-warning "'typedef' was ignored" } + +S f () { + return S (); // { dg-error "reference" } +}
ctor8.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new17.C =================================================================== --- new17.C (nonexistent) +++ new17.C (revision 338) @@ -0,0 +1,37 @@ +// { 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 Vector +{ +public: + Vector() + { + for (int i = 0; i < D; ++i) + new (&x_m[i]) T(); + } + T& operator[](int i) { return x_m[i]; } + +private: + T x_m[D]; +}; + +void foo(Vector *m) +{ + Vector v; + v[0] = 1.0; + v[1] = 2.0; + v[3] = 3.0; + *m = v; +} + +// { dg-final { scan-tree-dump-times "= 0\.0" 1 "optimized" } } +// { dg-final { cleanup-tree-dump "optimized" } }
new17.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref6.C =================================================================== --- ref6.C (nonexistent) +++ ref6.C (revision 338) @@ -0,0 +1,12 @@ +struct B { + void g() { } +}; + +struct A { + void f() { + B &b = b; + b.g(); + } +}; + +int main(void) { }
ref6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: brace6.C =================================================================== --- brace6.C (nonexistent) +++ brace6.C (revision 338) @@ -0,0 +1,25 @@ +/* PR c++/30759 */ +/* { dg-do "compile" } */ + +struct A { + A(int) { } +}; + +struct B { + B(const B&); + int b; +}; + +struct C {}; + +struct D { int c; }; + +int main() +{ + int i = { 1 }; + int j = { 1, 2 }; /* { dg-error "requires one element" } */ + A a = { 6 }; /* { dg-error "initialize" } */ + B b = { 6 }; /* { dg-error "" } */ + C c = { 6 }; /* { dg-error "too many initializers" } */ + D d = { 6 }; +}
brace6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: value7.C =================================================================== --- value7.C (nonexistent) +++ value7.C (revision 338) @@ -0,0 +1,17 @@ +// PR c++/30111 +// { dg-do run } + +struct pod { + int i; +}; + +struct inherit : pod { + inherit() : pod() {} +}; + +int main() +{ + inherit i; + return i.i != 0; +} +
value7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bitfield1.C =================================================================== --- bitfield1.C (nonexistent) +++ bitfield1.C (revision 338) @@ -0,0 +1,24 @@ +// 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.j = 2) = 3; // { dg-warning "overflow" } +} + +
bitfield1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: aggr3.C =================================================================== --- aggr3.C (nonexistent) +++ aggr3.C (revision 338) @@ -0,0 +1,16 @@ +// PR c++/18793 + +struct S { + S(); + S(const S&); + void operator=(const S&); +}; + +struct X { + int a, b, c, d, e; + S s; +}; + +void foobar () { + X x = {0}; +}
aggr3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: attrib1.C =================================================================== --- attrib1.C (nonexistent) +++ attrib1.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do run } + +void f() __attribute((__constructor__)); +int i; +void f() { i = 1; } + +int main(int, char **) +{ + return 1-i; +}
attrib1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: for2.C =================================================================== --- for2.C (nonexistent) +++ for2.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do compile } +// PR 16012: Got the scope of I incorrect in templates only. + +template void foo() +{ + for (int i=0 ;;) ; + int i; +} + +void bar() +{ + foo<0>(); +}
for2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: error1.C =================================================================== --- error1.C (nonexistent) +++ error1.C (revision 338) @@ -0,0 +1,7 @@ +// PR c++/12696 + +struct A { + static float b[10]; +} + +float A::b[] = {1,2,3}; // { dg-error "" }
error1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: const4.C =================================================================== --- const4.C (nonexistent) +++ const4.C (revision 338) @@ -0,0 +1,8 @@ +// PR c++/27804 +// { dg-do compile } + +bool foo() +{ + const int i = X; // { dg-error "not declared" } + return i > 0; +}
const4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dso_handle1.C =================================================================== --- dso_handle1.C (nonexistent) +++ dso_handle1.C (revision 338) @@ -0,0 +1,11 @@ +// 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; }
dso_handle1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reference3.C =================================================================== --- reference3.C (nonexistent) +++ reference3.C (revision 338) @@ -0,0 +1,13 @@ +// { 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 +T f() +{ + T a = T(); // { dg-error "value-initialization of reference" } +} + +int &a = f(); // { dg-message "instantiated from here" } +
reference3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array13.C =================================================================== --- array13.C (nonexistent) +++ array13.C (revision 338) @@ -0,0 +1,9 @@ +template +struct test_disjoint_set { + static void do_test() + { + unsigned int elts[] + = { 0, 1, 2, 3 }; + const int N = sizeof(elts)/sizeof(*elts); + } +};
array13.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: enum1.C =================================================================== --- enum1.C (nonexistent) +++ enum1.C (revision 338) @@ -0,0 +1,10 @@ +enum test { + acceptable = -1, + unacceptable = 0xffffffffffffffffLL +}; // { dg-error "" } + +enum test t = acceptable, u = unacceptable; + +int main() { + return 0; +}
enum1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array17.C =================================================================== --- array17.C (nonexistent) +++ array17.C (revision 338) @@ -0,0 +1,8 @@ +// { dg-do compile } + + +class StringMap { + const char empty_str[1]; +public: + StringMap() : empty_str() {} +};
array17.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ptrmem3.C =================================================================== --- ptrmem3.C (nonexistent) +++ ptrmem3.C (revision 338) @@ -0,0 +1,8 @@ +// PR c++/28148 + +struct foo { +public: + virtual int bar(int); +}; + +void (foo::*__Virtual__foo__Var1)() = (void (foo::*)())(&foo::bar);
ptrmem3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: synth2.C =================================================================== --- synth2.C (nonexistent) +++ synth2.C (revision 338) @@ -0,0 +1,17 @@ +// PR c++/34180 + +struct G { + G(); // { dg-message "" "candidate" } + G(G&); // { dg-message "" "candidate" } +}; + +class A +{ // { dg-error "no match" } + const G g; +}; + +int main() +{ + A a; + A b = a; // { dg-message "required here" } +}
synth2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: placement1.C =================================================================== --- placement1.C (nonexistent) +++ placement1.C (revision 338) @@ -0,0 +1,10 @@ +// PR c++/11266 +// We were expanding the same TARGET_EXPR twice, for placement new and +// delete. + +void* operator new (__SIZE_TYPE__, void*) throw(); +void operator delete (void*, void*) throw(); + +struct A { A(); }; + +void foo() { new(new A)A; }
placement1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new22.C =================================================================== --- new22.C (nonexistent) +++ new22.C (revision 338) @@ -0,0 +1,3 @@ +// PR c++/29001 + +void* operator new (__SIZE_TYPE__) { return; } // { dg-error "with no value" }
new22.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: placement5.C =================================================================== --- placement5.C (nonexistent) +++ placement5.C (revision 338) @@ -0,0 +1,32 @@ +// 5.3.4/19: If the lookup finds the two-parameter form of a usual +// deallocation function (3.7.4.2) and that function, considered as a +// placement deallocation function, would have been selected as a match for +// the allocation function, the program is ill-formed. + +// But we should only complain about using op delete (void *, size_t) for +// placement delete if it would also be selected for normal delete, not if +// there's also an op delete (void *). + +typedef __SIZE_TYPE__ size_t; + +struct A +{ + A(); + void* operator new (size_t, size_t); + void operator delete (void *, size_t); // { dg-error "non-placement" } +}; + +struct B +{ + B(); + void * operator new (size_t); + void * operator new (size_t, size_t); + void operator delete (void *); + void operator delete (void *, size_t); +}; + +int main() +{ + A* ap = new (24) A; // { dg-error "placement delete" } + B* bp = new (24) B; +}
placement5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: init-ref2.C =================================================================== --- init-ref2.C (nonexistent) +++ init-ref2.C (revision 338) @@ -0,0 +1,42 @@ +// Submitted by Jason Merrill +// 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; + // Test that if so, it points to static data. + if (i != 42) + ++r; + + p = &i; +} + +void h () +{ + int arr[] = { 1, 1, 1, 1, 1, 1, 1 }; + g (); +} + +int main () +{ + g (); + h (); + return r; +}
init-ref2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array1.C =================================================================== --- array1.C (nonexistent) +++ array1.C (revision 338) @@ -0,0 +1,26 @@ +// Test that completing an array declared with a typedef doesn't change +// the typedef. + +// { dg-do run } + +typedef int iArr[]; + +const iArr array4={ + 1, 2, 3, 4 +}; + +const iArr array3={ + 1, 2, 3 +}; + +const iArr array5={ + 1, 2, 3, 4, 5 +}; + +int main() +{ + if (sizeof (array4)/sizeof (array4[0]) != 4 + || sizeof (array3)/sizeof (array3[0]) != 3 + || sizeof (array5)/sizeof (array5[0]) != 5) + return 1; +}
array1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new26.C =================================================================== --- new26.C (nonexistent) +++ new26.C (revision 338) @@ -0,0 +1,44 @@ +// 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*) {} + +int * __attribute__((noinline)) doit(int n) +{ + float *q; + int *r; + + for (int i=0; i
new26.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array5.C =================================================================== --- array5.C (nonexistent) +++ array5.C (revision 338) @@ -0,0 +1,52 @@ +// { dg-do run } +// Copyright (C) 2002 Free Software Foundation +// Contributed by Kriang Lerdsuwanakij + +// Incorrect construction and destruction of multi-dimensional +// array of class. + +extern "C" void abort(); +extern "C" int printf(const char *, ...); + +int count; +int num; + +struct A +{ + A() + { + if (count == num) + throw ""; + count++; +#ifdef PRINT + printf("ctor %p\n", static_cast(this)); +#endif + } + + ~A() + { + count--; +#ifdef PRINT + printf("dtor %p\n", static_cast(this)); +#endif + } +}; + +struct Array +{ + A array[2][2][2]; +}; + +int main() +{ + for (num = 0; num <= 8; ++num) { + count = 0; + try { + Array A; + } + catch (...) { + } + if (count != 0) + abort(); + } +}
array5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array9.C =================================================================== --- array9.C (nonexistent) +++ array9.C (revision 338) @@ -0,0 +1,9 @@ +struct T { + T (); +}; + +void f () { + T t[2]; + for (int i = 0; i < 10; ++i); + int i = 0; +}
array9.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cleanup1.C =================================================================== --- cleanup1.C (nonexistent) +++ cleanup1.C (revision 338) @@ -0,0 +1,16 @@ +// PR c++/13033 + +// We failed to treat the for increment expression as a full-expression, +// which broke gimplification. + +struct QDomNode { + virtual ~QDomNode(); + QDomNode nextSibling() const; + bool isNull() const; +}; + +void processNode(QDomNode n) +{ + for (; !n.isNull(); n = n.nextSibling()) + ; +}
cleanup1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: static-init1.C =================================================================== --- static-init1.C (nonexistent) +++ static-init1.C (revision 338) @@ -0,0 +1,5 @@ +// Related to the patch for 38880. +// Make sure we don't think we can initialize a at compile time. + +char c; +short a[] = { (short)((__PTRDIFF_TYPE__)&c + (__PTRDIFF_TYPE__)&c) };
static-init1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ptrfn1.C =================================================================== --- ptrfn1.C (nonexistent) +++ ptrfn1.C (revision 338) @@ -0,0 +1,12 @@ +// PR c++/29016 +// { dg-options "-O2" } + +class A; +class B +{ + typedef void (*C[5]) (A *); + static C D; + static void E (A*) {} +}; +B::C B::D={E}; +
ptrfn1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: union2.C =================================================================== --- union2.C (nonexistent) +++ union2.C (revision 338) @@ -0,0 +1,13 @@ +// 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" }
union2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new3.C =================================================================== --- new3.C (nonexistent) +++ new3.C (revision 338) @@ -0,0 +1,8 @@ +// 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() {}
new3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: empty1.C =================================================================== --- empty1.C (nonexistent) +++ empty1.C (revision 338) @@ -0,0 +1,30 @@ +// { dg-do run } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 3 Sept 2001 + +// Bug 4203. We were bit copying empty bases including the +// 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()) {} +}; + +int main() +{ + PEPE pepe(0xff); + + return pepe.t_ != 255; +}
empty1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref12.C =================================================================== --- ref12.C (nonexistent) +++ ref12.C (revision 338) @@ -0,0 +1,30 @@ +// PR c++/17435 +// { dg-do run } + +extern "C" void abort (); + +bool ok; + +struct A +{ + void func() const + { + ok = 1; + } + + ~A() + { + if (!ok) + abort (); + } +}; + +struct B : public A +{ +}; + +int main() +{ + A const& r1 = B(); + r1.func(); +}
ref12.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new7.C =================================================================== --- new7.C (nonexistent) +++ new7.C (revision 338) @@ -0,0 +1,7 @@ +template + struct Foo + {}; + + template + void Foo::NON_EXISTENT(int* val = new int()) {} // { dg-error "" } +
new7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array22.C =================================================================== --- array22.C (nonexistent) +++ array22.C (revision 338) @@ -0,0 +1,6 @@ +// PR C++/29002 +// We ICE trying to set the "zero" initializer on the incomplete +// array + +struct A {}; +int A::* x[]; // { dg-error "size" }
array22.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref16.C =================================================================== --- ref16.C (nonexistent) +++ ref16.C (revision 338) @@ -0,0 +1,23 @@ +// 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); +}
ref16.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: float1.C =================================================================== --- float1.C (nonexistent) +++ float1.C (revision 338) @@ -0,0 +1,19 @@ +// PR c++/21089 +// { dg-do run } + +extern "C" void abort(); + +static const double a = 1.0; +struct S { + S(); +}; +static S s; +static const double b = a + 1.0; + +S::S() { + if (b < 1.9 || b > 2.1) + abort (); +} + +int main () { +}
float1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array26.C =================================================================== --- array26.C (nonexistent) +++ array26.C (revision 338) @@ -0,0 +1,11 @@ +// PR c++/42058 +// { dg-options "" } + +struct A; + +struct B +{ + A a; // { dg-error "incomplete type" } +}; + +B b[1] = (B[]) { 0 }; // { dg-error "initializer" }
array26.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: complex1.C =================================================================== --- complex1.C (nonexistent) +++ complex1.C (revision 338) @@ -0,0 +1,7 @@ +/* PR c++/21210 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef float __complex__ fcomplex; +fcomplex cplx = fcomplex(); +
complex1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ctor1.C =================================================================== --- ctor1.C (nonexistent) +++ ctor1.C (revision 338) @@ -0,0 +1,57 @@ +// { dg-do run } + +// Copyright (C) 2002 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 12 Oct 2002 + +// 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 B::ok = -1; + +struct C +{ + A volatile a; + B volatile b[1]; + + C (); +}; + +C::C () +{ + throw 1; +} + +int main () +{ + try + { + C c; + } + catch (...) + { + if (A::ok != 1) + return 1; + if (B::ok != 1) + return 2; + return 0; + } + return 3; +}
ctor1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dtor2.C =================================================================== --- dtor2.C (nonexistent) +++ dtor2.C (revision 338) @@ -0,0 +1,28 @@ +// { 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; +}
dtor2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new10.C =================================================================== --- new10.C (nonexistent) +++ new10.C (revision 338) @@ -0,0 +1,8 @@ +// PR c++/14452 +// We got confused trying to preevaluate the new-initializer. + +struct S {}; +void foo (bool b) +{ + new S(b ? S() : S()); +}
new10.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: copy1.C =================================================================== --- copy1.C (nonexistent) +++ copy1.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do compile } + +class A { +public: + A(){} + A( const A& a ){} +}; + +class B : public A +{ +public: + B( int& s) : s_(s){} + int& s_; +}; + +int main() +{ + int i; + B x1( i ); + B x2( x1 ); +}
copy1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ctor5.C =================================================================== --- ctor5.C (nonexistent) +++ ctor5.C (revision 338) @@ -0,0 +1,17 @@ +// PR C++/21645 +// We were crashing because we forgot to update the type for +// the cloned argument for the cloned ctor. + +struct color { + ~color(); +}; +struct style { + color col; + style (color); +}; + +style::style(color c) + : col(c) +{ +} +
ctor5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pm1.C =================================================================== --- pm1.C (nonexistent) +++ pm1.C (revision 338) @@ -0,0 +1,88 @@ +// { dg-do run } + +// Copyright 2002 Free Software Foundation +// Contributed by Jason Merrill and Alexandre Oliva + +// Test zero-initialization of pointers to data members. Their NULL +// value is represented with -1, not 0. + +#include + +struct A +{ + int i; +}; + +int A::* gp; + +typedef int A::* iApm; + +iApm gp_zero = 0; +iApm gp_dflt = iApm(); +iApm gp_cast = (iApm)0; +iApm gp_func = iApm(0); +iApm gp_stat = static_cast(0); + +struct AD : A {}; + +int AD::* gp_impl = gp_dflt; +int AD::* gp_down = static_cast(gp_stat); + +int A::* ga[2]; + +// Test use in a simple struct. +struct B +{ + int A::* mp; +}; + +B gb; + +struct D; +struct C; +extern D gd; +extern C gc; + +// Test that in a class with a constructor, the pointer to member is +// zero-initialized until the constructor is run. +struct C +{ + int A::* mp; + inline C (); +}; + +int fail; +struct D +{ + int count; + inline D (); +}; + +C::C() : mp (&A::i) { gd.count++; } + +D::D() : count (0) +{ + if (gc.mp != 0) + abort (); +} + +// The D must come first for this to work. +D gd; +C gc; + +int main() +{ + static int A::* slp; + static int A::* sla[2]; + static B slb; + + if (gp != 0 || slp != 0 + || gp_zero != 0 || gp_dflt != 0 || gp_cast != 0 + || gp_func != 0 || gp_stat != 0 + || gp_impl != 0 || gp_down != 0) + abort (); + if (ga[1] != 0 || sla[1] != 0) + abort (); + if (gb.mp != 0 || slb.mp != 0) + abort (); +}
pm1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new14.C =================================================================== --- new14.C (nonexistent) +++ new14.C (revision 338) @@ -0,0 +1,11 @@ +// PR c++/23491 + +struct X +{ + int m; +}; + +void f(int n) +{ + const X *p = new const X[1] () ; +}
new14.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref3.C =================================================================== --- ref3.C (nonexistent) +++ ref3.C (revision 338) @@ -0,0 +1,12 @@ +struct Base { }; +struct Derived : public Base { }; +struct Choose { + operator Base&(); + operator Derived&(); +}; + +void f() +{ + Choose c; + Base& ref = c; +}
ref3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: copy5.C =================================================================== --- copy5.C (nonexistent) +++ copy5.C (revision 338) @@ -0,0 +1,29 @@ +// { dg-options "-O2" } + +struct BOOL { + int nVal:1, bSet:1; + BOOL (int i) : nVal(i!=0), bSet(1) {} +}; +struct Fill { + void *d; + Fill() : d(0) {} + Fill( const Fill& ) {} +}; +struct SvMetaSlot { + Fill aGroupId; + BOOL a8; + SvMetaSlot() : + a8(1) {} + SvMetaSlot* MakeClone() const; +}; + +SvMetaSlot* SvMetaSlot::MakeClone() const { return new SvMetaSlot( *this ); } + +extern "C" void abort(void); +int main() +{ + SvMetaSlot s; SvMetaSlot s2(s); + if (s.a8.bSet != s2.a8.bSet) + abort (); + return 0; +}
copy5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: brace3.C =================================================================== --- brace3.C (nonexistent) +++ brace3.C (revision 338) @@ -0,0 +1 @@ +int array[2][1] = { {0} {1} }; // { dg-error "" }
brace3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: value4.C =================================================================== --- value4.C (nonexistent) +++ value4.C (revision 338) @@ -0,0 +1,35 @@ +// PR c++/38233 + +template + struct pair + { + _T1 first; + _T2 second; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 265. std::pair::pair() effects overly restrictive + /** The default constructor creates @c first and @c second using their + * respective default constructors. */ + pair() + : first(), second() { } +}; + +class a { + public: + a(); +}; + +class b { + public: + // implicit default ctor + bool operator<(const b& rhs) const; + + private: + a a_val; +}; + +typedef pair my_pair; + +void func() { + my_pair x; +}
value4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ctor9.C =================================================================== --- ctor9.C (nonexistent) +++ ctor9.C (revision 338) @@ -0,0 +1,8 @@ +// PR c++/38427 +// { dg-do compile } + +struct S +{ + int &ref; + S() : ref() {}; // { dg-error "value-initialization of" } +};
ctor9.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new18.C =================================================================== --- new18.C (nonexistent) +++ new18.C (revision 338) @@ -0,0 +1,45 @@ +// { dg-do compile } +// { dg-options "-O2 -fstrict-aliasing" } + +// This caused an ICE during placement new. + +namespace Pooma { + typedef int Context_t; + namespace Arch { + } + inline Context_t context() { + } + inline int contexts() { + } + } +template struct DomainTraitsScalar { + }; +template struct DomainTraits : public DomainTraitsScalar { + }; +template class Grid; +template class DomainBase { + }; +template class Domain : public DomainBase
{ + }; +#include +template<> class Grid<1> : public Domain<1, DomainTraits > > { + }; +namespace Pooma { + class PatchSizeSyncer { + typedef Grid<1> Grid_t; + PatchSizeSyncer(int contextKey, Grid_t &localGrid); + int myContext_m; + int numContexts_m; + int localKey_m; + Grid_t localGrid_m; + typedef std::pair Elem_t; + std::vector gridList_m; + }; + } +namespace Pooma { + PatchSizeSyncer::PatchSizeSyncer(int contextKey, Grid_t &localGrid) : +myContext_m(Pooma::context()), numContexts_m(Pooma::contexts()), +localKey_m(contextKey), localGrid_m(localGrid) { + if (myContext_m == 0) gridList_m.reserve(numContexts_m); + } + }
new18.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref7.C =================================================================== --- ref7.C (nonexistent) +++ ref7.C (revision 338) @@ -0,0 +1,9 @@ +class hop +{ +public: + hop operator* () const; +}; +int main(void) +{ + const hop &x = *x; +}
ref7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bitfield2.C =================================================================== --- bitfield2.C (nonexistent) +++ bitfield2.C (revision 338) @@ -0,0 +1,33 @@ +// 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; +} + +int main() +{ + ar[0].c = 0xff; + ar[f()].e = E1; // here + return (c != 1 || ar[0].c != 0xff); +}
bitfield2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: aggr4.C =================================================================== --- aggr4.C (nonexistent) +++ aggr4.C (revision 338) @@ -0,0 +1,7 @@ +struct A +{ + int i; +}; + +A a1 = { 1 }; // ok +A a2 = { a1 }; // { dg-error "cannot convert" }
aggr4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: struct1.C =================================================================== --- struct1.C (nonexistent) +++ struct1.C (revision 338) @@ -0,0 +1,6 @@ +struct bug { + const char *name; + __SIZE_TYPE__ type; +}; + +struct bug s = { 0, (__SIZE_TYPE__) &s | 1 };
struct1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: assign1.C =================================================================== --- assign1.C (nonexistent) +++ assign1.C (revision 338) @@ -0,0 +1,30 @@ +// 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'; + + c.B::operator= (b); + if (c.a != 'b' || c.c != 'c') + return 1; +}
assign1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: const1.C =================================================================== --- const1.C (nonexistent) +++ const1.C (revision 338) @@ -0,0 +1,8 @@ +// PR c++/20073 + +template struct A +{ + A(); +}; + +const A<0> x[] = { A<0>() };
const1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: for3.C =================================================================== --- for3.C (nonexistent) +++ for3.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do compile } + +struct A { int i; A(); A(const A&); }; + +void bar() +{ + A a; + for ( ;; a=A() ) ; +}
for3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: const5.C =================================================================== --- const5.C (nonexistent) +++ const5.C (revision 338) @@ -0,0 +1,11 @@ +// PR c++/31449 + +class Foo {}; +class Bar : public Foo {}; +static const Foo *foo = 0; + +static Bar *bar = static_cast(foo); // { dg-error "conversion" } + +void func(const Foo *foo) { + Bar *bar = static_cast(foo); // { dg-error "conversion" } +}
const5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: error2.C =================================================================== --- error2.C (nonexistent) +++ error2.C (revision 338) @@ -0,0 +1,15 @@ +/* PR c++/29727 */ +/* { dg-do "compile" } */ + +template struct A +{ + static int a[1]; +}; +template int A::a[1] = { X:0 }; /* { dg-error "does not allow designated|was not declared|designated initializer for an array" } */ + +void foo() +{ + A<0>::a; +} + +
error2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array10.C =================================================================== --- array10.C (nonexistent) +++ array10.C (revision 338) @@ -0,0 +1,6 @@ +// { dg-do compile } +// { dg-options "" } + +typedef int __attribute__((vector_size (8))) vec; + +vec foo[] = { (vec) {1, 2} };
array10.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: addr-const1.C =================================================================== --- addr-const1.C (nonexistent) +++ addr-const1.C (revision 338) @@ -0,0 +1,38 @@ +// { dg-do run } + +// Copyright (C) 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 19 Apr 2003 + +// PR 9881. address-constant-expression not static initialized + +struct bar { + double p; +}; // bar + +bar v; +static bool error = false; + +struct foo { + static double *a; + static double *b; + static double storage; +}; + +struct baz { + baz () { + if (foo::a != &v.p) + error = true; + if (foo::b != &foo::storage) + error = true; + } +}; + +baz f; // Get constructor to run before any other non-static initializers + +double *foo::a = &(((bar *)(&v))->p); +double *foo::b = &(((bar *)(&foo::storage))->p); +double foo::storage = 0.0; + +int main() { + return error; +}
addr-const1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array14.C =================================================================== --- array14.C (nonexistent) +++ array14.C (revision 338) @@ -0,0 +1,21 @@ +// PR c++/12883 +// Bug: Destructor of array object not called if no prior +// instantiation of the template has happened. + +// { dg-do run } + +int ret = 1; + +template struct X +{ + X(int) { } + ~X() { ret = 0; } +}; + +int main() +{ + { + X<0> array[] = { 0 }; + } + return ret; +}
array14.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: delete1.C =================================================================== --- delete1.C (nonexistent) +++ delete1.C (revision 338) @@ -0,0 +1,7 @@ +// PR c++/19811 + +class C; // { dg-error "forward" } + +void foo(void *p) { + delete [] ((C*)p) ; // { dg-error "" } +}
delete1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: enum2.C =================================================================== --- enum2.C (nonexistent) +++ enum2.C (revision 338) @@ -0,0 +1,9 @@ +#include +enum test { + z = 0, + c = UINT_MAX + 1LL +} x = z; + +int main() { + return x != z; +}
enum2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: string1.C =================================================================== --- string1.C (nonexistent) +++ string1.C (revision 338) @@ -0,0 +1,8 @@ +extern void f (char*); + +extern const char * const target = "foo"; + +void g () +{ + f (target); // { dg-error "conversion" } +}
string1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array18.C =================================================================== --- array18.C (nonexistent) +++ array18.C (revision 338) @@ -0,0 +1,22 @@ +// PR c++/20142 +// { dg-do run } + +int n=4; + +struct A +{ + A() {} + A& operator= (const A&) { --n; return *this; } +}; + +struct B +{ + A x[2][2]; +}; + +int main() +{ + B b; + b = b; + return n; +}
array18.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ptrmem4.C =================================================================== --- ptrmem4.C (nonexistent) +++ ptrmem4.C (revision 338) @@ -0,0 +1,13 @@ +// PR c++/32245 +// { dg-do run } + +struct foo { + int mem1; + int foo::* mem2; +}; + +int main () { + foo x = { 0 } ; + if (x.mem2 != foo().mem2) + return 1; +}
ptrmem4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: placement2.C =================================================================== --- placement2.C (nonexistent) +++ placement2.C (revision 338) @@ -0,0 +1,22 @@ +// Bug: We were calling f() twice, for both the placement new and placement +// delete calls. + +// { dg-do run } + +void* operator new (__SIZE_TYPE__ sz, void*) { return operator new (sz); } +void operator delete (void* p, void*) { operator delete (p); } + +struct A { A() { throw 1; } }; + +int c; +void *f() { ++c; return 0; } + +int main() +{ + try + { + new (f()) A; + } + catch (...) {} + return c != 1; +}
placement2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: null1.C =================================================================== --- null1.C (nonexistent) +++ null1.C (revision 338) @@ -0,0 +1,6 @@ +// PR c++/16489 + +const int NULL = 0; +int main() { + double* p = NULL; +}
null1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new23.C =================================================================== --- new23.C (nonexistent) +++ new23.C (revision 338) @@ -0,0 +1,20 @@ +// 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 * num; ++i) + (i % 2 == 0) ? new (ptr) unsigned (2) : new (ptr++) unsigned (1); + if (ptr - data != num) + abort (); + return 0; +}
new23.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array2.C =================================================================== --- array2.C (nonexistent) +++ array2.C (revision 338) @@ -0,0 +1,8 @@ +// Check that the type of an array is set correctly when flat initializers +// are used. + +// { dg-do compile } + +struct s { int a; int b; }; +struct s x[] = { 1, 2, 3, 4 }; +int y[sizeof (x) == 2 * sizeof (x[0])? 1 : -1];
array2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: init-ref3.C =================================================================== --- init-ref3.C (nonexistent) +++ init-ref3.C (revision 338) @@ -0,0 +1,47 @@ +// Origin: Peter Schmid + +// { dg-do link } + +template +class Ptr { +protected: + T * ptr; + +public: + + Ptr(void) : ptr(0) { } + Ptr(T * p) : ptr(p) { } + + ~Ptr(void) { delete ptr; } + + operator T & () { return *ptr; } +}; + +class base { +public: + base(void) { } + ~base(void) { } +}; + + +class foo : public base { +private: + foo(const foo & rv); + +public: + + foo(void) { } + ~foo(void) { } +}; + +void func2(base & b) { + // ... +} + +int main () { + Ptr f = new foo; + /* This should not result in a copy; the result of the conversion + operator should be bound directly to the reference argument to + `func2'. */ + func2(f); +}
init-ref3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new27.C =================================================================== --- new27.C (nonexistent) +++ new27.C (revision 338) @@ -0,0 +1,40 @@ +// PR c++/34862 +// { dg-do run } +// { dg-options "-O2" } + +typedef __SIZE_TYPE__ size_t; +extern "C" void abort (); + +struct T +{ + void *operator new (size_t, char *&); + T () { i[0] = 1; i[1] = 2; } + int i[2]; +}; + +void * +T::operator new (size_t size, char *&p) +{ + void *o = (void *) p; + p += size; + return o; +} + +T * +f (char *&x) +{ + return new (x) T (); +} + +char buf[10 * sizeof (T)] __attribute__((aligned (__alignof (T)))); + +int +main () +{ + char *p = buf; + T *t = f (p); + if (p != buf + sizeof (T)) + abort (); + if (t->i[0] != 1 || t->i[1] != 2) + abort (); +}
new27.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: elide1.C =================================================================== --- elide1.C (nonexistent) +++ elide1.C (revision 338) @@ -0,0 +1,38 @@ +// { dg-do run } + +// Test that the destructor for a temporary passed by value isn't run +// until end of full-expression, as per [class.copy]: + +// Whenever a temporary class object is copied using a copy constructor, +// and this object and the copy have the same cv-unqualified type, an +// implementation is permitted to treat the original and the copy as two +// different ways of referring to the same object and not perform a copy +// at all, even if the class copy constructor or destructor have side +// effects.... In these cases, the +// object is destroyed at the later of times when the original and the +// copy would have been destroyed without the optimization. + +// Here, the temporary would be destroyed later than the parm, so either we +// must suppress the optimization in this case or destroy value parms in the +// caller. + +int d; + +struct A { + A () { } + A (const A&) { } + ~A() { ++d; } +}; + +void f (A a) { } + +int main () +{ + int r; + f (A ()), r = d; + + if (r < d && d) + return 0; + else + return 1; +}
elide1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array6.C =================================================================== --- array6.C (nonexistent) +++ array6.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do compile } + +char arr [][4] = { "one", "two" }; +const char arr2[][4] = { "one", "two" }; +signed char arr3[][4] = { "one", "two" }; +const unsigned char arr4[][4] = { "one", "two" }; +volatile wchar_t arr5[][4] = { L"one", L"two" };
array6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: static1.C =================================================================== --- static1.C (nonexistent) +++ static1.C (revision 338) @@ -0,0 +1,4 @@ +struct A { + static const int size = BOGUS; // { dg-error "" } +}; +const int A::size;
static1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cleanup2.C =================================================================== --- cleanup2.C (nonexistent) +++ cleanup2.C (revision 338) @@ -0,0 +1,19 @@ +// 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(); + ~A(); +}; + +void printQueryI() +{ + if(!strcmp(A(1).str(), "foo")) + { } +}
cleanup2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: static-init2.C =================================================================== --- static-init2.C (nonexistent) +++ static-init2.C (revision 338) @@ -0,0 +1,3 @@ +// PR c++/36912 +// { dg-options -frounding-math } +const double c = .1, d = c+1;
static-init2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ptrfn2.C =================================================================== --- ptrfn2.C (nonexistent) +++ ptrfn2.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-options "" } +// { dg-do compile } +// C++/30221 +// We would ICE while trying to reshape the pointer to +// member function element which is not needed. + + +class abstract {}; +typedef void (abstract::*fptr1) (short & s ) const; +struct s {}; +s array[] = +{ + (fptr1)0 +};// { dg-error "" }
ptrfn2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new4.C =================================================================== --- new4.C (nonexistent) +++ new4.C (revision 338) @@ -0,0 +1 @@ +int *x = new int [2] ();
new4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref13.C =================================================================== --- ref13.C (nonexistent) +++ ref13.C (revision 338) @@ -0,0 +1,7 @@ +// PR c++/28338 + +void foo() +{ + { static const int& i = 0; } + { static const int& i = 0; } +}
ref13.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new8.C =================================================================== --- new8.C (nonexistent) +++ new8.C (revision 338) @@ -0,0 +1,17 @@ +typedef __SIZE_TYPE__ size_t; + +enum Refcount_Type { + NO_REFCOUNT +}; + +struct d0_Unknown_Object +{ + void* operator new (size_t, size_t, Refcount_Type type); + void operator delete (void*, size_t, Refcount_Type); + d0_Unknown_Object (); +}; + +void make () +{ + new (10, NO_REFCOUNT) d0_Unknown_Object; +}
new8.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vector1.C =================================================================== --- vector1.C (nonexistent) +++ vector1.C (revision 338) @@ -0,0 +1,78 @@ +// PR c++/19263 +// { dg-do run } +// { dg-options "-O2" } + +typedef signed char v8qi __attribute__ ((vector_size (8))); + +extern "C" void abort (void); + +static unsigned char S[16]; + +struct A +{ + int i; + v8qi j, k; + int l; +}; + +void +foo (unsigned char v) +{ + A a = { 1, { v, v, v, v, v, v, v, v }, + { v + 1, v + 1, v + 1, v + 1, v + 1, v + 1, v + 1, v + 1 }, 3 }; + v8qi *s = (v8qi *) &S[0]; + *s = a.j; + s[1] = a.k; +} + +void +bar (unsigned char v) +{ + v8qi val8 = { v, v, v, v, v, v, v, v }; + v8qi *s = (v8qi *) &S[0]; + *s = val8; +} + +int n = 5, cnt; + +int +num (void) +{ + ++cnt; + return n; +} + +void +baz (void) +{ + static A a = { 0, { num (), num (), num (), num (), 6, 6, 6, 6 }, + { 7, 7, 7, 7, 8, 8, 8, 8 }, 0 }; + v8qi *s = (v8qi *) &S[0]; + *s = a.j; + s[1] = a.k; +} + +int +main () +{ + int i; + foo (1); + for (i = 0; i < 8; ++i) + if (S[i] != 1) + abort (); + for (; i < 16; ++i) + if (S[i] != 2) + abort (); + bar (3); + for (i = 0; i < 8; ++i) + if (S[i] != 3) + abort (); + return 0; + baz (); + if (cnt != 4) + abort (); + for (i = 0; i < 16; ++i) + if (S[i] != 5 + (i / 4)) + abort (); + return 0; +}
vector1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array23.C =================================================================== --- array23.C (nonexistent) +++ array23.C (revision 338) @@ -0,0 +1,6 @@ +// PR C++/29002 +// We ICE trying to set the "zero" initializer on the incomplete +// array + +struct A {A();int A::* t;}; +A x[]; // { dg-error "size" }
array23.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref17.C =================================================================== --- ref17.C (nonexistent) +++ ref17.C (revision 338) @@ -0,0 +1,23 @@ +// PR c++/35650 +// { dg-do compile } + +void f1 (); + +namespace N +{ + using::f1; + void f2 (); + void f3 (); +} + +using N::f3; + +void +test () +{ + void (&a) () = f1; + void (&b) () = N::f1; + void (&c) () = N::f2; + void (&d) () = f3; + void (&e) () = ::f3; +}
ref17.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array27.C =================================================================== --- array27.C (nonexistent) +++ array27.C (revision 338) @@ -0,0 +1,11 @@ +// PR c++/42058 +// { dg-options "" } + +struct A {}; + +struct B +{ + A a; +}; + +B b[1] = (B[]) { 0 }; // { dg-error "initializer" }
array27.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ctor2.C =================================================================== --- ctor2.C (nonexistent) +++ ctor2.C (revision 338) @@ -0,0 +1,34 @@ +// { dg-do run } + +// Copyright (C) 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 14 Mar 2003 + +// 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 : virtual public C {}; + +int main() +{ + new D(); + return A::a != B::a; +}
ctor2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: goto1.C =================================================================== --- goto1.C (nonexistent) +++ goto1.C (revision 338) @@ -0,0 +1,23 @@ +// PR c++/14724 +// { dg-do run } + +int j; + +template +struct C { + C() { ++j; } + ~C() { --j; } +}; + +int main(int, char **) { + { + int i = 0; + again: + C v; + if (++i < 10) + goto again; + } + + return j; +} +
goto1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: dtor3.C =================================================================== --- dtor3.C (nonexistent) +++ dtor3.C (revision 338) @@ -0,0 +1,21 @@ +// 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; +} +
dtor3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new11.C =================================================================== --- new11.C (nonexistent) +++ new11.C (revision 338) @@ -0,0 +1,21 @@ +// PR c++/17670 +// { dg-do run } + +#include +#include + +bool abort_new; +void *operator new[](size_t bytes) throw (std::bad_alloc) { + if (abort_new) + abort(); + return operator new (bytes); +} + + +struct X {}; +int main () { + // Do not abort until main is running in case startup code uses + // operator new[]. + abort_new = true; + new (X); +}
new11.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: copy2.C =================================================================== --- copy2.C (nonexistent) +++ copy2.C (revision 338) @@ -0,0 +1,5 @@ +// { dg-do compile } + +struct S { S (); }; + +volatile S s[1] = { S () };
copy2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: call1.C =================================================================== --- call1.C (nonexistent) +++ call1.C (revision 338) @@ -0,0 +1,35 @@ +// Bug c++/16115 +// { dg-options "-O2" } + +extern "C" void abort(); + +int count = 0; + +struct T { + T() { count++; } + T(const T&) { count++; } + ~T() { if (count==0) abort(); --count; } +}; + +struct auto_ptr { + T* p; + + auto_ptr(T* __p) : p(__p) { } + ~auto_ptr() { delete p; } + + T* release() { + T* t = p; + p = 0; + return t; + } +}; + +void destroy (auto_ptr a) { + delete a.release(); +} + + +int main () +{ + destroy (new T); +}
call1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: value1.C =================================================================== --- value1.C (nonexistent) +++ value1.C (revision 338) @@ -0,0 +1,22 @@ +// Test that with value-initialization, i is initialized to 0 +// and the vtable pointer is properly initialized. + +// { dg-do run } + +struct A +{ + int i; + virtual void f() {} +}; + +void f (A& a) +{ + a.f(); +} + +int main() +{ + A a = A(); + f (a); + return a.i; +}
value1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ctor6.C =================================================================== --- ctor6.C (nonexistent) +++ ctor6.C (revision 338) @@ -0,0 +1,20 @@ +// 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 bool dummy() +{ + Obj lhs, rhs; + return lhs == rhs; +} +int +main(int argc, char** argv) +{ + IteratorI* it2 = new IteratorI(); +}
ctor6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pm2.C =================================================================== --- pm2.C (nonexistent) +++ pm2.C (revision 338) @@ -0,0 +1,7 @@ +struct S { + S (); + int S::* sp; + int i; +}; + +S s[2] = {};
pm2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new15.C =================================================================== --- new15.C (nonexistent) +++ new15.C (revision 338) @@ -0,0 +1,19 @@ +// PR c++/9782 + +extern "C" void printf(const char*, ...); + +template +struct A { + A() {printf("A::A()\n");} +}; + + +struct B { + B() {printf("B::B()\n");} +}; + + +int main () { + new A<0>[1][1]; + new B [1][1]; +}
new15.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref4.C =================================================================== --- ref4.C (nonexistent) +++ ref4.C (revision 338) @@ -0,0 +1,18 @@ +// { 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. +}
ref4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: copy6.C =================================================================== --- copy6.C (nonexistent) +++ copy6.C (revision 338) @@ -0,0 +1,13 @@ +// PR c++/11878 + +struct A +{ + virtual ~A(); +}; + +template struct B +{ + T t; +}; + +void foo() { throw B().t; }
copy6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: brace4.C =================================================================== --- brace4.C (nonexistent) +++ brace4.C (revision 338) @@ -0,0 +1,5 @@ +// PR c++/16859 +// { dg-do compile } +// { dg-options "-pedantic" } + +int a[] = { }; // { dg-error "zero-size array" }
brace4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: value5.C =================================================================== --- value5.C (nonexistent) +++ value5.C (revision 338) @@ -0,0 +1,17 @@ +// PR c++/38232 + +class base { + public: + base(); + virtual ~base(); + + private: + int& int_ref; // initialized by base ctor, not visible here +}; + +class derived : public base { +}; + +base *make_derived() { + return new derived(); +}
value5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: aggr1.C =================================================================== --- aggr1.C (nonexistent) +++ aggr1.C (revision 338) @@ -0,0 +1,19 @@ +// Test that initializing an aggregate with complex copy constructor +// and assignment ops doesn't cause cp_expr_size to abort. + +struct A +{ + A(); + A(const A&); + A& operator=(const A&); +}; + +struct B +{ + A a; +}; + +int main () +{ + B b = { A() }; +}
aggr1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new19.C =================================================================== --- new19.C (nonexistent) +++ new19.C (revision 338) @@ -0,0 +1,73 @@ +// { 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; } + +template +class Vector +{ +public: + Vector() + { + for (int i = 0; i < D; ++i) + new (&x_m[i]) T(); + } + T& operator[](int i) { return x_m[i]; } + +private: + T x_m[D]; +}; + +struct sia +{ + int ai[3]; +}; + +struct s +{ + struct si + { + sia* p; + } asi[3]; + float* pd; +}; + +class c +{ + int foo(int, int, int); + s sm; +}; + + +extern void bar(Vector*, int); +int c::foo(int f1, int f2, int f3) +{ + float sum = 0; + for (int i = 0; i < 3; ++i) + { + for (int j = 0; j < 3; ++j) + { + Vector v; + v[0] = 1.0; + v[1] = 2.0; + v[2] = 3.0; + for (int k = 0; k < 3; ++k) + { + float f = (f1 * this->sm.asi[0].p->ai[0] + + f2 * this->sm.asi[1].p->ai[0] + + f3 * this->sm.asi[2].p->ai[0]); + sum += f * v[k]; + } + *this->sm.pd = sum; + } + } + return sum; +} + +// { dg-final { scan-tree-dump "Replaced.*->ai\\\[0\\\]" "pre" } } +// { dg-final { cleanup-tree-dump "pre" } }
new19.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pmf1.C =================================================================== --- pmf1.C (nonexistent) +++ pmf1.C (revision 338) @@ -0,0 +1,17 @@ +// PR c++/14089 +// { dg-do compile } +// +// C++ front end generated assignment between types that were not +// compatible in any sense visible to the optimizers. + +struct pair { + typedef void (pair::*fp)(); + int first; + pair::fp second; + pair(const int& a, const pair::fp& b) : first(a), second(b) {} + void f(const int& a, const pair::fp& b) { first = a; second = b; } +}; + +void op() { + pair(5, pair::fp()); +}
pmf1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref8.C =================================================================== --- ref8.C (nonexistent) +++ ref8.C (revision 338) @@ -0,0 +1,10 @@ +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" } +}
ref8.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: struct2.C =================================================================== --- struct2.C (nonexistent) +++ struct2.C (revision 338) @@ -0,0 +1,22 @@ +/* PR c++/23180. */ +/* Initialize a local structure with an expression that attempts to use + pointer arithmetic to calculate another structure field offset. */ + +void saveLoadEntries(const void *); + +void saveOrLoad() { + struct Track { + char soundName[15]; + }; + struct SaveLoadEntry { + int offs; + int type; + int size; + }; + + SaveLoadEntry trackEntries = { + ((long) (__SIZE_TYPE__) (&((Track *) 42)->soundName[0])) - 42, + 0, 1 + }; + saveLoadEntries(&trackEntries); +}
struct2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: const2.C =================================================================== --- const2.C (nonexistent) +++ const2.C (revision 338) @@ -0,0 +1,7 @@ +// PR c++/19878 + +struct S { + char k; +}; +char const volatile S::* const p01 = &S::k; +
const2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: const6.C =================================================================== --- const6.C (nonexistent) +++ const6.C (revision 338) @@ -0,0 +1,27 @@ +// PR c++/36688 +// { dg-do run } +// { dg-options "-O2" } + +struct S +{ + long long a; + long long b; + long long c; +}; + +struct T +{ + S g; + long long h[12]; +}; + +static const S s = { 1, 2, 3 }; +static const T t = { s, 0 }; + +int +main () +{ + T x = t; + if (__builtin_memcmp (&x, &t, sizeof (T))) + __builtin_abort (); +}
const6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reference1.C =================================================================== --- reference1.C (nonexistent) +++ reference1.C (revision 338) @@ -0,0 +1,11 @@ +// { 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 + +int main() +{ + typedef int& T; + T a = T(); // { dg-error "value-initialization of reference" } +} +
reference1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array11.C =================================================================== --- array11.C (nonexistent) +++ array11.C (revision 338) @@ -0,0 +1,28 @@ +/* PR 11665 + Orgin: jwhite@cse.unl.edu + The problem was in initializer_constant_valid_p, + "for a CONSTRUCTOR, only the last element + of the CONSTRUCTOR was being checked" + (from the email of the patch which fixed this). + This used to ICE because GCC thought gdt_table was a + constant value when it is not. */ + +int x; + +typedef __SIZE_TYPE__ size_t; + +struct gdt +{ +size_t a,b,c,d,e,f; +}; +void f() +{ +struct gdt gdt_table[2]= +{ + { + 0, + ( (((size_t)(&x))<<(24))&(-1<<(8)) ), + }, +}; +} +
array11.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: delete2.C =================================================================== --- delete2.C (nonexistent) +++ delete2.C (revision 338) @@ -0,0 +1,55 @@ +// 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) + abort (); + free (p); +} + +struct B1 +{ + virtual ~B1 () throw() {} + B1 (){} + int x; +}; +struct B2 +{ + virtual ~B2 () throw() {} + B2 (){} + int x; +}; +struct D : B1, B2 +{ + D (){} + ~D () throw() {} + int y; +}; +void f1 (D*); +void f2 (B2*); +void f3 (B1*); +int main (void) +{ + f1 (::new D); + f2 (::new D); + f3 (::new D); +} +void f1 ( D* p) { ::delete p; } +void f2 (B2* p) { ::delete p; } +void f3 (B1* p) { ::delete p; }
delete2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array15.C =================================================================== --- array15.C (nonexistent) +++ array15.C (revision 338) @@ -0,0 +1,46 @@ +// { dg-do run } + +// Copyright (C) 2004 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 8 Dec 2004 + +// PR 16681 too much memory used +// Origin: Matt LaFary + +struct foo { + unsigned char buffer[4111222]; + foo() ; + bool check () const; +}; + +foo::foo () + : buffer() +{} + +bool foo::check () const +{ + for (unsigned ix = sizeof (buffer); ix--;) + if (buffer[ix]) + return false; + return true; +} + +void *operator new (__SIZE_TYPE__ size, void *p) +{ + return p; +} + +char heap[5000000]; + +int main () +{ + for (unsigned ix = sizeof (heap); ix--;) + heap[ix] = ix; + + foo *f = new (heap) foo (); + + if (!f->check ()) + return 1; + return 0; +} + +
array15.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ptrmem1.C =================================================================== --- ptrmem1.C (nonexistent) +++ ptrmem1.C (revision 338) @@ -0,0 +1,7 @@ +// PR c++/16853 + +struct A {}; +struct B {}; + +int B::* b; +int A::* a = b; // { dg-error "" }
ptrmem1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: member1.C =================================================================== --- member1.C (nonexistent) +++ member1.C (revision 338) @@ -0,0 +1,21 @@ +// Copyright (C) 2005 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 13 Jun 2005 + +// Origin: Ivan Godard +// Bug 20789: ICE on invalid + +template struct A; + +template struct B {}; + +template struct C +{ + static const int i = A::i; // { dg-error "incomplete" } + static const int j = i; // { dg-error "non-constant expression" } + B b; // { dg-error "not a valid template arg" } +}; + +C c; + +int i = C::i; +int j = C::j;
member1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array19.C =================================================================== --- array19.C (nonexistent) +++ array19.C (revision 338) @@ -0,0 +1,4 @@ +// { dg-do compile } +// { dg-options "" } +double a[0] = { }; +const double b[0][1] = { };
array19.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new20.C =================================================================== --- new20.C (nonexistent) +++ new20.C (revision 338) @@ -0,0 +1,6 @@ +// 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" } + +
new20.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: placement3.C =================================================================== --- placement3.C (nonexistent) +++ placement3.C (revision 338) @@ -0,0 +1,30 @@ +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 (7) S (12); + } catch (int) { + if (i) + return 1; + } +}
placement3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new24.C =================================================================== --- new24.C (nonexistent) +++ new24.C (revision 338) @@ -0,0 +1,18 @@ +// PR c++/33025 +// { dg-do compile } +// { 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[num]; + unsigned *ptr = new (data) unsigned (num); + static unsigned data2[10]; + unsigned *ptr2 = new (&data2[0]) unsigned (10); + return 0; +}
new24.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: volatile1.C =================================================================== --- volatile1.C (nonexistent) +++ volatile1.C (revision 338) @@ -0,0 +1,16 @@ +// PR c++/26577 +// The call to bar() was causing an inappropriate dereference of *this, +// which led to an abort in cp_expr_size. + +struct A +{ + A(const A&); + A& operator=(const A&); + static void bar(); + void baz() volatile; +}; + +void A::baz() volatile +{ + bar(); +}
volatile1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: init-ref4.C =================================================================== --- init-ref4.C (nonexistent) +++ init-ref4.C (revision 338) @@ -0,0 +1,21 @@ +// Origin: dgregor@gcc.gnu.org +// PR c++/11384 +// foo::_S_something was not being emitted (as a weak definition). + +// { dg-do run } +// { dg-require-weak "" } + +template + struct foo + { + static const T _S_something; + }; + +template + const T foo::_S_something = T(); + +int main() +{ + const int* p = &foo::_S_something; + return 0; +}
init-ref4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array3.C =================================================================== --- array3.C (nonexistent) +++ array3.C (revision 338) @@ -0,0 +1,23 @@ +// PR c++/6331 +// Bug: we were generating a badly cv-qualified ARRAY_TYPE in the +// synthesized copy constructor for A, which then became the canonical +// version, confusing later uses. + +struct A { + virtual ~A(); + const float* f(); + float fa[3]; +}; + +struct B { + B(const A& ai) : a (ai) {} + A a; +}; + +void g (const float pos[3]); + +extern A& a; +void h() +{ + g (a.f()); +}
array3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: elide2.C =================================================================== --- elide2.C (nonexistent) +++ elide2.C (revision 338) @@ -0,0 +1,30 @@ +// PR c++/8674 + +// Bug: Since B().a is an rvalue, we tried to treat it like a TARGET_EXPR +// and elide the copy. But that produces a bitwise copy, which causes us +// to abort in cp_expr_size. + +// Test that we actually run the A copy constructor when calling f(). + +// { dg-do run } + +int c; + +struct A +{ + A () { ++c; } + A (const A&) { ++c; } +}; + +struct B +{ + A a; +}; + +void f (A) { } + +int main () +{ + f (B().a); + return c < 2; +}
elide2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array7.C =================================================================== --- array7.C (nonexistent) +++ array7.C (revision 338) @@ -0,0 +1,15 @@ +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]) {} + + +
array7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: static2.C =================================================================== --- static2.C (nonexistent) +++ static2.C (revision 338) @@ -0,0 +1,25 @@ +// PR 14804 +// { dg-do run } + +struct A { + virtual void foo() = 0; +}; + +struct B : public A { + virtual void bar() = 0; +}; + +typedef void (A::*mfptr)(); + +struct D { + mfptr p; +}; + +static const D ds[] = { + { reinterpret_cast(&B::bar) }, +}; + +int main() +{ + return 0; +}
static2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new1.C =================================================================== --- new1.C (nonexistent) +++ new1.C (revision 338) @@ -0,0 +1,19 @@ +// Origin: asharji@uwaterloo.ca + +// { 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; + } +};
new1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cleanup3.C =================================================================== --- cleanup3.C (nonexistent) +++ cleanup3.C (revision 338) @@ -0,0 +1,22 @@ +// 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 { + ~S(); +}; + +struct T { + S s; +}; + +S s; +T t; + +void f() { + static S s; +}
cleanup3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ptrfn3.C =================================================================== --- ptrfn3.C (nonexistent) +++ ptrfn3.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-options "" } +// { dg-do compile } +// C++/30221 +// We would ICE while trying to reshape the pointer to +// member function element which is not needed. + + +class abstract {}; +typedef void (abstract::*fptr1) (short & s ) const; +struct s {fptr1 f;}; +s array[] = +{ + (fptr1)0 +};
ptrfn3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref10.C =================================================================== --- ref10.C (nonexistent) +++ ref10.C (revision 338) @@ -0,0 +1,14 @@ +// PR c++/13478 + +struct A {}; +struct B : protected A { + B() {} + B(const A& ) {} +private: + B(const B& ) {} +}; + +void foo(const A* ap) +{ + const B& br = *ap; +}
ref10.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new5.C =================================================================== --- new5.C (nonexistent) +++ new5.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do run } + +#include + +void * operator new[](size_t, std::nothrow_t const &) throw() +{ return NULL; } + +struct X { + struct Inner { ~Inner() {} }; + + X() { + Inner * ic = new (std::nothrow) Inner[1]; // SegFault here + } +}; + +int main() { + X table; +}
new5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array20.C =================================================================== --- array20.C (nonexistent) +++ array20.C (revision 338) @@ -0,0 +1,5 @@ +// PR c++/27385 + +struct A {}; +A a[] = { 0 }; // { dg-error "initializer" } +
array20.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref14.C =================================================================== --- ref14.C (nonexistent) +++ ref14.C (revision 338) @@ -0,0 +1,11 @@ +// PR c++/33459 + +union A +{ + int &i; // { dg-error "may not have reference type" } +}; + +void foo() +{ + A(); +}
ref14.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new9.C =================================================================== --- new9.C (nonexistent) +++ new9.C (revision 338) @@ -0,0 +1,22 @@ +// PR 12337 + +class A {}; + +template +class X : public A { +public: + X(T&); +}; + +class B { +public: + bool foo(A*); + template + bool foo(T& t) { return foo(new X(t)); } +}; + +int main() +{ + B x, y; + x.foo(y); +}
new9.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array24.C =================================================================== --- array24.C (nonexistent) +++ array24.C (revision 338) @@ -0,0 +1,7 @@ +// PR c++/29175 +// { dg-options "" } + +void foo(int i) +{ + int x[][i] = { 0 }; // { dg-error "variable-sized|storage size" } +}
array24.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: goto2.C =================================================================== --- goto2.C (nonexistent) +++ goto2.C (revision 338) @@ -0,0 +1,11 @@ +// PR c++/20721 + +bool f(); +void g(int i) +{ + if (i) goto bad; // { dg-error "from" } + bool a = f(); // { dg-error "initialization" } + bad: // { dg-error "jump" } + ; +} +
goto2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ctor3.C =================================================================== --- ctor3.C (nonexistent) +++ ctor3.C (revision 338) @@ -0,0 +1,6 @@ +// PR c++/14401 + +struct S { + S() {} // { dg-error "" } + const int i; +};
ctor3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new12.C =================================================================== --- new12.C (nonexistent) +++ new12.C (revision 338) @@ -0,0 +1,6 @@ +// PR c++/18369 + +void breakme () +{ + int *v = new (int [5]); +}
new12.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: brace1.C =================================================================== --- brace1.C (nonexistent) +++ brace1.C (revision 338) @@ -0,0 +1,4 @@ +// { dg-do compile } + +int i[4] = { { 3 } }; // { dg-error "brace" } +
brace1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: copy3.C =================================================================== --- copy3.C (nonexistent) +++ copy3.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do run } +// { dg-options "-fno-elide-constructors" } + +int copies; + +struct S { + S () {} + S (const S&) { ++copies; } +}; + +S s[1] = { S () }; + +int main () { + if (copies != 1) + return 1; +}
copy3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref1.C =================================================================== --- ref1.C (nonexistent) +++ ref1.C (revision 338) @@ -0,0 +1,5 @@ +void f(void) +{ + short x = 0; + const int &y = x; +}
ref1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ctor7.C =================================================================== --- ctor7.C (nonexistent) +++ ctor7.C (revision 338) @@ -0,0 +1,51 @@ +// { dg-do run } + +// Copyright (C) 2005 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 13 Oct 2005 + +// PR 23984:ICE +// Origin: Andrew Pinski pinskia@gcc.gnu.org + +struct B +{ + virtual void Foo (); +}; + +void B::Foo () +{ +} + +struct D : virtual B +{ +}; + +struct E +{ + B *ptr; + + E (B *); +}; + +static B *ptr; + +E::E (B *ptr_) + :ptr (ptr_) +{ +} + +struct G : D, E +{ + G (); +}; + +G::G () + : E (this) +{ +} + +int main () +{ + G object; + + return object.ptr != &object; +}
ctor7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: value2.C =================================================================== --- value2.C (nonexistent) +++ value2.C (revision 338) @@ -0,0 +1,23 @@ +// PR c++/35116 +// Test that break_out_target_exprs works properly with complex +// value-initialization. + +struct A +{ + virtual void f (); +}; + +struct B +{ + A a; +}; + +struct C +{ + C (int, B = B()); +}; + +void f () +{ + C c (4); +}
value2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: inline1.C =================================================================== --- inline1.C (nonexistent) +++ inline1.C (revision 338) @@ -0,0 +1,14 @@ +// PR c++/9167 +// { dg-options "-finline" } + +struct A { + ~A(); + A f(A) { } +}; + + +void f(void) +{ + A a; + a.f(a); +}
inline1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: pm3.C =================================================================== --- pm3.C (nonexistent) +++ pm3.C (revision 338) @@ -0,0 +1,10 @@ +// 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 () { +}
pm3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new16.C =================================================================== --- new16.C (nonexistent) +++ new16.C (revision 338) @@ -0,0 +1,38 @@ +// { 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__((noinline)) foo(double *p, int n) +{ + long *f; + for (int i=0; i
new16.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: brace5.C =================================================================== --- brace5.C (nonexistent) +++ brace5.C (revision 338) @@ -0,0 +1,7 @@ +// PR c++/27491 +// { dg-do compile } +// { dg-options "" } + +int i = (int) { 0 }; +int j = (int) { i }; +int k = (int) { k };
brace5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: copy7.C =================================================================== --- copy7.C (nonexistent) +++ copy7.C (revision 338) @@ -0,0 +1,39 @@ +// PR c++/39480 +// It isn't always safe to call memcpy with identical arguments. +// { dg-do run } + +extern "C" void abort(); +extern "C" void * +memcpy(void *dest, void *src, __SIZE_TYPE__ n) +{ + if (dest == src) + abort(); + else + { + __SIZE_TYPE__ i; + for (i = 0; i < n; i++) + ((char *)dest)[i] = ((const char*)src)[i]; + } +} + +struct A +{ + double d[10]; +}; + +struct B: public A +{ + char bc; +}; + +B b; + +void f(B *a1, B* a2) +{ + *a1 = *a2; +} + +int main() +{ + f(&b,&b); +}
copy7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref5.C =================================================================== --- ref5.C (nonexistent) +++ ref5.C (revision 338) @@ -0,0 +1,12 @@ +struct A { }; +struct B : public A { }; +struct X { + operator B(); +}; +X x; + +int main() +{ + const A& r = x; + return 0; +}
ref5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: aggr2.C =================================================================== --- aggr2.C (nonexistent) +++ aggr2.C (revision 338) @@ -0,0 +1,46 @@ +// 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 = this; } + A2(const A2&); + ~A2() { if (this != p) abort (); } + void print () { } +}; + +A2* A2::p; + +struct B2 { + A2 a2; +}; + +int main () { + b.a.print (); + { + B2 b2 = { A2() }; + b2.a2.print (); + } +} +
aggr2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: value6.C =================================================================== --- value6.C (nonexistent) +++ value6.C (revision 338) @@ -0,0 +1,13 @@ +// PR c++/39109 + +struct N +{ + private: + virtual ~N (); +}; + +N * +foo () +{ + return new N (); +}
value6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ref9.C =================================================================== --- ref9.C (nonexistent) +++ ref9.C (revision 338) @@ -0,0 +1,36 @@ +// { 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_from_basic (b); } +inline ex::~ex() { if (--bp->refcount == 0) delete bp; } +void ex::construct_from_basic(const basic &b) { + const ex & tmpex = b.eval(); + bp = tmpex.bp; + bp->refcount++; +} + +ex pow() { return basic(); } + +int main() +{ + try { pow (); } catch (int) {} + return 0; +}
ref9.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: for1.C =================================================================== --- for1.C (nonexistent) +++ for1.C (revision 338) @@ -0,0 +1,28 @@ +// PR c++/13865 +// Bug: We were destroying 'a' before executing the loop. + +#include + +int i; +int r; + +class A +{ +public: + A() { printf("A ctor\n"); } + ~A() + { + printf("A dtor\n"); + if (i != 1) + r = 1; + } +}; + +int main(int argc, char **argv) +{ + for (A a; i < 2; ++i) { + printf("iteration %d\n", i); + } + + return r; +}
for1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: struct3.C =================================================================== --- struct3.C (nonexistent) +++ struct3.C (revision 338) @@ -0,0 +1,15 @@ +/* PR c++/23180. */ +/* Initialize a global variable with an expression that attempts to use + pointer arithmetic to calculate a structure field offset. */ + +struct Track { + char soundName[15]; +}; + +struct SaveLoadEntry { + int offs; + int type; + int size; +}; + +int foobar = ((long) (__SIZE_TYPE__) (& ((Track *) 42)->soundName[0])) - 42;
struct3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: const3.C =================================================================== --- const3.C (nonexistent) +++ const3.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do run } + +struct S { + static const int i = 3; +}; + +const int S::i; + +int main () { + if (!S::i) + return 1; +}
const3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: self1.C =================================================================== --- self1.C (nonexistent) +++ self1.C (revision 338) @@ -0,0 +1,19 @@ +// PR c++/29106 +// { dg-do run } + +int i; + +void f(__SIZE_TYPE__) { + i = 3; +} + + +int main() +{ + int* const savepos = sizeof(*savepos) ? 0 : 0; + + f (sizeof (*savepos)); + + if (i != 3) + return 1; +}
self1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: const7.C =================================================================== --- const7.C (nonexistent) +++ const7.C (revision 338) @@ -0,0 +1,13 @@ +// { 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-final { cleanup-tree-dump "gimple" } }
const7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: reference2.C =================================================================== --- reference2.C (nonexistent) +++ reference2.C (revision 338) @@ -0,0 +1,13 @@ +// { 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 f() +{ + typedef int& T; + T a = T(); // { dg-error "value-initialization of reference" } +} +
reference2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array12.C =================================================================== --- array12.C (nonexistent) +++ array12.C (revision 338) @@ -0,0 +1,28 @@ +// PR c++/12253 +// Bug: We were failing to destroy the temporary A passed to the +// constructor for b[0] before going on to construct b[1]. + +// { dg-do run } + +extern "C" int printf (const char *, ...); + +int c; +int r; + +struct A +{ + A() { printf ("A()\n"); if (c++) r = 1; } + A(const A&) { printf ("A(const A&)\n"); ++c; } + ~A() { printf ("~A()\n"); --c; } +}; + +struct B +{ + B(int, const A& = A()) { printf ("B()\n"); } +}; + +int main() +{ + B b[] = { 0, 0 }; + return r; +}
array12.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: array16.C =================================================================== --- array16.C (nonexistent) +++ array16.C (revision 338) @@ -0,0 +1,112 @@ +// Causes timeout for the MMIX simulator on a 3GHz P4 and we can't +// have "compile" for some targets and "run" for others. +// { dg-do run { target { ! mmix-*-* } } } +// { dg-options "-mstructure-size-boundary=8" { target arm-*-* } } + +// Copyright (C) 2004 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 8 Dec 2004 + +// PR 16681 too much memory used +// Origin: Matt LaFary + +// NOTE: This test assumes that 4M instances of struct ELT can fit into +// a 5MB array. This isn't true, e.g., with the default +// arm-none-elf options. + +struct elt +{ + static int count; + static elt*ptr; + static int abort; + char c; + + elt (); + ~elt (); + +}; + +int elt::count; +elt *elt::ptr; +int elt::abort; + +elt::elt () + :c () +{ + if (count >= 0) + { + if (!ptr) + ptr = this; + if (count == 100) + throw 2; + if (this != ptr) + abort = 1; + count++; + ptr++; + } +} + +elt::~elt () +{ + if (count >= 0) + { + ptr--; + count--; + if (ptr != this) + abort = 2; + } +} + +struct foo { + elt buffer[4111222]; + foo() ; + bool check () const; +}; + +foo::foo () + : buffer() +{} + +bool foo::check () const +{ + for (unsigned ix = sizeof (buffer)/ sizeof (buffer[0]); ix--;) + if (buffer[ix].c) + return false; + return true; +} + +void *operator new (__SIZE_TYPE__ size, void *p) +{ + return p; +} + +char heap[5000000]; + +int main () +{ + for (unsigned ix = sizeof (heap); ix--;) + heap[ix] = ix; + + try + { + foo *f = new (heap) foo (); + return 1; + } + catch (...) + { + if (elt::count) + return 2; + if (elt::abort) + return elt::abort + 3; + } + + for (unsigned ix = sizeof (heap); ix--;) + heap[ix] = ix; + + elt::count = -1; + foo *f = new (heap) foo (); + if (!f->check ()) + return 3; + return 0; +} + +
array16.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ptrmem2.C =================================================================== --- ptrmem2.C (nonexistent) +++ ptrmem2.C (revision 338) @@ -0,0 +1,12 @@ +// PR c++/19916 +// { dg-do run } + +struct S { + char k; +}; + +char const volatile S::* const p01 = &S::k; +int main(void) +{ + return 0; +}
ptrmem2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: synth1.C =================================================================== --- synth1.C (nonexistent) +++ synth1.C (revision 338) @@ -0,0 +1,17 @@ +// PR middle-end/17525 + +struct A +{ + ~A(); + int a; +}; + +struct B : public A +{ + virtual ~B(); +}; + +void run (B& b, B& b1) +{ + b1 = b; +}
synth1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: new21.C =================================================================== --- new21.C (nonexistent) +++ new21.C (revision 338) @@ -0,0 +1,10 @@ +// PR c++/32251 + +struct A { + A(); + void operator delete(void *, ...); +}; + +void foo () { + new A; // { dg-warning "deallocation" } +}
new21.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: placement4.C =================================================================== --- placement4.C (nonexistent) +++ placement4.C (revision 338) @@ -0,0 +1,32 @@ +// PR c++/34158 + +typedef __SIZE_TYPE__ size_t; +extern "C" void* malloc (size_t); +extern "C" void free (void *); + +template class undef; + +struct A { + A() { throw 1; } +}; + +template class Pool { }; + +void *operator new(size_t size,Pool& pool) +{ + return malloc(size); +} + +template +void operator delete(void *p,Pool& pool) +{ + undef t; // { dg-error "incomplete" } + free(p); +} + +int main () +{ + Pool pool; + new (pool) A(); // { dg-message "instantiated" } + return 0; +}
placement4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.