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++.old-deja/g++.other
    from Rev 305 to Rev 338
    Reverse comparison

Rev 305 → Rev 338

/linkage7.C
0,0 → 1,14
// { dg-do link }
// Origin: Mark Mitchell <mark@codesourcery.com>
 
namespace N {
extern "C" int i;
 
void f () {
i = 3;
}
}
 
int i;
 
int main () { N::f (); }
linkage7.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: unchanging1.C =================================================================== --- unchanging1.C (nonexistent) +++ unchanging1.C (revision 338) @@ -0,0 +1,46 @@ +// { dg-do run } +// { dg-options "-O2" } + +#include +#include + +using namespace std; + +class A { +protected: + int a; + complex *b; +public: + A(int n); + inline complex& operator[] (int x); +}; + +A::A(int n) +{ + a = n; + b = new complex[a]; + for (int i=0; i(0.0,0.0); +} + +inline complex& A::operator[](int x) +{ + if (x < 0 || x >= a) + cout << "x error" << endl; + return b[x]; +} + +void foo () +{ + int n = 5; + A *o = new A(n); + A *p = new A(n); + for (int i = 0; i < n; i++) { + cout << i << endl; + (*o)[i] *= complex((*p)[i].real(), (*p)[i].imag()); + } +} + +int main() +{ + foo(); +}
unchanging1.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: regstack.C =================================================================== --- regstack.C (nonexistent) +++ regstack.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do run { target i?86-*-* x86_64-*-* } } +// { dg-options "-O2" } + +inline double foo (double x) +{ + register double r; + asm volatile ("fsqrt" : "=t" (r) : "0" (x)); + return r; +} + +struct X +{ + ~X() {} +}; + +int b; + +double bar (X x) +{ + if (b) + return 1.0; + return 36.0 * foo (36.0); +} + +int main () +{ + X x; + if (bar (x) != 216.0) + return 1; + return 0; +}
regstack.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: rtti2.C =================================================================== --- rtti2.C (nonexistent) +++ rtti2.C (revision 338) @@ -0,0 +1,89 @@ +// { dg-do run } +// { dg-options "-frtti" } +// test of rtti of single inheritance and multiple inheritance classes + +#include + +extern "C" { + int printf(const char *, ...); + void exit(int); +} + +class X { + public: + int xi; +}; + +class Y : public X { + short ys; +}; + +class Z : public Y { + int zi; +}; + +Z z; +Y y; +Y *yp = &z; +X *xp = &z; +Z *zp = &z; + +class A { + public: + int Ai; +}; + +class B { + public: + int Bi; +}; + +class D : public A, public B { + int Di; +}; + +/* +class E : public D, public B { + int Ei; +}; +*/ +class E { + int Ei; +}; + +class F : public E, public D { + int Fi; +}; + +D d; +A *ap = &d; +B *bp = &d; +F f; +A *aap = &f; +D *dp = &f; +B *bbp = dp; + +void *vp = zp; + +void error (int i) +{ + exit(i); +} + +int main () +{ + if (typeid(z) != typeid(Z)) error(1); + if (typeid(*yp) == typeid(Z)) error(2); + if (typeid(*yp) == typeid(*zp)) error(3); + if (typeid(xp) == typeid(yp)) error(4); + + xp = (X *)&y; + if (typeid(*xp) == typeid(*yp)) error(5); + if (typeid(*xp) == typeid(Y)) error(6); + + if (typeid(*ap) == typeid(*bp)) error (31); + if (typeid(*ap) == typeid(D)) error(32); + + if (typeid(*aap) == typeid(*bbp)) error(33); + if (typeid(*dp) == typeid(*aap)) error(34); +}
rtti2.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: crash42.C =================================================================== --- crash42.C (nonexistent) +++ crash42.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// { dg-options "-g" } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 25 Jul 2001 + +// Bug 3152. Using a typedef to declare a function used an unset +// global variable, last_function_parms. + +struct actor +{ + typedef bool (operation)(); + + operation a; + operation b; + operation c; +};
crash42.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: crash25.C =================================================================== --- crash25.C (nonexistent) +++ crash25.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// { dg-options "-fshow-column" } +// Origin: Jakub Jelinek + +class X { // { dg-error "1:new types may not be defined in a return type" "new types" } +// { dg-message "1:\\(perhaps a semicolon is missing after the definition of 'X'\\)" "note" { target *-*-* } 5 } +public: + X(); + virtual ~X(); +} + +X::x() // { dg-error "6:no 'X X::x\\(\\)' member function declared in class 'X'" } +{ +} + +X::~x() // { dg-error "6:expected class-name before '\\(' token" } +{ +}
crash25.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: lineno4.C =================================================================== --- lineno4.C (nonexistent) +++ lineno4.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } + +#define x \ + y + +int; // { dg-error "" } invalid declaration +
lineno4.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,16 @@ +// { dg-do assemble } + +class A +{ + private: + int myInt; + + public: + A& operator = (int right) {myInt = right; return *this;} +}; + +union B +{ + char f1; + A f2; // { dg-bogus "" } non-copy assignment op is OK +};
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: cleanup4.C =================================================================== --- cleanup4.C (nonexistent) +++ cleanup4.C (revision 338) @@ -0,0 +1,34 @@ +// { dg-do assemble } +// { dg-options "-O2 -fno-exceptions" } +// Origin: Jakub Jelinek + +class foo +{ +public: + foo (); + ~foo (); +}; + +class bar +{ +public: + bar (); + bar (const foo&); +}; + +int i; +foo f (); + +inline bar x () +{ + switch (i) + { + case 0: return bar (f ()); + default: return bar (); + } +} + +bar y () +{ + return x (); +}
cleanup4.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: dtor12.C =================================================================== --- dtor12.C (nonexistent) +++ dtor12.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do run } +// Test that we don't complain about calling a destructor on a const object. + +#include + +struct A +{ + ~A() {} +}; + +const A a = {}; +int main() +{ + a.~A(); + a.A::~A(); // { dg-bogus "" } const violation +}
dtor12.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: debug8.C =================================================================== --- debug8.C (nonexistent) +++ debug8.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// { dg-options "-g" } + +struct X { + const int x[4]; +}; + +struct A { + A(); + A(const A&); +}; + +struct B { + A a; + int b[4]; +}; + +struct C { + A a; + C() { B b=B(); }; +};
debug8.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: inline10.C =================================================================== --- inline10.C (nonexistent) +++ inline10.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// { dg-options "-O2" } +// Origin: Mark Mitchell + +struct S +{ +}; + +inline const S f () +{ + return S (); +} + +void g () +{ + S s; + f (); +}
inline10.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: dcast1.C =================================================================== --- dcast1.C (nonexistent) +++ dcast1.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } + +class C { +public: + virtual void f(); +}; + +extern volatile C* cp; +extern volatile C& cr; + +void f () +{ + dynamic_cast(cp); // { dg-error "" } cannot dynamic_cast + dynamic_cast(cr); // { dg-error "" } cannot dynamic_cast +}
dcast1.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: lookup16.C =================================================================== --- lookup16.C (nonexistent) +++ lookup16.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do assemble } +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 25 Aug 1999 + +// Bug 3 +// typenames are not injected early enough, [basic.scope.pdecl]3.3.1/4 +// indicates this should compile. + +struct A { +}; + +struct B : A { + typedef A Parent; + struct F { + }; +}; + +struct C : B { + typedef B Parent; + struct G {}; + struct F : C::Parent::F { + typedef C::Parent::F Parent; + }; +}; + +struct D : B { + typedef B Parent; + struct F : D::Parent::F { // finds the wrong Parent + typedef D::Parent::F Parent; + }; +};
lookup16.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: redecl3.C =================================================================== --- redecl3.C (nonexistent) +++ redecl3.C (revision 338) @@ -0,0 +1,8 @@ +// { dg-do assemble } +// Bug: g++ thought this was a redeclaration of a local variable. + +int i; +int main () +{ + extern int i; +}
redecl3.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: realloc.C =================================================================== --- realloc.C (nonexistent) +++ realloc.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } + +extern "C" void realloc(); + +class bug { +public: + void realloc(int foo,int bar); +}; + +void f() { + bug c; + c.realloc(50,50); +} +
realloc.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: anon7.C =================================================================== --- anon7.C (nonexistent) +++ anon7.C (revision 338) @@ -0,0 +1,24 @@ +// { dg-do assemble } + +struct A { + union { + int a; // { dg-error "" } conflicts with previous declaration + }; + int a; // { dg-error "" } +}; + +struct B { + int b; // { dg-error "" } conflicts with previous declaration + union { + int b; // { dg-error "" } duplicate member + }; +}; + +struct C { + union { + int c; // { dg-error "" } conflicts with previous declaration + }; + union { + int c; // { dg-error "" } duplicate member + }; +};
anon7.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: init2.C =================================================================== --- init2.C (nonexistent) +++ init2.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do run } +// { dg-options "-O3" } + +typedef int (*fp)(); + +struct S +{ + fp f; +}; + +static int f() +{ + return 0; +} + +static const S s = { &f }; + +int main() +{ + return (*s.f)(); +}
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: static11.C =================================================================== --- static11.C (nonexistent) +++ static11.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Origin: Raja R Harinath + +enum ReservedName { + rIGNORE, + rINCLUDE +}; + +void maybeStatusKeyword() +{ + static const ReservedName statusKeywords[] = { rINCLUDE, rIGNORE }; + for (int i = 0; i < 2; i++) { + ReservedName r = statusKeywords[i]; + } +}
static11.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,15 @@ +// { dg-do assemble } +// Origin: Jason Merrill + + struct A { + int operator * (); + }; + struct B : public A { }; + int operator * (B &); + + int main () + { + B b; + B& br = b; + *br; + }
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: dtor9.C =================================================================== --- dtor9.C (nonexistent) +++ dtor9.C (revision 338) @@ -0,0 +1,24 @@ +// { dg-do run } +int i; + +struct CC +{ + virtual ~CC () { ++i; } +}; + +class BB : virtual public CC +{ +}; + +class AA : public virtual BB +{ +}; + +int main () +{ + { + AA xx; + } + if (i != 1) + return 1; +}
dtor9.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: ambig3.C =================================================================== --- ambig3.C (nonexistent) +++ ambig3.C (revision 338) @@ -0,0 +1,34 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 23 June 2000 + +// Origin GNATS bug report 69 from Glenn Ammons +// +// A base which derives a virtual base hides declarations in the virtual base, +// even if that virtual base is accessible via another path [10.2]/6. Make +// sure that non-virtual bases of the virtual base are also hidden, not matter +// what order bases are declared in. + +struct A {int a;}; +struct B : A {}; + +struct L1 : virtual B { int a; }; +struct L2 : virtual A { int a; }; + +struct R1 : virtual B {}; +struct R2 : virtual A {}; + +struct C1 : R1, L1 {}; +struct C2 : R2, L2 {}; + +struct D1 : L1, R1 {}; +struct D2 : L2, R2 {}; + +void fn (C1 *c1, D1 *d1, C2 *c2, D2 *d2) +{ + c1->a = 1; + d1->a = 1; + c2->a = 1; + d2->a = 1; +}
ambig3.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: overload7.C =================================================================== --- overload7.C (nonexistent) +++ overload7.C (revision 338) @@ -0,0 +1,23 @@ +// { dg-do run } +// Check that object call works when there are multiple conversion ops +// returning the same type. + +typedef int (*pfn)(); + +int zero () { return 0; } +int one () { return 1; } +int two () { return 2; } + +struct A { + A() { } + operator pfn () { return one; } + operator pfn () const { return zero; } + operator pfn () volatile { return two; } +}; + +int +main () +{ + const A a; + return a(); +}
overload7.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: crash34.C =================================================================== --- crash34.C (nonexistent) +++ crash34.C (revision 338) @@ -0,0 +1,23 @@ +// { dg-do assemble } +// Origin: Jakub Jelinek + + +class v +{ + double x, y; +public: + v(); +}; + +class w : public v { +public : + static const w X; + w(); +}; + +void bar(w x); + +void foo() +{ + bar(w::X); +}
crash34.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: crash17.C =================================================================== --- crash17.C (nonexistent) +++ crash17.C (revision 338) @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Origin: Dima Volodin + +class C { + static int const N (1000); // { dg-error "" } invalid declaration +};
crash17.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: pmf7.C =================================================================== --- pmf7.C (nonexistent) +++ pmf7.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do assemble } +// Test for proper diagnostics on trying to take the address of a non-static +// member function. + +struct A { + void f (); + void f (int); + void g (); +}; + +int main () +{ + A a; + &a.f; // { dg-error "" } overloaded + &a.g; // { dg-error "" } can't write a pmf like this +}
pmf7.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: cast1.C =================================================================== --- cast1.C (nonexistent) +++ cast1.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do assemble } + +struct S0 { }; +struct S1 : virtual public S0 { }; +struct S2 : virtual public S0 { }; + +struct S3 : public S1, public S2, virtual public S0 +{ +}; + +void f(const S0*) {} + +void g() +{ + f(static_cast(0)); +}
cast1.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: typeid1.C =================================================================== --- typeid1.C (nonexistent) +++ typeid1.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// { dg-options "" } +// Origin: sk@gluit.de + +#include + +int main () +{ + typeid(char*); + + int len = 1; + char carr[len]; + typeid(typeof(carr)); // { dg-error "" } type has variable size + typeid(carr); // { dg-error "" } type has variable size +}
typeid1.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: defarg9.C =================================================================== --- defarg9.C (nonexistent) +++ defarg9.C (revision 338) @@ -0,0 +1,52 @@ +// { dg-do assemble } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 24 April 2001 + +// Bug 2608. A default parameter introduced in the definition of a +// ctor never made it into the clones, leading to later overload +// resolution failures. This is related to bug 2356. + +struct A +{ + A (int, int); +}; + +A::A (int d, int = 0) +{ + if (d) + { + A a (0); + } +} + +void get_width () +{ + A a (1); +} + +struct B : A +{ + B (); +}; +B::B () + :A (1) +{ +} + +struct C : virtual A +{ + C (int, int); +}; +C::C (int, int = 0) + :A (1) +{ +} +struct D: C +{ + D (); +}; +D::D () + :A (0), C (0) +{ +}
defarg9.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: builtins8.C =================================================================== --- builtins8.C (nonexistent) +++ builtins8.C (revision 338) @@ -0,0 +1,25 @@ +// { dg-do run } +// { dg-options "-O2" } +// Test that built-in functions are recognized with a prototype. +// Origin: Roger Sayle Mar 20, 2002 +// Copyright (C) 2002 Free Software Foundation. +// + + +extern "C" void link_error (void); + +namespace std { +typedef __SIZE_TYPE__ size_t; +extern "C" size_t strlen (const char*); +} + +using namespace std; + +int +main () +{ + if (strlen ("foo") != 3) + link_error (); + return 0; +} +
builtins8.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: type.C =================================================================== --- type.C (nonexistent) +++ type.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } + +typedef unsigned short ushort; +class foo { +public: + static ushort a; +}; +extern "C" { +typedef unsigned short ushort; +} +ushort foo::a; +static int baz() +{ + return foo::a; +}
type.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,16 @@ +// { dg-do run } +extern "C" void abort(); + +struct A +{ + enum { a = 3}* p; + int f() { return (int) a; } +}; + +int main() +{ + A a; + + if (a.f() != 3) + abort(); +}
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: ptrmem3.C =================================================================== --- ptrmem3.C (nonexistent) +++ ptrmem3.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } + +class c { + void (c::*x)(); +public: + void f() { this->x(); } // { dg-error "" } pointer-to-member +};
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: access7.C =================================================================== --- access7.C (nonexistent) +++ access7.C (revision 338) @@ -0,0 +1,33 @@ +// { dg-do assemble } +// Test that access control for types and statics works properly +// with nested types. + + +class A { + static int I1; // { dg-error "" } private + struct B1 { }; // { dg-error "" } private +public: + static int I2; + struct B2 { }; +}; + +class D: public A { + struct E { + void f (); + }; +}; + +void D::E::f () +{ + int i = I1; // { dg-error "" } within this context + B1 b1; // { dg-error "" } within this context + i = I2; + B2 b2; +} + +void f () +{ + A::B1 b1; // { dg-error "" } within this context + new A::B1; // { dg-error "" } within this context + (A::B1) b1; // { dg-error "" } within this context +}
access7.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: static20.C =================================================================== --- static20.C (nonexistent) +++ static20.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do link } +struct foo +{ + foo() {} + ~foo() {} + void func() { static foo x; } +}; + +int main() +{ + foo f; + return 0; +}
static20.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: loop1.C =================================================================== --- loop1.C (nonexistent) +++ loop1.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do run } +// { dg-options "-O2" } +// Test for bad loop optimization of goto fixups. + +typedef bool (*ftype) (); + +int c, d; +struct A { + A() { ++c; } + A(const A&) { ++c; } + ~A() { ++d; } +}; + +void f (ftype func) +{ + A a; + do { + if ((*func)()) return; + } while (true); +} + +bool test () +{ + return true; +} + +main () +{ + f (test); + return (c != d); +}
loop1.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: conv5.C =================================================================== --- conv5.C (nonexistent) +++ conv5.C (revision 338) @@ -0,0 +1,8 @@ +// { dg-do assemble } +// { dg-options "" } + +// Based on bug report by Thomas Kunert + + +int foo(); +const int (*bar)() = foo; // { dg-error "" } adding const
conv5.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: dyncast5.C =================================================================== --- dyncast5.C (nonexistent) +++ dyncast5.C (revision 338) @@ -0,0 +1,38 @@ +// { dg-do run } +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 6 Jun 1999 + +// dynamic cast can only cast to public unambiguous bases + +extern "C" void abort (); + +struct A {virtual ~A(){} int m; }; +struct B {virtual ~B(){} int m; }; + +struct C1 : A {int m;}; +struct C2 : A {int m;}; + +// A is ambiguous, but private in one branch +struct D1 : B, C1, private C2 {int m;}; +// A is ambiguous, and public in both branches +struct D2 : B, C1, C2 {int m;}; + +void fn(B *bd1, B *bd2) +{ + A *ad1; + A *ad2; + + ad1 = dynamic_cast(bd1); + if(ad1) abort(); + ad2 = dynamic_cast(bd2); + if(ad2) abort(); +} + +int main() +{ + D1 d1; + D2 d2; + + fn((B *)&d1, (B *)&d2); + return 0; +}
dyncast5.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: externC3.C =================================================================== --- externC3.C (nonexistent) +++ externC3.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do run } +// Test that two extern "C" declarations of the same name in different +// namespaces are treated as declaring the same function. + +namespace foo { + extern "C" int f (); +} + +extern "C" int f () { return 0; } + +using namespace foo; + +int main () +{ + f (); +}
externC3.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,27 @@ +// { dg-do run } +int i; + +struct S { + S (int) { + ++i; + if (i == 3) + throw 3; + } + + S () {} + + ~S() { + --i; + } +}; + +int main() +{ + try { + S s[5] = { 0, 1, 2, 3, 4 }; + } catch (...) { + } + + if (i != 1) + 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: rtti3.C =================================================================== --- rtti3.C (nonexistent) +++ rtti3.C (revision 338) @@ -0,0 +1,97 @@ +// { dg-do run } +// { dg-options "-frtti" } +// test of rtti of single inheritance and multiple inheritance with +// virtual functions + +#include + +extern "C" { + int printf(const char *, ...); + void exit(int); +} + +class X { + public: + int xi; + virtual int f() {return 0;}; +}; + +class Y : public X { + short ys; +}; + +class Z : public Y { + int zi; +}; + +Z z; +Y y; +Y *yp = &z; +X *xp = &z; +Z *zp = &z; + +class A { + public: + int Ai; + virtual int a() {return 0;}; +}; + +class B { + public: + int Bi; + virtual int g() {return 0;}; +}; + +class D : public A, public B { + int Di; +}; + +/* +class E : public D, public B { + int Ei; +}; +*/ +class E { + int Ei; +}; + +class F : public E, public D { + int Fi; +}; + +D d; +A *ap = &d; +B *bp = &d; +D *dp = &d; +F f; +A *aap = &f; +B *bbp = &f; + +void *vp = zp; + +void error (int i) +{ + exit(i); +} + +int main () +{ + if (typeid(z) != typeid(Z)) error(1); + if (typeid(*yp) != typeid(Z)) error(2); + if (typeid(*yp) != typeid(*zp)) error(3); + if (typeid(xp) == typeid(yp)) error(4); + + xp = (X *)&y; + if (typeid(*xp) == typeid(*yp)) error(5); + if (typeid(*xp) != typeid(Y)) error(6); + + if (typeid(*ap) != typeid(*bp)) error (31); + if (typeid(*ap) != typeid(D)) error(32); + vp = dp; + vp = dynamic_cast ((B *)vp); + if (dp != (D *)vp) error(35); + + dp = (D *)&f; + if (typeid(*aap) != typeid(*bbp)) error(37); + if (typeid(*dp) != typeid(*aap)) error(38); +}
rtti3.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: crash60.C =================================================================== --- crash60.C (nonexistent) +++ crash60.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } + +void foo () +{ + int e; + e := e; // { dg-error "" } parse error +}
crash60.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: crash26.C =================================================================== --- crash26.C (nonexistent) +++ crash26.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// Origin: Jakub Jelinek + +class foo { +public: + foo(int); +}; + +void bar(bool x) +{ + if(x) + foo *a = new foo(foo::not); // { dg-error "" } +}
crash26.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: lineno5.C =================================================================== --- lineno5.C (nonexistent) +++ lineno5.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do assemble } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 25 Jul 2001 + +// Origin: johanb@DoCS.UU.SE +// Bug 3621. At the end of saved input, we'd set the lineno to +// zero. This would confusing things no end, if there was a subsequent +// error. + +namespace tmp { + typedef int B; + B b; +} + +class A { + public: + int kaka(tmp::B = b); // { dg-error "" } no b in scope +};
lineno5.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,39 @@ +// { dg-do run } +// Bug: g++ crashed on empty initializers for unions. +// Bug: gcc and g++ didn't zero unions with empty initializers. +// Submitted by J"orn Rennecke + +extern "C" void exit (int); + +typedef union u +{ + union u *up; + void *vp; +} u; + +static u v = {}; + +void bar (u); +void baz (u); + +void foo() +{ + u w = {}; + u x = { &v }; + baz (x); + bar (w); +} + +void baz (u w) { } + +void bar (u w) +{ + if (w.up) + exit (1); +} + +int main () +{ + foo (); + return 0; +}
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,27 @@ +// { dg-do run } +typedef __SIZE_TYPE__ size_t; + +template +struct A +{ + int size; + A () + { + size = 20; + T *p; + p = new T[size]; + int foo; + foo = 5 * size; + } +}; + +struct B +{ + virtual ~B() { } + void operator delete [] (void *ptr, size_t size) { } +}; + +int main () +{ + A *p = new A; +}
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: dtor13.C =================================================================== --- dtor13.C (nonexistent) +++ dtor13.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +template struct S { ~S(); }; +int i; + +void f () +{ + i.~S(); // { dg-error "" } invalid destructor call. +}
dtor13.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: cvt1.C =================================================================== --- cvt1.C (nonexistent) +++ cvt1.C (revision 338) @@ -0,0 +1,23 @@ +// { dg-do assemble } + +typedef int Array_T[2]; + +struct S1 { + S1(const Array_T&); +}; + +struct S2 { + S1 g(); + Array_T a; +}; + +S1 S2::g() +{ + return S1(a); +} + +void h() +{ + S2 s2; + s2.g(); +}
cvt1.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: debug9.C =================================================================== --- debug9.C (nonexistent) +++ debug9.C (revision 338) @@ -0,0 +1,42 @@ +// { dg-do assemble } +// { dg-options "-g" } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Jeffrey D. Oldham 2001 May 17 . + +// This illustrates that debugging information for CONCAT RTL's +// supports only COMPLEX_TYPE types, not other types. + +namespace std { + template class complex; + + template<> class complex + { + public: + complex(double =0.0, double =0.0); + + private: + typedef __complex__ double _ComplexT; + _ComplexT _M_value; + }; + + inline + complex::complex(double __r, double __i) + { + __real__ _M_value = __r; + __imag__ _M_value = __i; + } +} + +template +class Engine +{ +public: + Engine (T val = T()) {} +}; + +int main() +{ + Engine<1, std::complex > e; + return 0; +}
debug9.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,28 @@ +// { dg-do run } +// Origin: Mark Mitchell +// This test case checks that the return value optimization works for +// empty classes. + +// PR c++/5995 + +extern "C" void abort(); +extern "C" int printf (const char *, ...); + +int i; + +struct A; + +struct A* as[10]; + +struct A { + A () { as[i++] = this; } + A (const A&) { as[i++] = this; } + ~A() { if (i == 0 || as[--i] != this) abort(); } +}; + +A f() { return A(); } + +int main () +{ + A a (f ()); +}
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: inline11.C =================================================================== --- inline11.C (nonexistent) +++ inline11.C (revision 338) @@ -0,0 +1,34 @@ +// { dg-do assemble } +// { dg-options "-O2" } +// Origin: Jakub Jelinek + +class baz +{ +public: + baz& operator += (const baz&); +}; + +inline baz& baz::operator += (const baz& r) +{ + return *this; +} + +inline baz operator + (int x, const baz& y) +{ + return y; +} + +static inline baz bar (int alpha); +static inline baz foo (int alpha) +{ + baz tmp = alpha + foo (alpha); + tmp += alpha + bar (alpha); + return tmp; +} + +static inline baz bar (int alpha) +{ + baz tmp = alpha + bar (alpha); + tmp += alpha + foo (alpha); + return tmp; +}
inline11.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: dcast2.C =================================================================== --- dcast2.C (nonexistent) +++ dcast2.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } + +// Based on a testcase by Ruslan Shevchenko + +struct B { + virtual ~B(); +}; + +struct D : public B { +}; + +void foo() { + B x; + dynamic_cast(&x); // { dg-warning "" } will never succeed + B* p = &x; + dynamic_cast(p); +}
dcast2.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: lookup17.C =================================================================== --- lookup17.C (nonexistent) +++ lookup17.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do run } +// Bug: t->B is resolved to the type instead of the field. + +struct A { + struct B { } *B; + int i, j, k, l, m; +}; + +struct A a; + +int +main () +{ + void *p = a.B; +}
lookup17.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: redecl4.C =================================================================== --- redecl4.C (nonexistent) +++ redecl4.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } +int main() { + struct A { + void f(); // { dg-error "with" } already declared + void f(); // { dg-error "overloaded" } already declared + }; +}
redecl4.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: anon8.C =================================================================== --- anon8.C (nonexistent) +++ anon8.C (revision 338) @@ -0,0 +1,22 @@ +// { dg-do assemble } + +struct B +{ + int a; + B & operator= (const B &); +}; + +struct A +{ + union { + int a; + }; + B b; +}; + +A x; + +void foo (const A &y) +{ + x = y; +}
anon8.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: init3.C =================================================================== --- init3.C (nonexistent) +++ init3.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } + +struct X +{ + static const bool is_signed = true ; + static const int digits = is_signed ? 8 *sizeof(wchar_t)-1 : 0; +};
init3.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: decl1.C =================================================================== --- decl1.C (nonexistent) +++ decl1.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do assemble } +// Based on a test case by Phil Blecker + + +int foo(int); +int bar() { + int baz(int(foo(0))); + int foo = baz; +}
decl1.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: static12.C =================================================================== --- static12.C (nonexistent) +++ static12.C (revision 338) @@ -0,0 +1,8 @@ +// { dg-do assemble } +// Origin: Jason Merrill + +int main () +{ + static const int n = 10; + static const int *p = &n; +}
static12.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,31 @@ +// { dg-do run } +// Origin: Mark Mitchell + +struct B1 +{ + int i; +}; + +struct B2 +{ + int j; +}; + +struct D: public B1, B2 +{ +}; + +bool f (B2& b) +{ + return b.j == 7; +} + +int main () +{ + D d; + d.i = 2; + d.j = 7; + if (!f (d)) + return 1; +} +
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: overload8.C =================================================================== --- overload8.C (nonexistent) +++ overload8.C (revision 338) @@ -0,0 +1,23 @@ +// { dg-do run } +class a { +public: + int f() { return 0; } + int f() const { return 1; } +}; + +class b : public a { +}; + +int main() +{ + int (b::* ptr1)() = &b::f; + int (b::* ptr2)() const = &b::f; + + b ao; + + if ((ao.*ptr1)() != 0) + return 1; + if ((ao.*ptr2)() != 1) + return 1; +} +
overload8.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: cond1.C =================================================================== --- cond1.C (nonexistent) +++ cond1.C (revision 338) @@ -0,0 +1,26 @@ +// { dg-do link } +// Origin: Mark Mitchell + +template +void f (T&) ; + +template <> +void f (void (&)()) +{ +} + +void g () +{ +} + +void h () +{ +} + +bool b; + +int main () +{ + f (b ? g : h); +} +
cond1.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: main1.C =================================================================== --- main1.C (nonexistent) +++ main1.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do compile } + +int main() // { dg-error "previous declaration" } +{ + return 0; +} + + +int main(int, const char**) // { dg-error "conflicts" } +{ + return 0; +}
main1.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: stmtexpr1.C =================================================================== --- stmtexpr1.C (nonexistent) +++ stmtexpr1.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// { dg-options "-O" } +// Origin: Thomas Kunert + +#include + +bool f( char c ) +{ + return tolower( c ); +}
stmtexpr1.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,9 @@ +// { dg-do assemble } + +struct S +{ + void f() + { + const int i; // { dg-error "" } uninitialized const + } +};
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: crash35.C =================================================================== --- crash35.C (nonexistent) +++ crash35.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// Origin: Jakub Jelinek + +void foo() +{ + if [ // { dg-error "" } parse error +}
crash35.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: cast2.C =================================================================== --- cast2.C (nonexistent) +++ cast2.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct A { +}; + +int main() +{ + A a; + typedef void (A::*F)(); + F p; + + const_cast(a); // { dg-error "" } const_cast requires pointer/ref types + const_cast(p); // { dg-error "" } const_cast requires pointer/ref types + const_cast(&main); // { dg-error "" } function type in const_cast + const_cast(main); // { dg-error "" } function type in const_cast +}
cast2.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: overload10.C =================================================================== --- overload10.C (nonexistent) +++ overload10.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do assemble } +// Origin: Jason Merrill + + const char *pc; + enum A { x } a; + int i; + + int main() + { + return i ? *pc : a; + }
overload10.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: inline20.C =================================================================== --- inline20.C (nonexistent) +++ inline20.C (revision 338) @@ -0,0 +1,58 @@ +// { dg-do assemble } + +struct A { + int a, b, c, d; +}; + +inline void foo (int, A &); + +struct D { +}; + +struct E: public D { + void f (A &y) + { + foo (1, y); + } +}; + +struct F: public D { + void f (A &y) + { + foo (2, y); + } +}; + +E *d; +F *e; + +inline int baz (int y) +{ + A a; + if (y) { + d->f (a); + } else { + e->f (a); + } + return 0; +} + +inline void foo (int y, A &z) +{ + z.a = baz (y); + z.b = baz (y); + z.c = baz (y); + z.d = baz (y); +} + +struct G { + E a; + F b; + void bar (A &); +}; + +void G::bar(A &y) +{ + a.f(y); + b.f(y); +}
inline20.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: sizeof1.C =================================================================== --- sizeof1.C (nonexistent) +++ sizeof1.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Origin: Jason Merrill + +struct X { + int f (); + int f (int); +}; + +void f(int i) +{ + i = sizeof(X::f); // { dg-error "" } cannot take sizeof a member function +}
sizeof1.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: builtins9.C =================================================================== --- builtins9.C (nonexistent) +++ builtins9.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do run } +// Test that inline redeclarations of builtins are emitted. +// Origin: Roger Sayle Mar 28, 2002 +// Copyright (C) 2002 Free Software Foundation. + +namespace std { + inline int fabs (void) { return 0; } +} + + +int main () +{ + return std::fabs (); +}
builtins9.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,16 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 3 Jun 1999 + +// We'd like the enum location to be its identifier. + +enum thing // { dg-error "" } previous def +{ + val1 +}; + +enum thing // { dg-error "" } multiple def +{ + val2 +};
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: ptrmem4.C =================================================================== --- ptrmem4.C (nonexistent) +++ ptrmem4.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do run } +// Test to make sure g++ can handle target types that aren't identical +// with pointers to members. + +struct A { int i; }; +struct B : public A { }; + +int main () +{ + int A::*p = &A::i; + const int B::*q = &A::i; + return p != q; +}
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: access8.C =================================================================== --- access8.C (nonexistent) +++ access8.C (revision 338) @@ -0,0 +1,27 @@ +// { dg-do assemble } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 10 Feb 2000 + +// Test that access to static members from a nested class of the derived +// type works. + +class Base +{ + protected: + static int Some_var; + typedef int Some_t; +}; + +class Derived : Base +{ + protected: + struct Nested + { + void Foo (Some_t); + void Bar (Base::Some_t) { Base::Some_var = 1; } + }; +}; + +void Derived::Nested::Foo (Some_t) { + Some_var = 2; +}
access8.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: dyncast6.C =================================================================== --- dyncast6.C (nonexistent) +++ dyncast6.C (revision 338) @@ -0,0 +1,73 @@ +// { dg-do run } +// { dg-options "-w -ansi -pedantic-errors" } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 20 June 2000 + +// Origin GNATS bug report 143 from Carlo Wood +// We were generating incorrect type_info structures, and hence breaking +// dynamic_cast. + +#include + +class OBASE { public: virtual void bz () {}}; +class IBASE { public: virtual void by () {}}; + +class V {public:int m; }; + +class A : public virtual V { }; +class AA : public A {}; + +class B : public OBASE, public A { public: virtual void foo(void) { } }; +class B1 : public OBASE, public AA { public: virtual void foo(void) { } }; + +class C : public IBASE, public virtual V { }; + +class D : public B, public C { }; + +class E : public B, public virtual V { }; + +class E1 : public B1, public virtual V {}; + +class E2 : public B1, public A, public virtual V {}; + +int main(void) +{ + D d; + E e; + E1 e1; + E2 e2; + int code = 0; + + OBASE* osd = &d; + OBASE* ose = &e; + OBASE* ose1 = &e1; + OBASE* ose2 = &e2; + + + if (!dynamic_cast(osd)) + { + printf ("fail osd\n"); + code++; + } + + if (!dynamic_cast(ose)) + { + printf ("fail ose\n"); + code++; + } + + if (!dynamic_cast(ose1)) + { + printf ("fail ose1\n"); + code++; + } + + if (!dynamic_cast(ose2)) + { + printf ("fail ose2\n"); + code++; + } + + return code; +}
dyncast6.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: conv6.C =================================================================== --- conv6.C (nonexistent) +++ conv6.C (revision 338) @@ -0,0 +1,29 @@ +// { dg-do run } +// Test for composite pointer types, as defined in [expr.rel], +// and common pointer to member types, as defined in [expr.eq]. + +struct A { int i; }; +struct B : public A { }; + +int main () +{ + B b; + + // The composite type is `A const *' + A* ap = &b; + const B* bp = &b; + if (ap != bp) // { dg-bogus "" } distinct types + return 1; + + // The composite type is `B const *const *' + B *const * p = 0; + B const * * q = 0; + if (p != q) // { dg-bogus "" } distinct types + return 1; + + // The common type is `int const B::*' + const int A::*apm = &A::i; + int B::*bpm = &A::i; + if (apm != bpm) // { dg-bogus "" } distinct types + return 1; +}
conv6.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: loop2.C =================================================================== --- loop2.C (nonexistent) +++ loop2.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do assemble } +// { dg-options "-O" } + +class foo { +public: + operator const char*() const { return a; } + char *a; +}; + +class bar { +public: + ~bar(); + void operator++(int); + bool b() const; +protected: + void* c() const; +}; + +class baz : public bar { +public: + foo const &d() const { return *(foo *)bar::c(); } +}; + +extern int tst (const char *, const char *) throw(); + +void die(const foo& x) +{ + for (baz hi; hi.b(); hi++) + if (tst (hi.d(), x) == 0) + return; +}
loop2.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: externC4.C =================================================================== --- externC4.C (nonexistent) +++ externC4.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// Origin: Neil Booth, from PR #66 + +extern "C" +{ + class foo + { + public: + ~foo (); + void bar (foo *); + foo (); + }; +} +
externC4.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,19 @@ +// { dg-do run } +int i; + +struct S { + S () { + ++i; + } + + S (int) { + } +}; + +int main() +{ + S s[3][3] = { 2 }; + + if (i != 8) + return 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: temporary1.C =================================================================== --- temporary1.C (nonexistent) +++ temporary1.C (revision 338) @@ -0,0 +1,41 @@ +// { dg-do run } +extern "C" int printf (const char *, ...); + +int c, d; +class Foo +{ +public: + Foo() { printf("Foo() 0x%08lx\n", (__SIZE_TYPE__)this); ++c; } + Foo(Foo const &) { printf("Foo(Foo const &) 0x%08lx\n", (__SIZE_TYPE__)this); } + ~Foo() { printf("~Foo() 0x%08lx\n", (__SIZE_TYPE__)this); ++d; } +}; + +// Bar creates constructs a temporary Foo() as a default +class Bar +{ +public: + Bar(Foo const & = Foo()) { printf("Bar(Foo const &) 0x%08lx\n", (__SIZE_TYPE__)this); } +}; + +void fakeRef(Bar *) +{ +} + +int main() +{ + // Create array of Bar. Will use default argument on constructor. + // The old compiler will loop constructing Bar. Each loop will + // construct a temporary Foo() but will not destruct the Foo(). + // The Foo() temporary is destructed only once after the loop + // completes. This could lead to a memory leak if the constructor + // of Foo() allocates memory. + Bar bar[2]; + + fakeRef(bar); + + printf("Done\n"); + + if (c == d && c == 2) + return 0; + return 1; +}
temporary1.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: rtti4.C =================================================================== --- rtti4.C (nonexistent) +++ rtti4.C (revision 338) @@ -0,0 +1,87 @@ +// { dg-do run } +// { dg-options "-frtti -w" } +// test of rtti of single inheritance and multiple inheritance with +// virtual inheritance + +#include + +extern "C" { + int printf(const char *, ...); + void exit(int); +} + +class X { + public: + int xi; + virtual int f() {}; +}; + +class Y : public virtual X { + short ys; +}; + +class Z : public virtual Y { + int zi; +}; + +Z z; +Y y; +Y *yp = &z; +X *xp = &z; +Z *zp = &z; + +class A { +public: + int Ai; + virtual int a() {}; +}; + +class B { +public: + int Bi; + virtual int g() {}; +}; + +class D : public virtual A, private B { + int Di; +}; + +class E : public virtual D, public B { + int Ei; +}; + +class F : public E, public virtual D { + int Fi; +}; + +D d; +A *ap = &d; +B *bp = (B *)&d; +F f; +A *aap = &f; +D *dp = &f; +B *bbp = (B *)dp; + +void *vp = zp; + +void error (int i) +{ + exit(i); +} + +int main () +{ + if (typeid(z) != typeid(Z)) error(1); + if (typeid(*yp) != typeid(Z)) error(2); + if (typeid(*yp) != typeid(*zp)) error(3); + if (typeid(xp) == typeid(yp)) error(4); + + xp = (X *)&y; + if (typeid(*xp) == typeid(*yp)) error(5); + if (typeid(*xp) != typeid(Y)) error(6); + + if (typeid(*ap) != typeid(*bp)) error (31); + if (typeid(*ap) != typeid(D)) error(32); + if (typeid(*aap) != typeid(*bbp)) error(33); + if (typeid(*dp) != typeid(*aap)) error(34); +}
rtti4.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,9 @@ +// { dg-do assemble } +extern "C" void abort(); + +struct S +{ + static const int i = 3; +}; + +const int S::i = 2; // { dg-error "" } duplicate initialization
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: virtual2.C =================================================================== --- virtual2.C (nonexistent) +++ virtual2.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do run } +struct B +{ + virtual int f() volatile + { return 0; } +}; + + +struct D : public B +{ + virtual int f() + { return 1; } +}; + +int main() +{ + volatile D d; + volatile B& b = d; + return b.f(); +}
virtual2.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: crash27.C =================================================================== --- crash27.C (nonexistent) +++ crash27.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Origin: Jakub Jelinek + +X(Y(long, Type, CLink)); break; default: break; } } } // { dg-error "" } + +struct A { + inline A (); +}; + +inline A::A () +{ +}
crash27.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: mutable1.C =================================================================== --- mutable1.C (nonexistent) +++ mutable1.C (revision 338) @@ -0,0 +1,44 @@ +// { dg-do run } +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 14 Jan 1999 + +// Make sure objects with mutable members are never placed in a read only +// section. + +// All these are POD structs, and hence do not need ctors +struct A { mutable int i; }; +struct B { A a; }; +struct C { A a[1]; }; +struct D { static A const a; }; + +// all these are static consts and hence naively suitable for a read only +// section. But they contain a mutable, so must be in a writable section. +static int const i = 0; +static A const a = {0}; +static B const b = {{0}}; +static C const c = {{{0}}}; +static A const aa[] = {{0}}; +static B const bb[] = {{{0}}}; +static C const cc[] = {{{{0}}}}; +A const D::a = {0}; + +int main() +{ + a.i = 05; + b.a.i = 05; + c.a[0].i = 05; + aa[0].i = 05; + bb[0].a.i = 05; + cc[0].a[0].i = 05; + D::a.i = 05; + + if(!a.i) return 1; + if(!b.a.i) return 1; + if(!c.a[0].i) return 1; + if(!aa[0].i) return 1; + if(!bb[0].a.i) return 1; + if(!cc[0].a[0].i) return 1; + if(!D::a.i) return 1; + + return 0; +}
mutable1.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: thunk1.C =================================================================== --- thunk1.C (nonexistent) +++ thunk1.C (revision 338) @@ -0,0 +1,36 @@ +// { dg-do run } +extern "C" void abort(); + +int ic; + +struct X +{ + X() { ++ic; } + X( const X & ) { ++ic; } + ~X() { if (--ic < 0) abort(); } +}; + +struct V +{ + virtual ~V() {} +}; + +struct A : public virtual V +{ +}; + +struct B : public virtual V +{ + virtual void foo( X ) = 0; +}; + +struct D : public A, public virtual B +{ + virtual void foo( X ) {} +}; + +int main() +{ + B *b = new D; + b->foo( X() ); +}
thunk1.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: union3.C =================================================================== --- union3.C (nonexistent) +++ union3.C (revision 338) @@ -0,0 +1,24 @@ +// { dg-do run } +// Origin: Mark Mitchell + +struct A +{ + union + { + int i; + }; + int j; + + A (); +}; + +A::A () + : i (1), j (i = 0) +{ +} + +int main () +{ + A a; + return a.i; +}
union3.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,11 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct S { + S(); + + virtual int f() { + new S[+f()]; + return 0; + } +};
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: empty2.C =================================================================== --- empty2.C (nonexistent) +++ empty2.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct E {}; + +void f () { + E e1, e2; + e1 = e2; // We should not warn about this statement, even though no + // code is generated for it. +}
empty2.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: inline12.C =================================================================== --- inline12.C (nonexistent) +++ inline12.C (revision 338) @@ -0,0 +1,326 @@ +// { dg-do assemble } +// { dg-options "-O2 -g" } +// (Should preferrably cycle through options.) +// Origin: Hans-Peter Nilsson +// See + +typedef unsigned int udword; +extern "C" { +void __assert (const char *, int, const char *); +} +class ShZzy; +class ShBe; +class Sh +{ + public: + class Xy; + inline Sh(const char* theName, + const Xy& theXys); + virtual ~Sh(); + inline const char* name() const; + inline bool shXy(const Xy& theXy); + virtual void setParent(Sh* theParent); + class Xy + { + public: + Xy(int theXy); + Xy(const Xy& theXy); + Xy& operator = (const Xy&); + bool sh(const Xy& theXy); + private: + int myXyFlags; + }; + protected: + Xy myXys; + private: + Sh(); + Sh(const Sh&); + Sh& operator = (const Sh&); + const char* myName; + Sh* myParent; +}; +class ShZzy : public Sh +{ + public: + inline ShZzy(const char* theName); + inline ShZzy(const char* theName, + const Xy& theXys); + virtual ~ShZzy(); + void addShTo(char* theParent); + virtual void ap() {} + void addSh(Sh* theSh); + virtual void setParent(Sh* theParent); + void baseAp(); + private: + ShZzy(); + ShZzy(const ShZzy&); + ShZzy& operator = (const ShZzy&); + bool iAmInited; +}; +class ShBop +{ + public: + inline ShBop(const ShBe* theBe); + void shWw(bool, + const char* a1 = "", + const char* a2 = "", + int a3 = -1, + const char* a4 = "foo"); + typedef enum { shOk, + shFailed, + shDone, + invalidBop } bopType; + inline bopType bop(); + inline int numberOfVs(); + inline void closeBop(); + private: + ShBop(const ShBop&); + ShBop& operator = (const ShBop&); + const ShBe* myBe; + bopType myBop; + int my1; + int my2; + const char* my3; + const char* my4; + int my5; + const char* my6; +}; +Sh::Sh(const char* theName, + const Xy& theXys) + :myXys(theXys), + myName(theName), + myParent(0) +{} +const char* +Sh::name() const +{ + return myName; +} +bool +Sh::shXy(const Xy& theXy) +{ + return myXys.sh(theXy); +} +ShZzy::ShZzy(const char* theName) + :Sh(theName, Xy(0)), + iAmInited(false) +{} +ShZzy::ShZzy(const char* theName, + const Xy& theXys) + :Sh(theName, theXys), + iAmInited(false) +{} +ShBop::ShBop(const ShBe* theBe) + :myBe(theBe), + myBop(invalidBop), + my1(0), + my2(0), + my3(""), + my4(""), + my5(0), + my6("") +{} +ShBop::bopType +ShBop::bop() +{ + ((!my2 || myBop == shFailed) ? (void)0 : __assert("foo", 91,"foo")); + return myBop; +} +int +ShBop::numberOfVs() +{ + return my2 + my1; +} +void +ShBop::closeBop() +{ + if (myBop == invalidBop) + { + myBop = shDone; + } +} +class ShBe; +template +class ShAp : public ShZzy +{ + public: + ShAp(const char* theName); + ShAp(const char* theName, + const Xy& theXys); + virtual ~ShAp() {} + typedef void (ShCc::*ShMethod)(); + virtual void ap() {} + protected: + ShBop* bop(); + private: + ShAp(); + ShAp(const ShAp&); + ShAp& operator = (const ShAp&); + ShBop* myBop; + ShBe* myBe; +}; +class ShBe : public Sh +{ + public: + inline ShBe(const char* theName); + inline ShBe(const char* theName, + const Xy& theXys); + inline virtual ~ShBe(); + virtual void run() = 0; + ShBop* runBe(); + protected: + inline ShBop* bop(); + private: + ShBe(); + ShBe(const ShBe&); + ShBe& operator = (const ShBe&); + ShBop* myBop; +}; +template +ShAp::ShAp(const char* theName) + : ShZzy(theName), + myBop(0), + myBe(0) +{} +template +ShAp::ShAp(const char* theName, + const Sh::Xy& theXys) + : ShZzy(theName, theXys), + myBop(0), + myBe(0) +{} +template +ShBop* +ShAp::bop() +{ + ((myBop) ? (void)0 : __assert("foo", 96,"foo")); + return myBop; +} +class xSh : public ShAp +{ + public: + xSh(); + virtual ~xSh(); + void ap(); + void uff(); + void rtt(); +}; +class xUff +{ + public: + xUff(); + xUff(const xUff&); + xUff& operator = (const xUff&); + xUff(udword); + operator udword() const; + xUff& operator = (udword); + bool operator < (const xUff) const; + bool operator <= (const xUff) const; + bool operator > (const xUff) const; + bool operator >= (const xUff) const; + bool operator == (const xUff) const; + enum {size = 4}; + xUff(unsigned char* theUff); + private: + udword myUff; +}; +inline +xUff::xUff() + : myUff(0) +{ +} +inline +xUff::xUff(udword theUff) + : myUff(theUff) +{ +} +inline +xUff::xUff( + const xUff& theUff) + : myUff(theUff.myUff) +{ +} +inline xUff& +xUff::operator = (const xUff& theUff) +{ + myUff = theUff.myUff; + return *this; +} +inline xUff& +xUff::operator = (udword theUff) +{ + myUff = theUff; + return *this; +} +inline +xUff::operator udword() const +{ + return myUff; +} +inline bool +xUff::operator < (const xUff ding) const +{ + return (((int) (myUff - ding.myUff)) < 0); +} +inline bool +xUff::operator <= (const xUff ding) const +{ + return (((int) (myUff - ding.myUff)) <= 0); +} +inline bool +xUff::operator > (const xUff ding) const +{ + return (((int) (myUff - ding.myUff)) > 0); +} +inline bool +xUff::operator >= (const xUff ding) const +{ + return (((int) (myUff - ding.myUff)) >= 0); +} +inline bool +xUff::operator == (const xUff ding) const +{ + return (myUff == ding.myUff); +} +inline +xUff::xUff(unsigned char* theUff) +{ + myUff = *(udword *)theUff; +} +void +xSh::uff() +{ + static const udword halfudword = 0x80000000; + xUff aGah((udword)0); + udword diagonal = halfudword + (udword) aGah; + xUff aGeh(diagonal - 1); + xUff aGoh(diagonal + 1); + (bop()->shWw ((aGah.operator <=(aGah)), ("foo"), ( ""), 118, "foo")); + (bop()->shWw ((aGah.operator >=(aGah)), ("foo"), ( ""), 119, "foo")); + (bop()->shWw ((!(aGah.operator <(aGah))), ("foo"), ( ""), 120, "foo")); + (bop()->shWw ((!(aGah.operator >(aGah))), ("foo"), ( ""), 121, "foo")); + (bop()->shWw ((aGah.operator <(aGeh)), ("foo"), ( ""), 124, "foo")); + (bop()->shWw ((aGah.operator <=(aGeh)), ("foo"), ( ""), 125, "foo")); + (bop()->shWw ((!(aGah.operator >(aGeh))), ("foo"), ( ""), 126, "foo")); + (bop()->shWw ((!(aGah.operator >=(aGeh))), ("foo"), ( ""), 127, "foo")); + (bop()->shWw ((aGeh.operator >(aGah)), ("foo"), ( ""), 130, "foo")); + (bop()->shWw ((aGeh.operator >=(aGah)), ("foo"), ( ""), 131, "foo")); + (bop()->shWw ((!(aGeh.operator <(aGah))), ("foo"), ( ""), 132, "foo")); + (bop()->shWw ((!(aGeh.operator <=(aGah))), ("foo"), ( ""), 133, "foo")); + (bop()->shWw ((aGeh.operator <(aGoh)), ("foo"), ( ""), 136, "foo")); + (bop()->shWw ((aGeh.operator <=(aGoh)), ("foo"), ( ""), 137, "foo")); + (bop()->shWw ((!(aGeh.operator >(aGoh))), ("foo"), ( ""), 138, "foo")); + (bop()->shWw ((!(aGeh.operator >=(aGoh))), ("foo"), ( ""), 139, "foo")); + (bop()->shWw ((aGoh.operator >(aGeh)), ("foo"), ( ""), 142, "foo")); + (bop()->shWw ((aGoh.operator >=(aGeh)), ("foo"), ( ""), 143, "foo")); + (bop()->shWw ((!(aGoh.operator <(aGeh))), ("foo"), ( ""), 144, "foo")); + (bop()->shWw ((!(aGoh.operator <=(aGeh))), ("foo"), ( ""), 145, "foo")); + (bop()->shWw ((aGah.operator >(aGoh)), ("foo"), ( ""), 152, "foo")); + (bop()->shWw ((aGah.operator >=(aGoh)), ("foo"), ( ""), 153, "foo")); + (bop()->shWw ((!(aGah.operator <(aGoh))), ("foo"), ( ""), 154, "foo")); + (bop()->shWw ((!(aGah.operator <=(aGoh))), ("foo"), ( ""), 155, "foo")); + (bop()->shWw ((aGoh.operator <(aGah)), ("foo"), ( ""), 158, "foo")); + (bop()->shWw ((aGoh.operator <=(aGah)), ("foo"), ( ""), 159, "foo")); + (bop()->shWw ((!(aGoh.operator >(aGah))), ("foo"), ( ""), 160, "foo")); + (bop()->shWw ((!(aGoh.operator >=(aGah))), ("foo"), ( ""), 161, "foo")); +}
inline12.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: lookup18.C =================================================================== --- lookup18.C (nonexistent) +++ lookup18.C (revision 338) @@ -0,0 +1,23 @@ +// { dg-do assemble } +// Test that referring to an ambiguous base in name lookup prevents +// access to the field, even though the field is not ambiguous. + + +struct A { + int i; +}; +struct B: virtual A { }; +struct C: public B { }; +struct D: public B { }; +struct E: public C, public D { + void f (); +}; + +void E::f() { + B::i = 0; // { dg-error "" } B is ambiguous +} + +void f () { + E e; + e.B::i = 0; // { dg-error "" } B is ambiguous +}
lookup18.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: anon9.C =================================================================== --- anon9.C (nonexistent) +++ anon9.C (revision 338) @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Test that we properly diagnose an attempt to use an anonymous class +// in declaring an external function. + +typedef const struct { int i; } T; // { dg-error "" } referenced below +void f (T* t); // { dg-error "" } uses unnamed type
anon9.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: init4.C =================================================================== --- init4.C (nonexistent) +++ init4.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } + +class error { +public: + error(int) {} +}; + +class foo { + const error x = 1; // { dg-error "" } initialization of non-static data member +}; + +
init4.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: decl2.C =================================================================== --- decl2.C (nonexistent) +++ decl2.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// Based on a testcase by Maciej Radziejewski + +int i(0)(1); // { dg-error "" } multiple initialization +int j(2) = 3; // { dg-error "" } multiple initialization +int k(4)(5)(6); // { dg-error "" } multiple initialization +int m, n(7)(8); // { dg-error "" } multiple initialization
decl2.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: comdat5-aux.cc =================================================================== --- comdat5-aux.cc (nonexistent) +++ comdat5-aux.cc (revision 338) @@ -0,0 +1 @@ +#include "comdat4-aux.cc" Index: static13.C =================================================================== --- static13.C (nonexistent) +++ static13.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do link } +// Origin: scott snyder + +struct Cleaner +{ + ~Cleaner() {} +}; + +template +void bar () +{ + static Cleaner cleanup; +} + + +inline +void foo() { bar(); } + +int main () {}
static13.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,28 @@ +// { dg-do assemble } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 27 Feb 2001 + +// Bug 2117. A conversion op to reference type created a temporary, even +// when bound to another reference. + +struct Abstract +{ + virtual void Foo () = 0; +}; + +struct Proxy +{ + operator Abstract & (); + Abstract &Convert (); +}; + +void Baz (Abstract &); + +void Foo () +{ + Proxy proxy; + + Baz (proxy); + Baz (proxy.Convert ()); +}
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: badarrow.C =================================================================== --- badarrow.C (nonexistent) +++ badarrow.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } + +struct S { + int i; +} s; + +void f() +{ + s->i = 3; // { dg-error "" } base operand +}
badarrow.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: init10.C =================================================================== --- init10.C (nonexistent) +++ init10.C (revision 338) @@ -0,0 +1,23 @@ +// { dg-do run } +int i; + +struct D { + D () { + i++; + } +}; + +struct C { + C() {} + + D d[1]; +}; + + +int main () +{ + C c; + + if (i != 1) + return 1; +}
init10.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: overload9.C =================================================================== --- overload9.C (nonexistent) +++ overload9.C (revision 338) @@ -0,0 +1,32 @@ +// { dg-do run } +struct T { ~T() {} }; + +int g () +{ + foo: + T t; + int f(int); + bar: + T t2; + int f(double); + return f(3); +} + + +int f(int) +{ + return 0; +} + + +int f(double) +{ + return 1; +} + + +int main() +{ + return g(); +} +
overload9.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: cond2.C =================================================================== --- cond2.C (nonexistent) +++ cond2.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do assemble } +// Origin: Loring Holden + +class Wpt {}; + +class RAYhit { + protected: + Wpt _nearpt; + public: + Wpt surf () const { return true ? Wpt(): _nearpt; } +};
cond2.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: ptrmem10.C =================================================================== --- ptrmem10.C (nonexistent) +++ ptrmem10.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do run } +// Test that we properly convert a constant ptm to bool. + +class A { }; + +int main() +{ + int A::*const p = 0; + if (p) + return 1; +}
ptrmem10.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: main2.C =================================================================== --- main2.C (nonexistent) +++ main2.C (revision 338) @@ -0,0 +1,4 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +double main () {} // { dg-error "" } main must return `int'
main2.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: using1.C =================================================================== --- using1.C (nonexistent) +++ using1.C (revision 338) @@ -0,0 +1,27 @@ +// { dg-do assemble } +class D2; + +class B { +private: + int a; // { dg-error "" } B::a is private +protected: + int b; + + friend class D2; +}; + +class D : public B { // { dg-error "" } within this context +public: + using B::a; + using B::b; +}; + +class D2 : public B { // { dg-error "" } conflicting access specifications +public: + using B::a; + using B::b; + +private: + using B::b; +}; +
using1.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,5 @@ +// { dg-do assemble } + +struct S { + static const char* cp = "abc"; // { dg-error "" } initialization of non-const +};
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: stmtexpr2.C =================================================================== --- stmtexpr2.C (nonexistent) +++ stmtexpr2.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do assemble } +// { dg-options "-O2" } +// Origin: Jakub Jelinek + +void bar(int); +void foo(int x) +{ + bar(({ int y; y = x; })); +}
stmtexpr2.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: crash36.C =================================================================== --- crash36.C (nonexistent) +++ crash36.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 7 Nov 2000 + +// Bug 573. We ICE'd verifying operator new and operator delete conformed +// to the standard's expectation. + +void *operator new (__SIZE_TYPE__); // ok +void operator new (__SIZE_TYPE__); // { dg-error "" } must return void * +void *operator new (); // { dg-error "" } must take size_t +void *operator new (char); // { dg-error "" } must take size_t +void *operator new (__SIZE_TYPE__, ...) throw(); // ok + +void operator delete (void *) throw (); // ok +int operator delete (void *) throw (); // { dg-error "" } must return void +void operator delete () throw (); // { dg-error "" } must take void * +void operator delete (int *) throw (); // { dg-error "" } must take void * +void operator delete (void *, __SIZE_TYPE__) throw (); // ok + +void operator delete (...) throw (); // { dg-error "" } must take void * +void operator delete (void *, ...) throw (); // ok
crash36.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: crash19.C =================================================================== --- crash19.C (nonexistent) +++ crash19.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +template +struct S {}; + +struct X {}; + +void f () { + typedef X Y; + S s; +}
crash19.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: cast3.C =================================================================== --- cast3.C (nonexistent) +++ cast3.C (revision 338) @@ -0,0 +1,44 @@ +// { dg-do assemble } +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 12 Dec 1999 + +// static_cast should not cast _away_ constness ([expr.static.cast]/6), +// but nothing bans _adding_ constness. [expr.static.cast]/10 states that a +// pointer of type cv void can be cast to pointer to object type. + +struct X; +struct Y {}; +struct Z : Y {}; + +void fn (void *p, void const *cp, Y *yp, Y const *ycp, Z *zp, Z const *zcp) +{ + static_cast (p); + static_cast (p); + static_cast (p); + static_cast (p); + static_cast (p); + static_cast (p); + static_cast (p); + static_cast (p); + + static_cast (cp); // { dg-error "" } lose const + static_cast (cp); + static_cast (cp); // { dg-error "" } lose const + static_cast (cp); + static_cast (cp); // { dg-error "" } lose const + static_cast (cp); // { dg-error "" } lose const + static_cast (cp); + static_cast (cp); + + static_cast (yp); + static_cast (yp); + + static_cast (ycp); // { dg-error "" } lose const + static_cast (ycp); + + static_cast (zp); + static_cast (zp); + + static_cast (zcp); // { dg-error "" } lose const + static_cast (zcp); +}
cast3.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: overload11.C =================================================================== --- overload11.C (nonexistent) +++ overload11.C (revision 338) @@ -0,0 +1,93 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 5 Sep 1999 + +// [over.match] 13.3 tells us where overload resolution occurs. +// [over.match.call] 13.3.1.1 says that in +// (...( postfix-expression )...) (expression-list) +// the postfix-expression must be the name of a function (amongst some other +// choices). This means comma and conditional exprs cannot be placed there. +// This clause is the only one I can find which bans +// (cond ? fna : fnb) (arglist) +// which would be a major headache to have to implement. +// [over.over] 13.4 tells us when the use of a function name w/o arguments is +// resolved to the address of a particular function. These are determined by +// the context of the function name, and it does allow more complicated primary +// expressions. + +// Using a naked function name is rather strange, we used to warn about it +// (rather inconsistently), but subsequent changes broke the warning. Make +// sure that doesn't happen again. + + +void ovl (int); // { dg-error "" } candidate +// { dg-message "int" "int" { target *-*-* } 24 } +void ovl (float); // { dg-error "" } candidate +// { dg-message "float" "float" { target *-*-* } 26 } +void fn (int); +void fna (int); + +int main (int argc, char **argv) +{ + void (*ptr) (int); + void (*vptr) (); + + (ovl) (1); // ok + (&ovl) (1); // { dg-error "" } not suitable for overload resolution + (ovl) (); // { dg-error "" } no matching candidates + (&ovl) (); // { dg-error "" } not suitable for overload resolution + + // 13.3.1.1 indicates that the following are errors -- the primary expression + // is not the name of a function. + (0, ovl) (1); // { dg-error "" } not suitable for overload resolution + (0, &ovl) (1); // { dg-error "" } not suitable for overload resolution + (argc ? ovl : ovl) (1); // { dg-error "" } not suitable for overload resolution + (argc ? &ovl : &ovl) (1); // { dg-error "" } not suitable for overload resolution + + (fn) (1); // ok + (&fn) (1); // ok (no overload resolution) + (0, fn) (1); // ok (no overload resolution) + (0, &fn) (1); // ok (no overload resolution) + (argc ? fna : fn) (1); // ok (no overload resolution) + (argc ? &fna : &fn) (1); // ok (no overload resolution) + + ptr = (ovl); // ok + ptr = (&ovl); // ok + ptr = (0, ovl); // ok { dg-error "no context" } + ptr = (0, &ovl); // ok { dg-error "no context" } + ptr = (argc ? ovl : ovl); // ok { dg-error "no context" } + ptr = (argc ? &ovl : &ovl);// ok { dg-error "no context" } + + vptr = (ovl); // { dg-error "" } no matching candidates + vptr = (&ovl); // { dg-error "" } no matching candidates + vptr = (0, ovl); // { dg-error "" } no matching candidates + vptr = (0, &ovl); // { dg-error "" } no matching candidates + vptr = (argc ? ovl : ovl); // { dg-error "" } no matching candidates + vptr = (argc ? &ovl : &ovl);// { dg-error "" } no matching candidates + + ptr = (fn); + ptr = (&fn); + ptr = (0, fn); + ptr = (0, &fn); + ptr = (argc ? fna : fn); + ptr = (argc ? &fna : &fn); + + f; // { dg-error "" } not a call + ovl; // { dg-error "" } not suitable for overload + &ovl; // { dg-error "" } not suitable for overload + (void)f; // ok + (void)ovl; // { dg-error "" } not suitable for overload + (void)&ovl; // { dg-error "" } not suitable for overload + static_cast(f); // ok + static_cast(ovl); // { dg-error "" } not suitable for overload + static_cast(&ovl); // { dg-error "" } not suitable for overload + ((void)1, f); // { dg-warning "" "" { xfail *-*-* } } not a call + ((void)1, ovl); // { dg-error "" } not suitable for overload + ((void)1, &ovl); // { dg-error "" } not suitable for overload + (void)((void)1, f); // ok + (void)((void)1, ovl); // { dg-error "" } not suitable for overload + (void)((void)1, &ovl); // { dg-error "" } not suitable for overload + + return 0; +}
overload11.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: inline21.C =================================================================== --- inline21.C (nonexistent) +++ inline21.C (revision 338) @@ -0,0 +1,40 @@ +// { dg-do run } +// { dg-options "-O2" } +// Origin: suckfish@ihug.co.nz + +// DECLARATIONS + +struct Record { + Record (int bb) : + b (bb) + { } + int extra; // Having an extra member in record is crucial. + int b; +}; + +struct Container { + Record record; + // The const on the next line is crucial. + Container ( const Record b) : record(b) {} +}; + + +// TEST FOR CORRECT BEHAVIOR + +int myArray[3]; +int * intp = myArray; + +void use_pair (const Container & c) +{ + *intp++ = c.record.b; +} + +extern "C" int printf (const char *,...); + +int main() +{ + use_pair (Container (1234)); + + if (myArray[0] != 1234) + return 1; +}
inline21.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: sizeof2.C =================================================================== --- sizeof2.C (nonexistent) +++ sizeof2.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct S +{ + int j; + int i[2]; // { dg-error "" "" { xfail *-*-* } } non-static data member +}; + +void f () +{ + sizeof (S::j); + sizeof (S::i[0]); // { dg-error "" "" { xfail *-*-* } } used here +} +
sizeof2.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: printf1.C =================================================================== --- printf1.C (nonexistent) +++ printf1.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// { dg-options "-Wall" } + +struct a +{ + void x(char *f,...) __attribute__((format(printf,2,3))); +}; + +int main() +{ + a A; + A.x("%d"); // { dg-warning "" } too few arguments for format + return 0; +}
printf1.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: elab1.C =================================================================== --- elab1.C (nonexistent) +++ elab1.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +typedef struct {} S; // { dg-error "" } Previous declaration of S + +S s1; +struct S* s2; // { dg-error "" } S is a typedef name + +template +struct X { + friend class T; // { dg-error "" } T is a template type parameter +};
elab1.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: enum3.C =================================================================== --- enum3.C (nonexistent) +++ enum3.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 28 Feb 2001 + +// Bug 338 and DR 128. Allow static cast to convert between enums. + +enum E1 {e1}; +enum E2 {e2}; + +E2 Foo (E1 e) +{ + return static_cast (e); +}
enum3.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: ptrmem5.C =================================================================== --- ptrmem5.C (nonexistent) +++ ptrmem5.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// Bug: g++ doesn't see that A is a vbase of C. +// Submitted by Jason Merrill + +struct A { + int i; + void f (); +}; + +struct B: public A { }; +struct C: public virtual B { }; + +void g () +{ + int C::*p = &A::i; // { dg-error "" } conversion from vbase + void (C::*fp)() = &A::f; // { dg-error "" } conversion from vbase +}
ptrmem5.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: access9.C =================================================================== --- access9.C (nonexistent) +++ access9.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Test that g++ allows friends to use private types in their declarations. + +class A { + typedef int I; + friend I f (I); +}; + +A::I f (A::I); +A::I f (A::I) { return 0; }
access9.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: conv7.C =================================================================== --- conv7.C (nonexistent) +++ conv7.C (revision 338) @@ -0,0 +1,46 @@ +// { dg-do assemble } +// { dg-options "-Wconversion" } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 5 May 2001 + +// Bug 2726. We ICE'd trying to say something about possibly confusing +// conversion overload resolution. + +class foo +{ +}; + +template +class bar +{ +public: + operator const T&() const ; + operator T&() ; + +}; + + +template +class iterator_template +{ +public: + iterator_template(); + Ref operator*() const; + +}; + +struct IdlDeclarator +{ +}; + +typedef bar< IdlDeclarator > IdlDeclarator_bar; +int +yyparse() + +{ + + iterator_template declIter; + const IdlDeclarator& declarator = *declIter; + return 1; +}
conv7.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: externC5.C =================================================================== --- externC5.C (nonexistent) +++ externC5.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do assemble } +// Origin: schmid@snake.iap.physik.tu-darmstadt.de + +extern "C" int rand (void) throw (); + +namespace std +{ +extern "C" int rand(void) throw(); +template void f(T a) {} +} + +using namespace std; + +int main() +{ + f(rand); + f(std::rand); + f(::rand); +}
externC5.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: incomplete.C =================================================================== --- incomplete.C (nonexistent) +++ incomplete.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do assemble } + +// gcc represents non-ellipsis parmlists by terminating them with +// a void parm. We need to distinguish between a parmlist of (void), and +// some ill-formed ones. + +struct S; // { dg-error "" } forward ref + +void f(S); // ok +void f(S s) {} // { dg-error "" } incomplete type +void j (int){} // ok +void k (){} // ok +void q (void){} // ok +void t (void t); // { dg-error "" } incomplete +void r (void, ...); // { dg-error "" } incomplete +void s (void const); // { dg-error "" } incomplete
incomplete.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,25 @@ +// { dg-do assemble } +// +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 10 Aug 2000 + +// bug 386.C We ICE'd before emitting a diagnostic when trying to +// initialize a constant non-pod array from something bogus. + + +struct A +{ + A(char); +}; + +class B +{ + const A ary[16]; + + B (const A ary[]); +}; + +B::B (const A a[]) + : ary(a) // { dg-error "bad array initializer" } +{ +}
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: rtti5.C =================================================================== --- rtti5.C (nonexistent) +++ rtti5.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// { dg-options "-fno-rtti" } + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 9 Apr 1999 +// derrived from bug report from Alexander Zvyagin + +// check we don't die with disabled rtti + + +int main(void) { + int i; + typeid(i); // { dg-error "" } rtti disabled +}
rtti5.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,10 @@ +// { dg-do assemble } +// Based on a test case by Koos Vriezen + +struct foo { + static void (*mystatic) (); +}; + +void bar(foo& t) { + t.mystatic (); +}
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: virtual3.C =================================================================== --- virtual3.C (nonexistent) +++ virtual3.C (revision 338) @@ -0,0 +1,25 @@ +// { dg-do run } +struct B +{ + virtual int f() volatile + { return 1; } +}; + +struct D : public B +{ + int f() + { return 0; } +}; + +struct D2 : public D +{ + int f() + { return 2; } +}; + +int main() +{ + D2 d2; + D& d = d2; + return d.f(); +}
virtual3.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: crash28.C =================================================================== --- crash28.C (nonexistent) +++ crash28.C (revision 338) @@ -0,0 +1,35 @@ +// { dg-do assemble } +// Origin: Jakub Jelinek + +namespace N +{ + class X; + template + class Y + { + public: + inline Y () {} + inline operator const Y & () const + { + return *reinterpret_cast *>(this); + } + }; +} +class bar +{ +public: + inline bar () {} + inline bar (const ::N::Y< ::N::X>& a); +}; + +class foo +{ + bool b; +public: + foo(); + void x () throw(bar); +}; +void foo::x() throw(bar) +{ + if (!b) throw bar (static_cast<::N::X*>(this)); // { dg-error "lambda expressions|expected" } parse error +}
crash28.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: union4.C =================================================================== --- union4.C (nonexistent) +++ union4.C (revision 338) @@ -0,0 +1,33 @@ +// { dg-do assemble } +// { dg-options "" } +// Origin: Mark Mitchell + +union A +{ + int i; + int j; + + A () : i (3), j (2) {} // { dg-error "" } multiple initializations +}; + +union B +{ + int i; + union { + int j; + }; + + B () : i (3), j (2) {} // { dg-error "" } multiple initializations +}; + +union C +{ + union { + struct { + int i; + int j; + }; + }; + + C () : i (3), j (2) {} +};
union4.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,13 @@ +// { dg-do run } +// Test that const-correctness is observed when using new. + +struct A { + A() { } + int f () { return 1; } + int f () const { return 0; } +}; + +int main () +{ + return (new const A)->f (); +}
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: inline13.C =================================================================== --- inline13.C (nonexistent) +++ inline13.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// Origin: Alexandre Oliva + +struct foo { + inline void bar(); + foo(); +}; + +inline void foo::bar() { + switch (0) { + case 0: + break; + } +} + +foo::foo() { + bar(); +}
inline13.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: lookup19.C =================================================================== --- lookup19.C (nonexistent) +++ lookup19.C (revision 338) @@ -0,0 +1,54 @@ +// { dg-do assemble } +// Test for proper handling of type lookup for conversion operator names. + +// Test 1: Only at file scope +typedef int B; +struct A +{ + int B; + operator B *(); // { dg-error "" } +}; + +A::operator B * () // { dg-error "" } +{ + return 0; +} + +// Test 2: Only at class scope +struct C +{ + typedef int D; + operator D *(); +}; + +int D; +C::operator D * () +{ + return 0; +} + +// Test 3: Matching +struct E +{ + typedef int F; + operator F *(); +}; + +typedef int F; +E::operator F * () +{ + return 0; +} + +// Test 4: Conflicting +struct G +{ + typedef int H; + operator H *(); +}; + +typedef double H; +G::operator H * () +{ + return 0; +}
lookup19.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: init5.C =================================================================== --- init5.C (nonexistent) +++ init5.C (revision 338) @@ -0,0 +1,29 @@ +// { dg-do run { xfail { ! cxa_atexit } } } +// Objects must be destructed in decreasing cnt order +// Original test attributed to James Kanze + +extern "C" void abort (); + +static int cnt; + +class A { + int myCnt; +public: + A() : myCnt(cnt++) {} + ~A() { if (--cnt != myCnt) abort(); } +}; + +void f() { static A a; /* a.myCnt == 1 */ } + +class B { + int myCnt; +public: + B() : myCnt(cnt+1) { f(); ++cnt; } + ~B() { if (--cnt != myCnt) abort(); } +}; + +static A a1; // a1.myCnt == 0 +static B b1; // b1.myCnt == 2 +static A a2; // a2.myCnt == 3 + +int main() {}
init5.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: initstring.C =================================================================== --- initstring.C (nonexistent) +++ initstring.C (revision 338) @@ -0,0 +1,3 @@ +// { dg-do assemble } + +static const char foo[] = { "bar" };
initstring.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: decl3.C =================================================================== --- decl3.C (nonexistent) +++ decl3.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do assemble } + +// Origin: Adapted by Nathan Sidwell 29 Apr 1999 +// from a test case submitted by Corey Kosak +// http://gcc.gnu.org/ml/gcc-bugs/1999-04n/msg00505.html + +// We should not allow arrays of abstract type. [class.abstract/2] + +struct cow_t { // { dg-message "pure" } + virtual void f()=0; // { dg-message "note" } +}; + + +int main() +{ + cow_t cow[2]; // { dg-error "invalid abstract type" } + cow[0].f(); + return 0; +}
decl3.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: static14.C =================================================================== --- static14.C (nonexistent) +++ static14.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do link } +// Origin: scott snyder + +struct basic_string +{ + ~basic_string(); +}; + +struct Side +{ + void name() + { + static basic_string sname; + } +}; + +int main () +{ +}
static14.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: init11.C =================================================================== --- init11.C (nonexistent) +++ init11.C (revision 338) @@ -0,0 +1,39 @@ +// { dg-do run } +// Check that elements for which no explicit initializer was given are +// default-initialized properly. + +extern "C" int printf (const char *, ...); + +struct A +{ + int i; + A(): i (42) { } + A(int j): i(j) { } +}; + +A ar[4] = { 1, 2 }; + +struct B +{ + A a1, a2, a3, a4; +}; + +B b = { 1, 2 }; + +struct C +{ + A ar[4]; +}; + +C c = { 1, 2 }; + +int +main () +{ + printf ("%d %d %d %d\n%d %d %d %d\n%d %d %d %d\n", + ar[0].i, ar[1].i, ar[2].i, ar[3].i, + b.a1.i, b.a2.i, b.a3.i, b.a4.i, + c.ar[1-1].i, c.ar[2-1].i, c.ar[3-1].i, c.ar[4-1].i); + + return (b.a4.i != 42 || c.ar[3].i != 42); +}
init11.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: cond3.C =================================================================== --- cond3.C (nonexistent) +++ cond3.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// Origin: Loring Holden + +class Wtransf {}; + +const Wtransf Identity2 = Wtransf (); + +class HELPER { + public: + int current() const { return 0; } +}; + +void +problem_function() +{ + HELPER tm; + Wtransf delta = (tm.current()) ? Identity2 : Wtransf(); +}
cond3.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: using2.C =================================================================== --- using2.C (nonexistent) +++ using2.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +struct X{ + void f(); +}; + +struct Y:X{ + void f(int); + void f(); + using X::f; +};
using2.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: crash37.C =================================================================== --- crash37.C (nonexistent) +++ crash37.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 23 Nov 2000 + +// bug 706. We iced when meeting a decl with type error-mark-node + +class bifstream; + + +int main() +{ + bifstream bifs; // { dg-error "" } incomplete type + if (!bifs) + { + } + return 0; +}
crash37.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: eh1.C =================================================================== --- eh1.C (nonexistent) +++ eh1.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } + +class C2 { +public: + ~C2(); + C2 a() const; +}; +class C3 { +public: + C3(const C2 &c); +}; +class C4 +{ +public: + C3 *foo(bool b, const C2 &c); + C2 d() const; +}; +C3 *C4::foo(bool b, const C2 &c) +{ + return new C3(b ? d().a() : c); +}
eh1.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: overload12.C =================================================================== --- overload12.C (nonexistent) +++ overload12.C (revision 338) @@ -0,0 +1,30 @@ +// { dg-do assemble } +// Origin: Neil Booth from bug #27. + +struct A{}; + +struct B:A{}; + +struct C:B{}; + +struct CX +{ + C c; + + operator C&(){return c;} +}; + +// viable functions for call below +void f(A&); +void f(B&); + +int main() +{ + CX cx; + C c; + + f(c); // the standard conversion to B& is better than to A& + + f(cx); // after user defined conversion to C& + // the standard conversion to B& is better than to A& +}
overload12.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: cast4.C =================================================================== --- cast4.C (nonexistent) +++ cast4.C (revision 338) @@ -0,0 +1,63 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 3 Jan 2000 + +// Derived from a bug report by Ulrich Drepper + +struct A {operator char * () { return 0;} }; +struct B {operator char * () const { return 0;} }; +struct C {operator char const * () { return 0;} }; +struct D {operator char const * () const { return 0;} }; + +void f0 () +{ + A a = A (); + B b = B (); + C c = C (); + D d = D (); + + static_cast (a); + static_cast (b); + static_cast (c); // { dg-error "" } static cast + static_cast (d); // { dg-error "" } static cast +} + +void f1 () +{ + A a = A (); + B b = B (); + C c = C (); + D d = D (); + + static_cast (a); + static_cast (b); + static_cast (c); + static_cast (d); +} + +void f2 () +{ + A const a = A (); + B const b = B (); + C const c = C (); + D const d = D (); + + static_cast (a); // { dg-error "" } static cast + static_cast (b); + static_cast (c); // { dg-error "" } static cast + static_cast (d); // { dg-error "" } static cast +} + +void f3 () +{ + A const a = A (); + B const b = B (); + C const c = C (); + D const d = D (); + + static_cast (a); // { dg-error "" } static cast + static_cast (b); + static_cast (c); // { dg-error "" } static cast + static_cast (d); +}
cast4.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: vaarg1.C =================================================================== --- vaarg1.C (nonexistent) +++ vaarg1.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +#include +#include + +void f (int i, ...) +{ + va_list ap; + + va_start (ap, i); + vprintf ("test", ap); + va_end (ap); +}
vaarg1.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: optimize1.C =================================================================== --- optimize1.C (nonexistent) +++ optimize1.C (revision 338) @@ -0,0 +1,71 @@ +// { dg-do run } +// { dg-options "-O2" } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 18 May 2001 + +// Bug 2781. We forgot to copy addressability information when +// cloning. + +struct B +{ + B(int v1); + void Member (int v1); + static void Static (int v1); +}; + +struct D : B +{ + D (int v1); +}; + +void xswap(int& x1) ; + +int xxx = 0; + +B::B(int v1) +{ + xswap(v1); + xxx = v1; +} + +void B::Member(int v1) +{ + xswap(v1); + xxx = v1; +} + +void B::Static(int v1) +{ + xswap(v1); + xxx = v1; +} + +D::D(int v1) + : B (v1) +{ +} + +void xswap (int& x1) { x1 = 2; } + +int main () +{ + B p (1); + + if (xxx != 2) + return 1; + + D q (1); + if (xxx != 2) + return 2; + + p.Member (1); + if (xxx != 2) + return 3; + + p.Static (1); + if (xxx != 2) + return 4; + + return 0; +}
optimize1.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: sizeof3.C =================================================================== --- sizeof3.C (nonexistent) +++ sizeof3.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do run } +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 5 Sep 1999 + +// C++ does not decay lvalues into rvalues until as late as possible. This +// means things like the rhs of a comma operator mustn't decay. This will make +// a difference if it is an array or function. + +extern "C" void abort(); + +int main (int argc, char **argv) +{ + int ary[10]; + int ary1[10]; + + if (sizeof (0,ary) != sizeof (ary)) + abort (); + if (sizeof (argc ? ary : ary1) != sizeof (ary)) + abort (); + return 0; +}
sizeof3.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-aux.cc =================================================================== --- ctor1-aux.cc (nonexistent) +++ ctor1-aux.cc (revision 338) @@ -0,0 +1,12 @@ +// Origin: Mark Mitchell + +template +struct S { + template + S (U); +}; + +int main () +{ + S (3.0); +} Index: enum4.C =================================================================== --- enum4.C (nonexistent) +++ enum4.C (revision 338) @@ -0,0 +1,26 @@ +// { dg-do run } +// { dg-options "-fshort-enums" } + +// Origin: Mark Mitchell + +// On ARM EABI targets this testcase will cause a warning to be emitted +// whilst EABI attributes are being merged at link time unless +// the --no-enum-size-warning option is passed to the linker. Whilst the +// enum-size attributes should only be emitted if there are values of +// enum type that can escape the compilation unit, gcc cannot currently +// detect this; if this facility is added then this linker option should +// not be needed. arm-*-linux*eabi should be a good approximation to +// those platforms where the EABI supplement defines enum values to be +// 32 bits wide. +// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } } + +enum E { + a = -312 +}; + +E e = a; + +int main () { + if ((int) e != -312) + return 1; +}
enum4.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: ptrmem6.C =================================================================== --- ptrmem6.C (nonexistent) +++ ptrmem6.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } + +// Copyright (c) 2000, 2001 Free Software Foundation. +// Distilled from a bug report by Eric Ford + +extern double *y; +extern double *x; +extern int nPoints; + +void SetInitCond(void) +{ + int i; + for(i = 2; i < nPoints; ++i) + y[i] = y[nPoints] .* (x[i]-x[1]) / (x[nPoints]-x[1]); // { dg-error "" } .* +}
ptrmem6.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: lookup1.C =================================================================== --- lookup1.C (nonexistent) +++ lookup1.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do assemble } +// simple test for id from base class during class defn + +struct foo { + enum { blah = 1 }; +}; +struct bar : public foo { + char cache[blah]; +};
lookup1.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: warn3.C =================================================================== --- warn3.C (nonexistent) +++ warn3.C (revision 338) @@ -0,0 +1,55 @@ +// { dg-do assemble } +// { dg-options "-Wctor-dtor-privacy" } + +class A { +}; + + +class B { // { dg-warning "" } only private constructors +public: + void f(); + +private: + B (); + B (const B&); +}; + + +class C { // { dg-warning "" } only private destructors +public: + void f(); + +private: + ~C (); +}; + + +class D { // { dg-warning "" } all member functions are private +private: + void f(); +}; + + +template +class X { // { dg-warning "" } only private destructors +private: + ~X (); +}; + +template class X; +template class X; + + +template +class Y { // { dg-warning "" } only private constructors +private: + Y (); + Y (const Y&); +}; + + +template +class Z { // { dg-warning "" } all member functions are private +private: + void f(); +};
warn3.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: conv8.C =================================================================== --- conv8.C (nonexistent) +++ conv8.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do assemble } +// Origin: Jakub Jelinek + +class bar +{ +public: + bar(); + virtual ~bar(); + static void a(); +}; + +class baz : public bar +{ +}; + +class foo : virtual public baz +{ +public: + static void a(); + void b(); +}; + +typedef void (bar::*T)(); +T d; + +void foo::a() +{ + typedef void(foo::*t)(); + t c = & foo::b; + d = (T) c; // { dg-error "pointer to member" } +}
conv8.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: op1.C =================================================================== --- op1.C (nonexistent) +++ op1.C (revision 338) @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct S { + bool operator! (int, ...); // { dg-error "" } +};
op1.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,5 @@ +// { dg-do assemble } +// Origin: j_bouis@hotmail.com + +enum { FOO = 3 }; +int* arr = new int[FOO];
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: virtual4.C =================================================================== --- virtual4.C (nonexistent) +++ virtual4.C (revision 338) @@ -0,0 +1,25 @@ +// { dg-do assemble } + +class A { +public: + virtual int foo() = 0; // { dg-error "" } original definition +}; + +class B { +public: + virtual double foo() = 0; +}; + +class C + : public A, public B +{ +public: + virtual double foo() { return 2; } // { dg-error "" } conflicting return type +}; + +class D + : public B, public A +{ +public: + virtual double foo() { return 2; } // { dg-error "" } conflicting return type +};
virtual4.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,14 @@ +// { dg-do assemble } + +class S +{ + ~S(); +public: + friend void f(); +}; + + +S::~S() +{ + static S s; +}
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: crash29.C =================================================================== --- crash29.C (nonexistent) +++ crash29.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// Origin: Jakub Jelinek + +class bar +{ +public: + void foo (); + void baz (); +}; +void bar::foo () +{ + baz x(); // { dg-error "" } +}
crash29.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,24 @@ +// { dg-do run } +// Test that we properly default-initialize the new int when () is given. + +#include +using namespace std; +extern "C" void *malloc (size_t); + +int special; +int space = 0xdeadbeef; + +void *operator new (size_t size) throw (bad_alloc) +{ + if (special) + return &space; + return malloc (size); +} + +int main () +{ + special = 1; + int *p = new int(); + special = 0; + return *p != 0; +}
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: inline14.C =================================================================== --- inline14.C (nonexistent) +++ inline14.C (revision 338) @@ -0,0 +1,49 @@ +// { dg-do assemble } +// Origin: Gerald Pfeifer + +#include + +struct IDENT + { + enum TYPE { Variable, Constant } type; + + std::ostream& printTo(std::ostream& out) const + { + switch (type) + { + case Variable: + out << '_'; + break; + default: + break; + } + return out; + } + }; + + +template +struct TC + { + IDENT i; + + const IDENT& getIdent() const + { + return i; + } + }; + +template +inline std::ostream& operator<< (std::ostream& out, const TC &c) + { + c.getIdent().printTo(out); + return out; + } + +void foo(const TC &c) + { + std::cerr << c + << ": " // This line is crucial! + << c + << std::endl; + }
inline14.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: comdat1-aux.cc =================================================================== --- comdat1-aux.cc (nonexistent) +++ comdat1-aux.cc (revision 338) @@ -0,0 +1,10 @@ +inline int f () +{ + static int i; + return ++i; +} + +int g () +{ + return f(); +} Index: init6.C =================================================================== --- init6.C (nonexistent) +++ init6.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do run } +// Test for default-initialization of POD-structs in functional cast notation. + +struct foo { int a[10]; }; + +int main() +{ + foo f = foo(); + int r = 0; + for (int i = 0; i < 10; ++i) + r |= f.a[i]; + return r; +}
init6.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: decl4.C =================================================================== --- decl4.C (nonexistent) +++ decl4.C (revision 338) @@ -0,0 +1,8 @@ +// { dg-do assemble } + +// Reported by Harri Porten +// Simplified for testsuite by Alexandre Oliva + +struct foo { operator long double(); }; +int bar(int __opr); +int bar(int __ope);
decl4.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: static15.C =================================================================== --- static15.C (nonexistent) +++ static15.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do run } +// Origin: Mark Mitchell +// Special g++ Option: -fdata-sections + +void f() +{ + static int ctors[3] = { 0, 0, 0 }; + + ctors[2] = 7; +} + +int main () +{ + f (); +}
static15.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: init12.C =================================================================== --- init12.C (nonexistent) +++ init12.C (revision 338) @@ -0,0 +1,22 @@ +// { dg-do link } +// { dg-options "-O3" } +// Origin: Mark Mitchell + +typedef int (*fp)(); + +struct S +{ + fp f; +}; + +struct T +{ + static int f() { return 0; } +}; + +static const S s = { &T::f }; + +int main() +{ + return (*s.f)(); +}
init12.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: cond4.C =================================================================== --- cond4.C (nonexistent) +++ cond4.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do assemble } +// Origin: Loring Holden + +template +class _vec3d +{ + public: + double _x, _y; +}; + +class Wvec : public _vec3d { }; + +template +class TDI { + public: + T &get(); +}; + +template +class hashvar { + public : + T _val; + TDI *val() const; + T get() const { return true ? val()->get() : _val; } +}; + +int +main() { + hashvar CONSTRAINT_DIR; + CONSTRAINT_DIR.get(); +}
cond4.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: using3.C =================================================================== --- using3.C (nonexistent) +++ using3.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +struct A{ + A(); +}; + +typedef struct { + A i; +} S; + +struct B: S{ + using S::S; // { dg-error "" } no such field +};
using3.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: crash38.C =================================================================== --- crash38.C (nonexistent) +++ crash38.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 28 Nov 2000 + +// Bug 611. We ICEd when calling a member function returning an incomplete +// type by value. + +struct X; // { dg-error "" } forward ref + +struct Y +{ + X foo (); +}; + +void baz (Y *p) +{ + p->foo (); // { dg-error "" } incomplete +}
crash38.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: eh2.C =================================================================== --- eh2.C (nonexistent) +++ eh2.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// { dg-options "-O2" } +// Origin: Jakub Jelinek + +class a { +public: + double b; + int c; + ~a() { } +}; + +int bar(a x); +a foo(double x); + +int baz(double x, int y) +{ + return bar(foo(x)); +}
eh2.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: overload13.C =================================================================== --- overload13.C (nonexistent) +++ overload13.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// Origin: Nathan Sidwell + +struct A { + bool operator== (A const &); + operator bool () const; + operator int * () const; +}; + +bool foo (A &a1, A &a2) +{ + return a1 == a2; +}
overload13.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: cast5.C =================================================================== --- cast5.C (nonexistent) +++ cast5.C (revision 338) @@ -0,0 +1,38 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 Feb 2000 + +// Array of cv T decays to pointer to cv T, and pointer to array of cv T can +// be converted to pointer to cv T. We need to make sure the `cv's don't +// confuse us. + +typedef char const *ary_t[2]; + +void f0 (ary_t const *const &ary) +{ + static_cast (ary); + static_cast (ary); // { dg-error "" } casts away const + (void const *) (ary); +} + +void f1 (ary_t *const &ary) +{ + static_cast (ary); + static_cast (ary); + (void const *) (ary); +} + +void f2 (ary_t const *&ary) +{ + static_cast (ary); + static_cast (ary); // { dg-error "" } casts away const + (void const *) (ary); +} + +void f3 (ary_t *&ary) +{ + static_cast (ary); + static_cast (ary); + (void const *) (ary); +}
cast5.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: vaarg2.C =================================================================== --- vaarg2.C (nonexistent) +++ vaarg2.C (revision 338) @@ -0,0 +1,64 @@ +// { dg-do run } +// { dg-options "-Wno-abi" { target arm_eabi } } +// Copyright (C) 1999, 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 Oct 1999 + +// Make sure we can deal with POD aggregate in va_args + +#include +extern "C" void abort (); + +struct X {int m;}; +struct Y {int a; int b; int c; int d; int e; int f;}; + +void fn1(va_list args) +{ + int i = va_arg (args, int); + X x = va_arg (args, X); + Y y = va_arg (args, Y); + if (i != 1) + abort (); + if (x.m != 1) + abort (); + if (y.a != 1 || y.b != 2 || y.c != 3 || y.d != 4 || + y.e != 5 || y.f != 6) + abort (); +} + +void fn2(va_list args) +{ + const int &i = va_arg (args, int); + const X &x = va_arg (args, X); + const Y &y = va_arg (args, Y); + if (i != 1) + abort (); + if (x.m != 1) + abort (); + if (y.a != 1 || y.b != 2 || y.c != 3 || y.d != 4 || + y.e != 5 || y.f != 6) + abort (); +} + +void +dispatch (int t, ...) +{ + va_list args; + + va_start (args, t); + fn1 (args); + va_end (args); + + va_start (args, t); + fn2 (args); + va_end (args); +} + +int main () +{ + X x = {1}; + Y y = {1, 2, 3, 4, 5, 6}; + + dispatch (0, 1, x, y); + + return 0; +}
vaarg2.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: optimize2.C =================================================================== --- optimize2.C (nonexistent) +++ optimize2.C (revision 338) @@ -0,0 +1,75 @@ +// { dg-do run } +// { dg-options "-O2" } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 26 May 2001 + +// Bug 2823. Inlineing the body of a thunk broke things. But that's +// rarely a sensible thing to do anyway. + +#include +#include + +int objCount = 0; + +struct Thing +{ + int count; + + Thing (); + Thing (Thing const &src); + + ~Thing (); + +}; + +Thing::Thing () + :count (0) +{ + objCount++; + std::printf ("%p %s\n", (void *)this,__PRETTY_FUNCTION__); +} + +Thing::Thing (Thing const &src) + :count (0) +{ + objCount++; + std::printf ("%p %s\n", (void *)this, __PRETTY_FUNCTION__); +} + +Thing::~Thing () +{ + std::printf ("%p %s\n", (void *)this, __PRETTY_FUNCTION__); + if (count) + std::abort (); + count--; + objCount--; +} + +void x(Thing name) +{ + // destruct name here +} + +class Base +{ + public: + virtual void test(const Thing& s) = 0; +}; + +class Impl : virtual public Base +{ + public: + virtual void test(const Thing& s) + { + x(s); // copy construct temporary + } +}; + +int main() +{ + Impl *impl = new Impl(); + + impl->test( Thing ()); // This will use a thunk + return objCount != 0; +}
optimize2.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: sizeof4.C =================================================================== --- sizeof4.C (nonexistent) +++ sizeof4.C (revision 338) @@ -0,0 +1,41 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 5 Sep 1999 + +// C++ does not decay lvalues into rvalues until as late as possible. This +// means things like the rhs of a comma operator mustn't decay. This will make +// a difference if it is an array or function. + +struct S; +struct T {int m;}; +extern S s; // an incomplete +extern S arys[20]; // an incomplete array +extern T aryt[]; // an incomplete array; + +void fn () {} + +int main (int argc, char **argv) +{ + sizeof (s); // { dg-error "" } incomplete + sizeof (0, s); // { dg-error "" } incomplete + sizeof (argc ? s : s); // { dg-error "" } incomplete + + sizeof (arys); // { dg-error "" } incomplete + sizeof (0, arys); // { dg-error "" } incomplete + sizeof (argc ? arys : arys); // { dg-error "" } incomplete + + sizeof (aryt); // { dg-error "" } incomplete + sizeof (0, aryt); // { dg-error "" } incomplete + sizeof (argc ? aryt : aryt); // { dg-error "" } incomplete + + sizeof (fn); // { dg-error "" } cannot take size of function + sizeof (0, fn); // { dg-error "" } cannot take size of function + sizeof (argc ? fn : fn); // { dg-error "" } cannot take size of function + + sizeof (&fn); // ok + sizeof (0, &fn); // ok + sizeof (argc ? &fn : &fn); // ok + + return 0; +}
sizeof4.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: inline23.C =================================================================== --- inline23.C (nonexistent) +++ inline23.C (revision 338) @@ -0,0 +1,28 @@ +// { dg-do link } + +struct B +{ + virtual ~B() {} +}; + +struct A : public B +{ + ~A(); + void foo(void); + void bar(void); +}; + +inline void A::foo(void) +{ + static int i; + i++; +} + +void A::bar() +{ + foo(); +} + +int main() +{ +}
inline23.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: bitfld1.C =================================================================== --- bitfld1.C (nonexistent) +++ bitfld1.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Based on a bug report by Stephen Vavasis + +// declares template operator!= +#include + +struct foo { + enum e { bar } baz:1; + void test() { + baz != bar; + } +};
bitfld1.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: friend1.C =================================================================== --- friend1.C (nonexistent) +++ friend1.C (revision 338) @@ -0,0 +1,88 @@ +// { dg-do assemble } +// f() should be able to access B::j, as of FDIS [class.protected]/1 + +// Subject: Re: [bug] Inheritance and friend access control broken +// References: <199803032141.WAA09332@piano.dptmaths.ens-cachan.fr> +// +// <199803041125.MAA06937@cor.dptmaths.ens-cachan.fr> +// <19980304102900.46897@dgii.com> +// From: Alexandre Oliva +// Date: 06 Mar 1998 01:43:18 -0300 + +template +class X {}; + +template +void g(); + +struct S; + +template +struct R; + +class B { +protected: + int i; // { dg-error "" } in this context + static int j; +}; + +class D : public B { + friend void f(); + template + friend void g(); + friend struct S; + template + friend struct R; +}; + +struct S { + void h(); + X<&B::j> x; +}; + +template +struct R { + void h(); + X<&B::j> x; +}; + +B b; +D d; + +void f() +{ + b.i = 3; // { dg-error "" } protected + d.i = 4; + B::j = 5; + D::j = 6; +} + +template +void g() +{ + b.i = 3; // { dg-error "" } protected + d.i = 4; + B::j = 5; + D::j = 6; +} + +template void g(); + +void S::h() +{ + b.i = 3; // { dg-error "" } protected + d.i = 4; + B::j = 5; + D::j = 6; +} + +template +void R::h() +{ + b.i = 3; // { dg-error "" } protected + d.i = 4; + B::j = 5; + D::j = 6; +} + +template struct R;
friend1.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: enum5.C =================================================================== --- enum5.C (nonexistent) +++ enum5.C (revision 338) @@ -0,0 +1,26 @@ +// { dg-do run } +// Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. +// Contributed by Ben Elliston + +// PR 80: Packed enums use minimum required storage. + +extern "C" void abort(); + +enum numbers { one, two, three } __attribute__ ((packed)) nums; +enum colours { red = 1000, green, blue } __attribute__ ((packed)) cols; +enum conditions { fine, rain, cloudy } __attribute__ ((packed)) forecast; + +int +main() +{ + if (sizeof (nums) != 1) + abort (); + + if (sizeof (cols) != 2) + abort (); + + if (sizeof (forecast) != 1) + abort (); + + return 0; +}
enum5.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: ptrmem7.C =================================================================== --- ptrmem7.C (nonexistent) +++ ptrmem7.C (revision 338) @@ -0,0 +1,47 @@ +// { dg-do assemble } +// +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 14 Aug 2000 + +// A pointer to member can only be formed by `&T::m', however, other forms +// are ok for pointer to static member. Thus the error can only be determined +// after overload resolution. + +struct A +{ + static int ns (short); + static int ns (float); + int ns (int); + int ns (double); + int single (int); + static int sole (short); + void foo (); +}; +void A::foo () +{ + int (A::*ptr1) (int) = &A::ns; + int (A::*ptr2) (int) = A::ns; // { dg-error "pointer to member" "err" } + // { dg-message "pointer to member" "note" { target *-*-* } 23 } + int (A::*ptr3) (int) = &ns; // { dg-error "pointer to member" "err" } + int (A::*ptr4) (int) = ns; // { dg-error "pointer to member" "err" } + + int (*ptr5) (short) = &A::ns; + int (*ptr6) (short) = A::ns; + int (*ptr7) (short) = &ns; + int (*ptr8) (short) = ns; + + int (A::*ptr11) (int) = &A::single; + int (A::*ptr12) (int) = A::single; // { dg-error "match" } + int (A::*ptr13) (int) = &single; // { dg-error "pointer to member" } + int (A::*ptr14) (int) = single; // { dg-error "match" } + + int (A::*ptr20) (int) = &(A::ns); // { dg-error "pointer to member" } + int (A::*ptr21) (int) = &(A::single); // { dg-error "pointer to member" } + + int (*ptr31) (short) = &A::sole; + int (*ptr32) (short) = A::sole; + int (*ptr33) (short) = &sole; + int (*ptr34) (short) = sole; + int (*ptr41) (short) = &(A::sole); + int (*ptr43) (short) = &(sole); +}
ptrmem7.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: lookup2.C =================================================================== --- lookup2.C (nonexistent) +++ lookup2.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } + +struct B { + int i; +}; + +struct D: virtual public B { + int i; +}; + +struct D2 : public D { + void f() { i = 3; } +};
lookup2.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: warn4.C =================================================================== --- warn4.C (nonexistent) +++ warn4.C (revision 338) @@ -0,0 +1,68 @@ +// { dg-do assemble } +// { dg-options "-Wsign-conversion" } + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 21 Nov 1999 + +// make sure we only warn on assigning a negative (signed) value +// to an unsigned type, and don't warn just if the unsigned value +// happens to have the top bit set. + +typedef unsigned U; + +void fn (unsigned); + +void fu () +{ + unsigned s1 = -1u; + unsigned s2(-1u); + unsigned volatile s3 = -1u; + unsigned const s4 = -1u; + unsigned const &s5(-1u); + s1 = -1u; + fn (-1u); +} + +void fU () +{ + U s1 = -1u; + U s2(-1u); + U volatile s3 = -1u; + U const s4 = -1u; + U const &s5(-1u); + s1 = -1u; + fn (-1u); +} + +void fs () +{ + unsigned s1 = -1; // { dg-warning "" } initialization + unsigned s2(-1); // { dg-warning "" } initialization + unsigned volatile s3 = -1;// { dg-warning "" } initialization + unsigned const s4 = -1; // { dg-warning "" } initialization + unsigned const &s5(-1); // { dg-warning "" } initialization + s1 = -1; // { dg-warning "" } assignment + fn (-1); // { dg-warning "" } passing +} + +void fss () +{ + unsigned s1 = -(-1); + unsigned s2(-(-1)); + unsigned volatile s3 = -(-1); + unsigned const s4 = -(-1); + unsigned const &s5(-(-1)); + s1 = -(-1); + fn (-(-1)); +} + +void fsz () +{ + unsigned s1 = -0; + unsigned s2(-0); + unsigned volatile s3 = -0; + unsigned const s4 = -0; + unsigned const &s5(-0); + s1 = -0; + fn (-0); +}
warn4.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: conv9.C =================================================================== --- conv9.C (nonexistent) +++ conv9.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do assemble } + +struct +Foo +{ +public: + typedef void* (*copier_fn)(void const*); + void foo() const; + void bar(char const*, void const*) const; +private: + struct + Bar + { + char const* key; + void const* item; + }; +}; + +void +Foo::foo() const +{ + Bar* cp = 0; + copier_fn copyfn = 0; + + bar(cp->key, cp->item); + bar(cp->key, (copyfn) ? (*copyfn)(cp) : 0); + bar(cp->key, (copyfn) ? (*copyfn)(0) : 0); + + bar(cp->key, (copyfn) ? (*copyfn)(0) : cp->item); + bar(cp->key, (copyfn) ? (*copyfn)(cp) : cp->item); +}
conv9.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: override1.C =================================================================== --- override1.C (nonexistent) +++ override1.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// Origin: Frank Pilhofer + +struct A { +virtual void f (); +}; + +struct B : virtual public A { +void f (); +}; + +struct C : virtual public A { +void f (); +}; + +struct D : virtual public B, virtual public C { +void f (); +}; + +struct Di : virtual public B, virtual public C, virtual public D {};
override1.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: op2.C =================================================================== --- op2.C (nonexistent) +++ op2.C (revision 338) @@ -0,0 +1,64 @@ +// { dg-do run } +// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 28 Nov 2000 + +// Bug 91. We'd not preserve constness looking for a base classes assignment +// operator. + +#include + +int value = 0; + +struct A +{ + A() {} + + A( A& arg) + { printf ("%s\n", __PRETTY_FUNCTION__); value = 1;} + + A( const A& arg) + { printf ("%s\n", __PRETTY_FUNCTION__); value = 2;} + + A& operator=( A& ) + { printf ("%s\n", __PRETTY_FUNCTION__); value = 3; return *this; } + + A& operator=( const A& ) + { printf ("%s\n", __PRETTY_FUNCTION__); value = 4; return *this; } +}; + +struct B : A +{ + B () {} +}; + +void foo( A& ) +{ + printf ("%s\n", __PRETTY_FUNCTION__); value = 5; +} + +void foo( const A& ) +{ + printf ("%s\n", __PRETTY_FUNCTION__); value = 6; +} + + +int main() +{ + const A a0; + value = 0; printf ("A(cA) : "); A a1(a0); if (value != 2) return 1; + value = 0; printf ("A(A ) : "); A a2(a1); if (value != 1) return 2; + + const B b0; + value = 0; printf ("B(cB) : "); B b1(b0); if (value != 2) return 3; + value = 0; printf ("B(B ) : "); B b2(b1); if (value != 2) return 4; + + value = 0; printf ("A= cA : "); a1 = a0; if (value != 4) return 5; + value = 0; printf ("A= A : "); a1 = a2; if (value != 3) return 6; + value = 0; printf ("B= cB : "); b1 = b0; if (value != 4) return 7; + value = 0; printf ("B= B : "); b1 = b2; if (value != 4) return 8; + + value = 0; printf ("foo(cB): "); foo(b0); if (value != 6) return 9; + value = 0; printf ("foo(B ): "); foo(b2); if (value != 5) return 10; + + return 0; +}
op2.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: 900403_04.C =================================================================== --- 900403_04.C (nonexistent) +++ 900403_04.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// GROUPS passed abort +// g++ 1.37.1 bug 900403_04 + +// The following erroneous code causes g++ to abort. + +// keywords: abort, bit-fields, zero length + +struct s { + unsigned int foo:0; // { dg-error "" } causes abort + unsigned int field; +};
900403_04.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,10 @@ +// { dg-do assemble } +// We tried to create a temporary of unknown size and crashed. + +extern int a1[]; +extern int a2[]; +int foo(int p) +{ + int x = (p ? a1 : a2)[1]; + return x; +}
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: virtual5.C =================================================================== --- virtual5.C (nonexistent) +++ virtual5.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// { dg-options "-w" } +// Origin: Derived from code by Andris Pavenis + +class vector {}; + +class V +{ +}; + +class A : public vector +{ +}; + +class B : public A, virtual V, public vector +{ + B() {} +}; + +
virtual5.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: static4.C =================================================================== --- static4.C (nonexistent) +++ static4.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do run } +// { dg-options "-O" } +// Origin: Andrew Pollard + +struct A { + A(int, int); +}; +A::A(int, int) {} +static A _A(0, 0); +int main() { return(0); }
static4.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: local1.C =================================================================== --- local1.C (nonexistent) +++ local1.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do link } + +struct Outer { + virtual ~Outer() {} +}; + +int +main() +{ + { struct Inner : virtual public Outer {} inner; } + { struct Inner : virtual public Outer {} inner; } +} +
local1.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,40 @@ +// { dg-do run } +// Origin: philip_martin@ntlworld.com + +#include + +extern "C" void abort(); + +bool new_flag = false; +bool delete_flag = false; + +struct X { + X() + { + throw 1; + } + void* operator new ( std::size_t n ) throw ( std::bad_alloc ) + { + new_flag = true; + return ::operator new( n ); + } + void operator delete( void* p, std::size_t n ) throw() + { + delete_flag = true; + ::operator delete( p ); + } +}; + +int +main() +{ + try + { + X* x = new X; // gcc 3.0 fails to call operator delete when X::X throws + } + catch ( ... ) + { + } + if ( ! new_flag || ! delete_flag ) + ::abort(); +}
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: inline15.C =================================================================== --- inline15.C (nonexistent) +++ inline15.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do assemble } +// { dg-options "-O1" } +// Origin: Jakub Jelinek + +class Type; +template +class X +{ +public: + X(); + inline X(int); + inline ~X(); +}; +template const Type &foo(const X *); +template inline X::X(int x) +{ + const Type &a = foo(this); +} +template inline X::~X() +{ + const Type &a = foo(this); +} +class Y +{ + X a; +public: + Y(const X &x = X()); +}; +Y::Y(const X &x) : a(1) +{ +}
inline15.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,16 @@ +// { dg-do run } +// { dg-additional-sources " ctor1-aux.cc" } + +// Origin: Mark Mitchell + +template +struct S { + template + S (U); +}; + +template +template +S::S (U) {} + +template S::S (double);
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: init7.C =================================================================== --- init7.C (nonexistent) +++ init7.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do run } +// simplified from testcase in Windows Developer Journal, +// submitted by eyal.ben-david@aks.com + +// The initialization of a static local variable must be retried if a +// previous try finished by throwing an exception [stmt.dcl]/4 + +extern "C" void abort (); + +struct foo { + foo() { throw true; } +}; + +void bar() { + static foo baz; +} + +int main() { + try { + bar(); // must throw + } + catch (bool) { + try { + bar(); // must throw again! + } + catch (bool) { + return 0; + } + } + abort(); +}
init7.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,26 @@ +// { dg-do run } +// Bug: expand_vec_init doesn't copy arrays of builtin types. + +struct B { + B() { } + B(const B&) { } +}; + +struct A +{ + B b; + int ar[5]; +}; + +int main() +{ + A a; + for (int i = 0; i < 5; ++i) + a.ar[i] = i; + + A a2 = a; + + for (int i = 0; i < 5; ++i) + if (a2.ar[i] != a.ar[i]) + return 1; +}
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: decl5.C =================================================================== --- decl5.C (nonexistent) +++ decl5.C (revision 338) @@ -0,0 +1,79 @@ +// { dg-do assemble } + +// Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 22 Apr 1999 +// derived from a bug report by +// http://gcc.gnu.org/ml/gcc-bugs/1999-04n/msg00631.html +// the code is wrong, but we fell over badly + + +struct A { + int A::fn(); // { dg-error "extra qualification" } + int A::m; // { dg-error "extra qualification" } + struct e; + struct A::e {int i;}; // { dg-error "extra qualification" "qual" } + // { dg-error "anonymous struct" "anon" { target *-*-* } 14 } + struct A::expand { // { dg-error "qualified name" } + int m; + }; + struct Z; + expand me; // { dg-error "'expand' does not name a type" } + void foo(struct A::e); + void foo(struct A::z); // { dg-error "does not name a type" } +}; + +struct Q; +struct B { + struct A::fink { // { dg-error "does not name a class before" } + int m; + }; + struct A::Z { // { dg-error "does not enclose" } A::Z not a member of B + int m; + }; + int m; + int n; + struct ::Q { // { dg-error "global qual" } ::Q not a member of B + int m; + }; + int A::fn() { // { dg-error "cannot define member" } A::fn not a member of B + return 0; + } + void fn(struct ::Q &); + void foo(struct A::y); // { dg-error "does not name a type" } no such member +}; + +struct ::C { // { dg-error "invalid before" } extra qualification + int i; +}; + +namespace N { + int fn(); + struct F; +} + +namespace NMS +{ + void NMS::fn(); // { dg-error "explicit qual" } + int NMS::i; // { dg-error "explicit qual" } + struct NMS::D { // { dg-error "does not name a class" } + int i; + }; + struct N::E { // { dg-error "does not name a class" } no such type + int i; + }; + struct ::F { // { dg-error "global qual" } no such type + int i; + }; + int N::fn() { // { dg-error "namespace" } N::fn not a member of NMS + return 0; + } + struct N::F { // { dg-error "namespace" } N::F not a member of NMS + int i; + }; +} + +NMS::D thing; // { dg-error "'D' in namespace 'NMS' does not name a type" } +void NMS::fn() +{ + i = 3; +}
decl5.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: static16.C =================================================================== --- static16.C (nonexistent) +++ static16.C (revision 338) @@ -0,0 +1,25 @@ +// { dg-do run } +// Test that we properly evaluate the object parameter when accessing static +// members. + +struct A { + static void f () {} + static int i; +}; + +int A::i; + +int c = 0; + +A g () +{ + ++c; + return A(); +} + +int main () +{ + g().f(); + g().i = 42; + return (c != 2); +}
static16.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,42 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 3 Jun 1999 + +// Duplicate definitions are wrong, we should just cough +// politely, but we used to die horribly. + +class Y +{ // { dg-error "" } previous definition +}; +class Y // { dg-error "" } redefinition +{ +}; + +template class X +{ // { dg-error "" } previous definition +}; +template class X // { dg-error "" } redefinition +{ +}; + +template class X +{ // { dg-error "" } previous definition +}; +template class X // { dg-error "" } redefinition +{ +}; + +template<> class X +{ // { dg-error "" } previous definition +}; +template<> class X // { dg-error "" } redefinition +{ +}; + +template<> class X +{ // { dg-error "" } previous definition +}; +template<> class X // { dg-error "" } redefinition +{ +};
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: init13.C =================================================================== --- init13.C (nonexistent) +++ init13.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do link } +// { dg-options "-O3" } +// Origin: Gabriel Dos_Reis + +void f() {} + +struct X { + ~X() { f (); } +}; + +X x; + +int main () {}
init13.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: cond5.C =================================================================== --- cond5.C (nonexistent) +++ cond5.C (revision 338) @@ -0,0 +1,45 @@ +// { dg-do assemble } +// { dg-options "-W -pedantic -ansi" } + +// Copyright (C) 1999, 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 1 Sep 1999 +// Derived from bug report from Gabriel Dos Reis +// +// http://gcc.gnu.org/ml/gcc-bugs/1999-03n/msg00888.html + +// conditional exprs have some funny rules when one of the types is void. +// [expr.cond] 5.16, make sure we do the right things +// We have checks for mismatching enumerations, check we give them -- they had +// got lost due to changes in add_builtin_candidate and subsequent changes. + +struct X {}; +enum E1 {e1 = -1}; +enum E2 {e2 = -1}; +void f(int, ...); + +void fn(int i) +{ + double d; + int j; + + j = (i ? e1 : e2); // { dg-warning "mismatch" } + d = (i ? e1 : 1.0); // { dg-warning "non-enumeral" } + d = (i ? 1.0 : e2); // { dg-warning "non-enumeral" } + E1 e = (i ? e1 : e1); // ok + j = (i ? 1 : e2); // ok + j = (i ? e1 : 1); // ok + + j = (i ? throw X() : 1); // ok, int + j = (i ? 1 : throw X()); // ok, int + + (i ? throw X() : throw X()); // ok, void + + (i ? i : j) = 1; // ok, int & + (i ? throw X() : j) = 1; // { dg-error "lvalue" } + (i ? j : throw X()) = 1; // { dg-error "lvalue" } + (i ? throw X() : throw X()) = 1; // { dg-error "lvalue" } + + (i ? (void)1 : i++); // { dg-error "throw-expression" } + (i ? i++ : (void)1); // { dg-error "throw-expression" } + +}
cond5.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: using4.C =================================================================== --- using4.C (nonexistent) +++ using4.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } + +// Based on a testcase by Martin Bachtold + +struct foo { + void m(); +}; + +struct bar : foo { + using foo::m; + void m(int); +}; + +void f() { + bar b; + b.m(); + b.m(1); +}
using4.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: dll-1.C =================================================================== --- dll-1.C (nonexistent) +++ dll-1.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do assemble { target arm-*-*pe } } +// { dg-options "-mno-nop-fun-dllimport" } +// declspec test #1 +// set compiler_result "__imp_imp.*\.section${spaces}.drectve\n\[^\n\]*-export:exp" +// set not_compiler_result "__imp_exp" + +__declspec (dllimport) void imp (); + +__declspec (dllexport) void exp () { imp (); }
dll-1.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: crash39.C =================================================================== --- crash39.C (nonexistent) +++ crash39.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 10 Jan 2001 + +// Bug 595. We failed to clear out some things after seeing a duplicate +// struct definition. That caused us to become inconsistent. + +struct X +{ + ~X (); +}; +struct S { X a; }; // { dg-error "" } previous defn +struct S { X a; }; // { dg-error "" } redefinition + +void c1(S s) +{ +}
crash39.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: eh3.C =================================================================== --- eh3.C (nonexistent) +++ eh3.C (revision 338) @@ -0,0 +1,33 @@ +// { dg-do run } +// { dg-options "-O" } +typedef struct { } e; + +char *p; + +void _Jv_throw (); + +int barf (int len) +{ + char a[len]; + + p = a; + _Jv_throw (); + return 0; +} + +void _Jv_throw () +{ + e ex; + throw ex; +} + +int main () +{ + try { + barf (2); + } + catch (...) { + } + + return 0; +}
eh3.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: overload14.C =================================================================== --- overload14.C (nonexistent) +++ overload14.C (revision 338) @@ -0,0 +1,33 @@ +// { dg-do run } +// { dg-options "-Wconversion" } +extern "C" void abort(); + +struct A { + typedef double (&B); + typedef const double (&C); + + A() { } + + operator C () const; + operator B (); +}; + +static const double d = 2.0; +static double e = 3.0; + +A::operator A::C () const +{ + abort (); + return d; +} + +A::operator A::B () +{ + return e; +} + +int main () +{ + (A::C) A (); + return 0; +}
overload14.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: cast6.C =================================================================== --- cast6.C (nonexistent) +++ cast6.C (revision 338) @@ -0,0 +1,57 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 28 Nov 2000 + +// We failed to reject static_cast and implicit conversions of pointers to +// member that traversed a virtual base. + +struct bar +{ + int barm; + static void a(); +}; +struct filler1 {int fm;}; +struct filler2 {int fm;}; +struct filler3 {int fm;}; +struct filler4 {int fm;}; + +struct baz : filler1, bar, filler2 +{ + int bazm; +}; + +struct foo : filler3, virtual baz, filler4 +{ + static void a(); + void b() {} + int m; +}; + +typedef void (bar::*barfPtr)(); +typedef void (foo::*foofPtr)(); +typedef int bar::*barmPtr; +typedef int foo::*foomPtr; + +struct X; +typedef void (X::*xfPtr) (); +typedef int X::*xmPtr; + +int main () +{ + { + foofPtr fp = &foo::b; + barfPtr bp = static_cast (fp); // { dg-error "via virtual base" } invalid static_cast + foofPtr fp2 = static_cast (bp); // { dg-error "via virtual base" } invalid static_cast + foofPtr fp3 = bp; // { dg-error "via virtual base" } cannot convert + fp3 = (foofPtr)bp; // { dg-error "via virtual base" } via virtual base + + foomPtr fmp = &foo::m; + barmPtr bmp = static_cast (fmp); // { dg-error "via virtual base" } invalid static_cast + foomPtr fmp2 = static_cast (bmp); // { dg-error "via virtual base" } invalid static_cast + foomPtr fmp3 = bmp; // { dg-error "via virtual base" } cannot convert + fmp3 = (foomPtr)bmp; // { dg-error "via virtual base" } via virtual base + } + + return 0; +}
cast6.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: vbase1.C =================================================================== --- vbase1.C (nonexistent) +++ vbase1.C (revision 338) @@ -0,0 +1,52 @@ +// { dg-do run } +// { dg-options "-w" } +// Origin: Mark Mitchell + +int result; + +struct A { + A (); + + int i; +}; + +A* ap; + +A::A () +{ + ap = this; +} + +struct B : virtual public A +{ + B (); + ~B (); + + int j; +}; + +B::B () { + if ((A*) this != ap) + result = 1; +} + +B::~B () { + if ((A*) this != ap) + result = 1; +} + +struct C : public B { +}; + +struct D : public C, public B +{ +}; + +int main () +{ + { + D d; + } + + return result; +}
vbase1.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: vaarg3.C =================================================================== --- vaarg3.C (nonexistent) +++ vaarg3.C (revision 338) @@ -0,0 +1,32 @@ +// { dg-do assemble } +// { dg-options "-Wno-abi" { target arm_eabi } } + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 Oct 1999 + +// Make sure we diagnose bad uses of va_arg + +#include + +struct X {int m;}; +struct Y { Y(const Y&); }; +struct Z; // { dg-error "forward decl" } +void fn1(va_list args) +{ + int i = va_arg (args, int); + Y x = va_arg (args, Y); // { dg-error "cannot receive" } + Y y = va_arg (args, struct Y); // { dg-error "cannot receive" } + int &r = va_arg (args, int &); // { dg-error "cannot receive" } + + Z z1 = va_arg (args, Z); // { dg-error "incomplete" } + const Z &z2 = va_arg (args, Z); // { dg-error "incomplete" } + + va_arg (args, char); // { dg-warning "promote" } + // { dg-message "should pass" "pass" { target *-*-* } 24 } + // { dg-message "abort" "abort" { target *-*-* } 24 } + va_arg (args, int []); // { dg-error "array with unspecified bounds" } promote + va_arg (args, int ()); // { dg-warning "promoted" } promote + // { dg-message "abort" "abort" { target *-*-* } 28 } + va_arg (args, bool); // { dg-warning "promote" "promote" } + // { dg-message "abort" "abort" { target *-*-* } 30 } +}
vaarg3.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: optimize3.C =================================================================== --- optimize3.C (nonexistent) +++ optimize3.C (revision 338) @@ -0,0 +1,39 @@ +// { dg-do run } +// { dg-options "-O2" } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 29 May 2001 + +// Bug 2936. We ICE'd on tree inlining a function with an anonymous +// union decl. + +inline const unsigned char *Foo (const char *string) +{ + union + { + const char *p1; + const unsigned char *p2; + }; + p1 = 0; + p2 = 0; + + + p1 = string; + return p2; + +} + +const unsigned char *Baz (const char *string) +{ + return Foo (string); +} + +int main () +{ + const char *string = "s"; + const unsigned char *result; + + result = Baz (string); + return (static_cast (result) + != static_cast (string)); +}
optimize3.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,15 @@ +// { dg-do assemble } +struct cl_heap_ring{ + void operator delete (void* ptr) { } + cl_heap_ring () + { } +}; + +struct cl_heap_null_ring : public cl_heap_ring { + void operator delete (void* ptr) { } +}; + +void f() +{ + new cl_heap_null_ring(); +}
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: sizeof5.C =================================================================== --- sizeof5.C (nonexistent) +++ sizeof5.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do assemble } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 23 Feb 2000 +// Derived from a bug report by Marko Maekelae + + +struct A; +void foo () +{ + sizeof ( void ()); // { dg-error "" } ISO forbids + sizeof ( void (A::*) ()); + sizeof ( void (A::*) () const); + + sizeof (void (*) () const); // { dg-error "" } invalid quals + sizeof ( void () const); // { dg-error "" } ISO forbids, ERROR - invalid quals +}
sizeof5.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: bitfld2.C =================================================================== --- bitfld2.C (nonexistent) +++ bitfld2.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do assemble } +// { dg-options "-funsigned-bitfields" } +// Origin: Mark Mitchell + +typedef int i[4]; + +struct S { + i j:12; // { dg-error "" } array type as bitfield +};
bitfld2.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: comdat1.C =================================================================== --- comdat1.C (nonexistent) +++ comdat1.C (revision 338) @@ -0,0 +1,23 @@ +// { dg-do run } +// { dg-additional-sources " comdat1-aux.cc" } +// { dg-options "-O" } +// Test that statics in inline functions are unified between +// translation units. Currently we handle this by just suppressing +// inling and relying on unification of the function itself. + +inline int f () +{ + static int i; + return ++i; +} + +int g (); + +int main () +{ + if (f() != 1 + || g() != 2 + || f() != 3) + return 1; + return 0; +}
comdat1.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: friend2.C =================================================================== --- friend2.C (nonexistent) +++ friend2.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do assemble } + +void +f() +{ + class Local_2 { + friend class Friend; + + int i; + }; + + class Friend { + public: + void g() { + Local_2 l2; + l2.i = 3; + } + }; +}
friend2.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: ptrmem8.C =================================================================== --- ptrmem8.C (nonexistent) +++ ptrmem8.C (revision 338) @@ -0,0 +1,75 @@ +// { dg-do assemble } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 22 Nov 2000 + +// bug 827. We died issuing warnings about dangerous pointer to member +// conversions. + +struct bar +{ + int barm; + static void a(); +}; +struct filler1 {int fm;}; +struct filler2 {int fm;}; +struct filler3 {int fm;}; +struct filler4 {int fm;}; + +struct baz : filler1, bar, filler2 +{ + int bazm; +}; + +struct foo : filler3, virtual baz, filler4 +{ + static void a(); + void b() {} + int m; +}; + +typedef void (bar::*barfPtr)(); +typedef void (foo::*foofPtr)(); +typedef int bar::*barmPtr; +typedef int foo::*foomPtr; + +int main () +{ + foofPtr fp = &foo::b; + barfPtr bp = (barfPtr)fp; // { dg-error "pointer to member" } + foofPtr fp2 = (foofPtr)bp; // { dg-error "pointer to member" } + + if (fp2 != fp) + return 1; + + foo fobj; + fobj.filler1::fm = 1; + fobj.filler2::fm = 2; + fobj.filler3::fm = 3; + fobj.filler4::fm = 4; + fobj.bazm = 5; + fobj.barm = 6; + fobj.m = 78; + + foomPtr fmp = &foo::m; + barmPtr bmp = (barmPtr)fmp; // { dg-error "pointer to member" } + foomPtr fmp2 = (foomPtr)bmp; // { dg-error "pointer to member" } + bar *bptr = &fobj; + + if (fmp != fmp2) + return 2; + + if (bptr->*bmp != 78) + return 3; + + bp = reinterpret_cast (fp); + fp2 = reinterpret_cast (bp); + if (fp2 != fp) + return 4; + + bmp = reinterpret_cast (fmp); + fmp2 = reinterpret_cast (bmp); + if (fmp != fmp2) + return 5; + + return 0; +}
ptrmem8.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: lookup3.C =================================================================== --- lookup3.C (nonexistent) +++ lookup3.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do run } +// Test to make sure that the use of __typeof__ in WIFEXITED works. + +int main () +{ + int stat_loc = 0; + (__extension__ + ({ + union + { + __typeof__ (stat_loc) __in; + int __i; + } __u; + __u.__in = (stat_loc); + __u.__i; + }) + ); +}
lookup3.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: warn5.C =================================================================== --- warn5.C (nonexistent) +++ warn5.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do assemble } +// { dg-options "-W " } +// +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 6 Febs 2001 + +// Bug 1765. We gave bogus warning on default initializer. + +struct X +{ + int i; +}; + +X *foo () +{ + return new X (); // gets bogus warning +} + +X x = {}; // { dg-warning "" } missing initializer
warn5.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: override2.C =================================================================== --- override2.C (nonexistent) +++ override2.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Jason Merrill 14 Jun 2001 + +// Test for diagnosis of missing final overrider. + +struct A { virtual void f (); }; +struct B1: virtual A { virtual void f (); }; +struct B2: virtual A { virtual void f (); }; +struct C: public B1, public B2 {}; // { dg-error "" } no final overrider
override2.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: op3.C =================================================================== --- op3.C (nonexistent) +++ op3.C (revision 338) @@ -0,0 +1,64 @@ +// { dg-do run } +// Copyright (C) 2000, 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 28 Nov 2000 + +// Related to bug 91. We'd not preserve constness accessing a member of the +// source type in copy ctor and assignment op. + +#include + +int value = 0; + +struct A +{ + A() {} + + A( A& arg) + { printf ("%s\n", __PRETTY_FUNCTION__); value = 1;} + + A( const A& arg) + { printf ("%s\n", __PRETTY_FUNCTION__); value = 2;} + + A& operator=( A& ) + { printf ("%s\n", __PRETTY_FUNCTION__); value = 3; return *this; } + + A& operator=( const A& ) + { printf ("%s\n", __PRETTY_FUNCTION__); value = 4; return *this; } +}; + +struct B +{ + A a; + B () {} +}; + +void foo( A& ) +{ + printf ("%s\n", __PRETTY_FUNCTION__); value = 5; +} + +void foo( const A& ) +{ + printf ("%s\n", __PRETTY_FUNCTION__); value = 6; +} + +int main() +{ + const A a0; + value = 0; printf ("A(cA) : "); A a1(a0); if (value != 2) return 1; + value = 0; printf ("A(A ) : "); A a2(a1); if (value != 1) return 2; + + const B b0; + value = 0; printf ("B(cB) : "); B b1(b0); if (value != 2) return 3; + value = 0; printf ("B(B ) : "); B b2(b1); if (value != 2) return 4; + + value = 0; printf ("A= cA : "); a1 = a0; if (value != 4) return 5; + value = 0; printf ("A= A : "); a1 = a2; if (value != 3) return 6; + value = 0; printf ("B= cB : "); b1 = b0; if (value != 4) return 7; + value = 0; printf ("B= B : "); b1 = b2; if (value != 4) return 8; + + value = 0; printf ("foo(cB): "); foo(b0.a); if (value != 6) return 9; + value = 0; printf ("foo(B ): "); foo(b2.a); if (value != 5) return 10; + + return 0; +}
op3.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,21 @@ +// { dg-do run } +// { dg-options "-O1" } + +int count = 0; + +double foo () { + count++; + return 0; +} + +double bar () { + const double x[1] = { foo() }; + return x[0]; +} + +int main () +{ + bar(); + if (count != 1) + return 1; +}
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: static5.C =================================================================== --- static5.C (nonexistent) +++ static5.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct S +{ + ~S(); +}; + +inline void f() +{ + static S s; + atexit (0); // { dg-error "" } implicit declaration +} + + +
static5.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: local2.C =================================================================== --- local2.C (nonexistent) +++ local2.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// { dg-options "-O2" } + +void f () +{ + struct Init { + Init () { + } + }; +}
local2.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: virtual6.C =================================================================== --- virtual6.C (nonexistent) +++ virtual6.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// { dg-options "-Woverloaded-virtual" } +// Bug: g++ checks certain non-virtual functions to see if they override +// virtual functions. +// Submitted by Jason Merrill + +struct A { + virtual void f (int); +}; + +struct B: public A { + static void f (); + void f (int); +};
virtual6.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: addrof1.C =================================================================== --- addrof1.C (nonexistent) +++ addrof1.C (revision 338) @@ -0,0 +1,34 @@ +// { dg-do run } + +extern "C" void abort (); + +typedef struct st { + unsigned char a; + unsigned char b; + unsigned char c; + unsigned char d; +} __attribute__((aligned(4))) st; + +void testme(int, int, int); + +static inline void +stupid_func(st s) +{ + testme(s.a, s.b, s.c); +} + +int main() +{ + st s; + + s.a = s.b = s.c = 216; + stupid_func(s); + + return 0; +} + +void testme(int a, int b, int c) +{ + if (a != 216 || b != 216 || c != 216) + abort(); +}
addrof1.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: inline16.C =================================================================== --- inline16.C (nonexistent) +++ inline16.C (revision 338) @@ -0,0 +1,24 @@ +// { dg-do assemble } +// { dg-options "-O1" } +// Origin: Jakub Jelinek + +struct foo { + bool x; + inline void a (unsigned char y); + inline void b (void); + virtual ~foo (); +}; + +foo::~foo () +{ +} + +void foo::a (unsigned char y) +{ + x = ((y & 2) != 0); +} + +void foo::b (void) +{ + a(0x07); +}
inline16.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: init8.C =================================================================== --- init8.C (nonexistent) +++ init8.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do assemble } + +// submitted by David C Binderman + +// According to [dcl.init]/9, this should be ill-formed + +void +f() +{ + const int var [ 10 ]; // { dg-error "" } missing initializer +}
init8.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,22 @@ +// { dg-do run } +// Origin: Mark Mitchell + +int i; + +struct B { + B () {} + B (B&) { i = 1; } + B (const B&) { i = 2; } +}; + +struct D : public B { + D () {} +}; + +int main () +{ + D d; + D d2 (d); + if (i != 2) + return 1; +}
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,52 @@ +// { dg-do run } +// Test that various calls to non-functions work. + +void f () { } + +typedef void (*fptr)(); +typedef void (&fref)(); +fptr p = f; +fref r = f; +const fptr &pr = p; + +struct A { + fptr p; + + A (fptr n): p(n) { } + operator fptr () { return p; } +}; + +struct B { + fref r; + + B (fptr n): r(*n) { } + operator const fref () { return r; } +}; + +struct C { + const fptr pr; + + C (fptr n): pr(n) { } + operator const fptr& () { return pr; } +}; + +int main () +{ + f(); + + p(); + r(); + pr(); + + A a (f); + a(); + a.p(); + + B b (f); + b(); + b.r(); + + C c (f); + c(); + c.pr(); +}
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: decl6.C =================================================================== --- decl6.C (nonexistent) +++ decl6.C (revision 338) @@ -0,0 +1,26 @@ +// { dg-do assemble } +// +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 27 Sep 1999 + +int j(); +struct B {}; +struct A +{ + friend explicit int j(); // { dg-error "" } only ctor decls can be explicit + friend explicit B::B (); // { dg-error "" } only ctor decls can be explicit + int f(const); // { dg-error "" } ansi forbids no type + const k; // { dg-error "" } ansi forbids no type + mutable friend int j1 (); // { dg-error "" } non-member cannot be mutable + mutable typedef int d; // { dg-error "" } non-object cannot be mutable + mutable int fn (); // { dg-error "" } non-object cannot be mutable + void fn (mutable int); // { dg-error "" } non-member cannot be mutable + mutable static int s; // { dg-error "" } static cannot be mutable + mutable const int s1; // { dg-error "" } const cannot be mutable + mutable const int *s2; // ok + mutable int *const s3; // { dg-error "" } const cannot be mutable + explicit A (); // ok +}; +mutable int g; // { dg-error "" } non-member cannot be mutable +explicit A::A () {} // { dg-error "" } only ctor decls can be explicit +
decl6.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: init14.C =================================================================== --- init14.C (nonexistent) +++ init14.C (revision 338) @@ -0,0 +1,22 @@ +// { dg-do assemble } +// Origin: bkoz@nabi.net + +typedef struct +{ + int count; +} mbstate_t; + +struct fpos +{ + mbstate_t _M_st; + fpos(int __pos) + : _M_st() { + } +}; + +int main () +{ + fpos f (2); +} + +
init14.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: warn01.C =================================================================== --- warn01.C (nonexistent) +++ warn01.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// { dg-options "-W -Wall" } + +typedef unsigned long size_t; +extern void* malloc (size_t); +extern void free (void*); +extern void* realloc (void*, size_t); + +struct vtable { + void* (* _malloc) (size_t); + void (* _free) (void*); + void* (* _realloc) (void*, size_t); +}; + +struct vtable mtable = { malloc, free }; // { dg-warning "" } _realloc
warn01.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: cond6.C =================================================================== --- cond6.C (nonexistent) +++ cond6.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Test that the result of `x ? const E : E' is an E rvalue. +// Contributed by Jason Merrill + +enum E { a }; + +bool b; + +int main () +{ + E e1 = a; + const E &er = e1; + E e2 = b ? er : a; // OK + const E* ep = &(b ? er : a); // { dg-error "" } non-lvalue +}
cond6.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: using5.C =================================================================== --- using5.C (nonexistent) +++ using5.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } + +// Based on bug report by Klaus-Georg Adams +// + +struct bar { + typedef bar t; +}; + +struct foo : bar { + using bar::t; + t field; + t meth(); + void baz(t arg); +};
using5.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: dll-2.C =================================================================== --- dll-2.C (nonexistent) +++ dll-2.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble { target arm-*-*pe } } +// Microsoft's MSVC 2.0 allows dllimport followed by dllexport for variables, +// but does not allow dllexport followed by dllimport. +// +// Switching between dll{export,import} works for functions. +// We test for that too (by ensuring no error is produced). + +__declspec (dllimport) int foo1 (); +__declspec (dllexport) int foo1 (); + +__declspec (dllexport) int foo2 (); +__declspec (dllimport) int foo2 (); + +__declspec (dllimport) int bar1; +__declspec (dllexport) int bar1; + +__declspec (dllexport) int bar2; // { dg-error "" } previously declared +__declspec (dllimport) int bar2; // { dg-error "" } redefinition
dll-2.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: eh4.C =================================================================== --- eh4.C (nonexistent) +++ eh4.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Origin: Jean-Marc Bourguet + +class foo { +public: + foo() {} + void throwMe () { + throw *this; // { dg-error "" } cannot be used in throw-expression + } + virtual void test () = 0; +}; +
eh4.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: cast7.C =================================================================== --- cast7.C (nonexistent) +++ cast7.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do run } +// Test that we can add cv-quals in a static cast to a pointer-to-base type. + +struct A { int i; }; +struct B : public A {}; + +int main() +{ + int B::* bp = &B::i; + const int A::* ap = static_cast(bp); + return ap != bp; +}
cast7.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: vbase2.C =================================================================== --- vbase2.C (nonexistent) +++ vbase2.C (revision 338) @@ -0,0 +1,37 @@ +// { dg-do run } +// Origin: Mark Mitchell + +int i; + +struct A +{ + ~A (); +}; + +A::~A () { + i = 1; +} + +struct B : virtual public A { +}; + +struct C { + C (); + + B b; +}; + +C::C () { + throw 3; +} + +int main () +{ + try { + C c; + } catch (...) { + } + + if (i != 1) + return 1; +}
vbase2.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: vaarg4.C =================================================================== --- vaarg4.C (nonexistent) +++ vaarg4.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do assemble } +// { dg-options "-Wno-abi" { target arm_eabi } } + +// Bug 845. We were treating __builtin_va_arg as a unary expr, not a primary, +// and hence getting parse errors. + +typedef __builtin_va_list __gnuc_va_list; +typedef __gnuc_va_list va_list; + +struct X { int y; }; + +void func(va_list va) +{ + char* a = __builtin_va_arg(va, char**)[0]; + int b = __builtin_va_arg(va, X*)->y; +}
vaarg4.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: optimize4.C =================================================================== --- optimize4.C (nonexistent) +++ optimize4.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do assemble } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 24 Jul 2001 + +// Bug 3543. We forgot to resolve an OFFSET_REF + + +struct Writeable { + bool blocking_mode; +}; + + +struct Pipe : Writeable { + void ewrite(); + + void set_write_blocking () + { + if (Writeable::blocking_mode); + } +}; + +void Pipe::ewrite() +{ + set_write_blocking(); +} + +void ewrite(Pipe &p) +{ + p.set_write_blocking(); +}
optimize4.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,13 @@ +// { dg-do assemble } + +struct foo { + operator char*() const; +}; + +void bar(foo a) { + delete a; // should be accepted + delete[] a; // should be accepted + char b[1]; + delete b; // { dg-warning "deleting array" } expecting pointer type + delete[] b; // { dg-warning "deleting array" } expecting pointer type +}
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: bitfld3.C =================================================================== --- bitfld3.C (nonexistent) +++ bitfld3.C (revision 338) @@ -0,0 +1,34 @@ +// { dg-do assemble } + +// Copyright (C) 1999, 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 Jun 1999 +// Derived from a bug report from Stephan Riess +// http://gcc.gnu.org/ml/gcc-bugs/1999-06n/msg00107.html + +// Builtin ops don't always need reference bindings, and we weren't removing +// them always after doing overload resolution. This caused us to try and take +// the address of a bitfield. + +enum E {one}; +struct A { + E m1: 8; + E m2: 8; + unsigned m3 : 8; + unsigned m4 : 8; +}; + +int fn (int f) +{ + A a; + E m1, m2; + E e; + int i; + + e = f ? m1 : m2; + e = f ? a.m1 : a.m2; + i = f ? a.m3 : a.m4; + (f ? m1 : m2) = e; + (f ? a.m1 : a.m2) = e; + (f ? a.m3 : a.m4) = i; + return 0; +}
bitfld3.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: comdat2.C =================================================================== --- comdat2.C (nonexistent) +++ comdat2.C (revision 338) @@ -0,0 +1,30 @@ +// { dg-do run } +// { dg-additional-sources " comdat2-aux.cc" } +// { dg-options "-O" } +// Test that statics in inline functions are unified between +// translation units. Currently we handle this by just suppressing +// inling and relying on unification of the function itself. + +template +struct S { + static int f () + { + static int i; + return ++i; + } + S () {}; + ~S () {}; +}; + +typedef S a; + +int g (); + +int main () +{ + if (a::f() != 1 + || g() != 2 + || a::f() != 3) + return 1; + return 0; +}
comdat2.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: friend3.C =================================================================== --- friend3.C (nonexistent) +++ friend3.C (revision 338) @@ -0,0 +1,23 @@ +// { dg-do assemble } + +class foo { +public: + class bar; + void func(bar *); + class bar { + int st; + friend void foo::func(bar *); + }; +}; + + +void foo::func(bar *obj) { + obj->st++; +} + +void test02() { + foo obj_f; + foo::bar obj_b; + + obj_f.func( &obj_b); +}
friend3.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: base1.C =================================================================== --- base1.C (nonexistent) +++ base1.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 25 Nov 2000 + +// We lost information about which base wasn't an aggregate type, plus we +// allowed cv qualifed bases via typedefs. + +typedef int I; +typedef int cI; + +struct A {}; + +typedef const A cA; +typedef A pA; + +struct B : I {}; // { dg-error "" } not an aggregate +struct C : cI {}; // { dg-error "" } not an aggregate +struct D : cA {}; // { dg-error "" } cv qualified +struct E : pA {};
base1.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: ptrmem9.C =================================================================== --- ptrmem9.C (nonexistent) +++ ptrmem9.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do run } +// Test that const-correctness is observed when using pointers-to-members. + +struct A { + int f () { return 1; } + int f () const { return 0; } +}; + +struct B { + A a; + B() { } +}; + +int main () +{ + A B::*bm = &B::a; + const B b; + return (b.*bm).f (); +}
ptrmem9.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: lookup4.C =================================================================== --- lookup4.C (nonexistent) +++ lookup4.C (revision 338) @@ -0,0 +1,22 @@ +// { dg-do run } +// Test for proper handling of references to overloaded member functions. + +struct A { + static void f (int) { } + void f (); +}; + +void (*p)(int) = &A::f; + +void A::f () +{ + p = f; +} + +int main() +{ + A a; + p = &a.f; + (a.f)(); + (a.f)(42); +}
lookup4.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: warn6.C =================================================================== --- warn6.C (nonexistent) +++ warn6.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// { dg-options "-W -Wall" } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 2 Mar 2001 + +// Bug 2139. We gave an erronous warning about an unused parm on a +// synthesized function + +struct A +{ + virtual ~A (); +}; +void foo (A const &a) +{ + A a1 = a; +}
warn6.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: static6.C =================================================================== --- static6.C (nonexistent) +++ static6.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// Origin: Jason Merrill + +void f (int i) +{ + static int a[] = { i }; +}
static6.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: local3.C =================================================================== --- local3.C (nonexistent) +++ local3.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do run } +// Bug: g++ lies about DECL_CONTEXT, so the backend thinks B::f is not +// function-local. +// Contributed by Jason Merrill + +struct A { + virtual void f () = 0; +}; + +int main() +{ + struct B : public A { + void f () { } + }; + + B b; +}
local3.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: virtual7.C =================================================================== --- virtual7.C (nonexistent) +++ virtual7.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// { dg-options "-fno-rtti" } +// Origin: Anthony Green + +class _JvObjectPrefix +{ +protected: + virtual void finalize (void) = 0; +}; + +class Object : public _JvObjectPrefix +{ +protected: + virtual void finalize (void); +}; + +Object x;
virtual7.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: inline17.C =================================================================== --- inline17.C (nonexistent) +++ inline17.C (revision 338) @@ -0,0 +1,22 @@ +// { dg-do assemble } +// { dg-options "-O3" } +// Origin: Jakub Jelinek + +struct foo +{ + char a; + foo (); + void bar (); + void baz (char c); +}; + +void foo::baz (char c) +{ + if (c != a) + a = c; +} + +void foo::bar () +{ + baz (1); +}
inline17.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: init9.C =================================================================== --- init9.C (nonexistent) +++ init9.C (revision 338) @@ -0,0 +1,40 @@ +// { dg-do assemble } + +// Based on a testcase submitted by Tudor Hulubei + +// X is not a POD because it has a user-defined destructor. +// Therefore, we can't cross its initialization. + +// vector is not even an aggregate; nevertheless, no error is +// reported... + +struct A { + A() {} +}; + +void a() { + goto bar; // { dg-error "" } jump from here + A x; // { dg-error "" } jump crosses initialization + bar: // { dg-error "" } jump to here + ; +} + +struct X { + ~X() {} +}; + +void b() { + goto bar; // { dg-error "" } jump from here + X x; // { dg-error "" } jump crosses initialization + bar: // { dg-error "" } jump to here + ; +} + +#include + +void c() { + goto bar; // { dg-error "" } jump from here + std::vector x; // { dg-error "" } jump crosses initialization + bar: // { dg-error "" } jump to here + ; +}
init9.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,23 @@ +// { dg-do link } +// Origin: ericp@mit.edu + +class bar { +}; + +class foo { + foo (const foo &f); + +public: + + foo (bar x) {} + foo () {} + + void test (const foo &f) {} +}; + +int main (void) { + foo f; + bar b; + + f.test (b); +}
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: decl7.C =================================================================== --- decl7.C (nonexistent) +++ decl7.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct S +{ + void* sp; +}; + +void* f () +{ + struct S s = { &s.sp }; + return s.sp; +}
decl7.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,20 @@ +// { dg-do assemble } +// { dg-options "-O2 -Winline" } +// Origin: Martin Reinecke + +class foo +{ + public: + float x; + + foo (float xval) + : x (xval) {} + + foo operator+ (const foo &foo2) const + { return foo (x+foo2.x); } +}; + +int main() +{ + foo f=foo(1)+foo(2); +}
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: expr1.C =================================================================== --- expr1.C (nonexistent) +++ expr1.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do assemble } + +// Simplified from bug report by Trevor Taylor + +struct T { + int operator()(int) { } // { dg-message "candidate is" } +}; + +int main() { + T()(); // { dg-error "match" } no such operator +}
expr1.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,43 @@ +// { dg-do assemble } + +int i; +int j; + +struct S { + int operator()(int) + { + i = 1; + return i; + } + + typedef int I; + + void f() { + for (S I; false; ) + ; + int k = I(3); + } +}; + +typedef int J; + +struct T { + int operator()(int) + { + j = 1; + return j; + } + + void f() { + for (T J; false; ) + ; + int k = J(3); + } +}; + +int main() +{ + S s; + s.f(); + return 2 * i + j; +}
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: init15.C =================================================================== --- init15.C (nonexistent) +++ init15.C (revision 338) @@ -0,0 +1,22 @@ +// { dg-do assemble } +// Copyright (C) 2000 Free Software Foundation +// Contributed by Nathan Sidwell 21 June 2000 + +// Origin GNATS bug report 136 from +// language specific constants caused the backend's constant caching machinery +// to fall over. + +struct A { + const char *name; + int reserved; + int a; + int b; + void (A::*func)(); + void Fn (); +}; + +void Interpret() { + struct A cmd_list = + {"a",0,0, 0,&A::Fn} + ; +}
init15.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: cond7.C =================================================================== --- cond7.C (nonexistent) +++ cond7.C (revision 338) @@ -0,0 +1,26 @@ +// { dg-do assemble } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 24 Jul 2001 + +// Bug 3416. We left some unchecked overloaded functions lying around. + +struct X +{ + void operator << (int); + void operator << (float); +}; + +void OVL1 (int); +void OVL1 (float); + +void OVL2 (int); +void OVL2 (float); + +X x; + +void foo (bool a) +{ + x << (a ? OVL1 : OVL2); // { dg-error "" } incomplete type + a ? OVL1 : OVL2; // { dg-error "" } incomplete type +}
cond7.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: using6.C =================================================================== --- using6.C (nonexistent) +++ using6.C (revision 338) @@ -0,0 +1,30 @@ +// { dg-do run } +// Test of class-scope using-declaration for functions. + +#define assert(COND) if (!(COND)) return 1 + +struct A { + int f(int) { return 1; } + int f(char) { return 2; } +}; + +struct B { + int f(double) { return 3; } +}; + +struct C : public A, public B { + using A::f; + using B::f; + int f(char) { return 4; } + int f(C) { return 5; } +}; + +int main () +{ + C c; + + assert (c.f(1) == 1); + assert (c.f('a') == 4); + assert (c.f(2.0) == 3); + assert (c.f(c) == 5); +}
using6.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: dll-3.C =================================================================== --- dll-3.C (nonexistent) +++ dll-3.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do assemble { target arm-*-*pe } } +// { dg-options "-mno-nop-fun-dllimport" } +// set compiler_result "__imp_f1.*\.section${spaces}.drectve\n\[^\n\]*-export:f2" +// set not_compiler_result "__imp_f2" + +class aClass +{ +public: + __declspec(dllimport) int f1(); + __declspec(dllexport) int f2(); +}; + +__declspec(dllexport) int aClass::f2() +{ + return f1(); +}
dll-3.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: eh5.C =================================================================== --- eh5.C (nonexistent) +++ eh5.C (revision 338) @@ -0,0 +1,34 @@ +// { dg-do assemble } +// { dg-options "-O2" } + +struct X {}; + +struct Y +{ + Y(); + virtual ~Y(); +}; + +struct Z +{ + int f (const int *x); + int g; +}; + +inline int +operator<< (Z &os, int x) +{ + os.f (&x); + return os.g; +} + +void foo (Z &a, X *b, X &c) +{ + X *d = b; + int e = 0; + Z &f = a; + if (!(f << e)) + do { do { } while (&c == 0); throw Y(); } while (0); + do { } while (&d == 0); + do { } while (&c == 0); +}
eh5.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: crash1.C =================================================================== --- crash1.C (nonexistent) +++ crash1.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } +class A +{ + enum B { ONE, TWO, THREE }; // { dg-error "" } private +}; + +class A::B; // { dg-error "" } A::B is not a class type, context
crash1.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: vbase3.C =================================================================== --- vbase3.C (nonexistent) +++ vbase3.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// Origin: scott snyder + +class d0_Collection_Base {}; + +template +class d0_List + : virtual public d0_Collection_Base +{ +public: + d0_List (); + + template + d0_List (Input_Iterator first, Input_Iterator last) + ; +}; + +void tlist () +{ + const d0_List l4 (1, 2); +}
vbase3.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: delete3.C =================================================================== --- delete3.C (nonexistent) +++ delete3.C (revision 338) @@ -0,0 +1,39 @@ +// { dg-do run } +#include + +int i; + +extern "C" int printf (const char *, ...); + +template +struct map { + ~map (); +}; + +template +map::~map () +{} + +struct SomeClass { }; + +void* operator new(size_t numBytes, SomeClass&, const std::nothrow_t&) throw() +{ + return operator new(numBytes, std::nothrow); +} + +void operator delete(void* pMemory, SomeClass&, const std::nothrow_t&) throw() +{ + i = 7; + return operator delete(pMemory); +} + +int +main() +{ + map< int, int>* pMap = new map< int, int>; + + delete pMap; + + if (i == 7) + return 1; +}
delete3.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: mangle2.C =================================================================== --- mangle2.C (nonexistent) +++ mangle2.C (revision 338) @@ -0,0 +1,24 @@ +// { dg-do assemble } +// Test for overloaded operators in "C" linkage + +extern "C" { +typedef struct b +{ + int a; +} c; + +extern const c z; + +inline bool operator!=(const c& x, const c& y) +{ + return x.a != y.a; +} +} + +void foo(); + +void bar(c x) +{ + if (x != z) + foo(); +}
mangle2.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: comdat2-aux.cc =================================================================== --- comdat2-aux.cc (nonexistent) +++ comdat2-aux.cc (revision 338) @@ -0,0 +1,17 @@ +template +struct S { + static int f () + { + static int i; + return ++i; + } + S () {}; + ~S () {}; +}; + +typedef S a; + +int g () +{ + return a::f(); +} Index: bitfld4.C =================================================================== --- bitfld4.C (nonexistent) +++ bitfld4.C (revision 338) @@ -0,0 +1,25 @@ +// { dg-do assemble } +// Origin: "Chen, Wen-Ke" + +template +bool operator!=(const T&, const T&); + +enum MsgType { + MSG_DATA +}; + +class C { +public: + MsgType mType : 8; +}; + +int main(void) +{ + extern C& c; + + c.mType = MSG_DATA; + if (c.mType != MSG_DATA) + return -1; + + return 0; +}
bitfld4.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: builtins10.C =================================================================== --- builtins10.C (nonexistent) +++ builtins10.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// Test that built-in functions don't warn when prototyped without arguments. +// Origin: PR c++/9367 +// Copyright (C) 2003 Free Software Foundation. + +extern "C" int snprintf(); +
builtins10.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: comdat3.C =================================================================== --- comdat3.C (nonexistent) +++ comdat3.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do run } +// { dg-additional-sources " comdat3-aux.cc" } +// Test that duplicate elimination of implicit instantiations of static +// data members works properly. + +// Additional files: comdat3.h + +#include "comdat3.h" + +int main () +{ + const bool *p = &A::b; + f (); +}
comdat3.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: friend4.C =================================================================== --- friend4.C (nonexistent) +++ friend4.C (revision 338) @@ -0,0 +1,23 @@ +// { dg-do assemble } + +// by Alexandre Oliva + +// I'm not 100% sure this program is correct, but g++ shouldn't just +// crash. + +// The idea is to give privileged access to bar only to +// specializations foo, for all B. + +template void foo(); +template class bar { + int i; // { dg-error "" } private + template friend void foo(); // { dg-error "" } bogus declaration +}; +template void foo() { + bar baz; baz.i = 1; // { dg-error "" } foo cannot access bar::i + bar buz; buz.i = 1; // { dg-error "" } foo cannot access bar::i +} +int main() { + foo(); + foo(); +}
friend4.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: warn7.C =================================================================== --- warn7.C (nonexistent) +++ warn7.C (revision 338) @@ -0,0 +1,45 @@ +// { dg-do assemble } +// { dg-options "-W -Wall" } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 26 April 2001 + +// Bug 2356. Unused parameter information introduced in a ctor +// definition was not propagated to clones, leading to missed or +// unwarranted unused parameter warnings, possibly given twice. + +struct X +{ + X(int i); + void foo (int i); + +}; +void foo (int i); + +X::X(int) +{ +} +void X::foo (int) +{ +} +void foo (int) +{ +} + +struct Y +{ + Y(int); + void bar (int); + +}; +void bar (int); + +Y::Y(int i) // { dg-warning "unused parameter" } +{ +} +void Y::bar (int i) // { dg-warning "unused parameter" } +{ +} +void bar (int i) // { dg-warning "unused parameter" } +{ +}
warn7.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: lookup5.C =================================================================== --- lookup5.C (nonexistent) +++ lookup5.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Simplified from bug report by Paris Smaragdis + + +template class vector {}; +class foo {}; +int main() { + foo f; + f.vector(); // { dg-error "" } not a method +}
lookup5.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: return1.C =================================================================== --- return1.C (nonexistent) +++ return1.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// Special g++ Option: +// Origin: holmen@mail.nu + +struct C { + int f() {return 0;} +}; + +struct D { + C a[1]; + C* g(); +}; + +C* D::g() { + int i = 0; + while (i < 1 && a[i].f() != 1) {} + return undefined_variable; // { dg-error "" } +}
return1.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: virtual8.C =================================================================== --- virtual8.C (nonexistent) +++ virtual8.C (revision 338) @@ -0,0 +1,32 @@ +// { dg-do run } +extern "C" int printf (const char*, ...); + +struct A +{ + virtual void f () { + printf ("%x\n", this); + } +}; + +struct B : public A +{ +}; + +struct C : public A +{ +}; + +struct D : virtual public B, public C +{ +}; + +int main () +{ + D d; + + A* a1 = (A*) (B*) &d; + A* a2 = (A*) (C*) &d; + + a1->f (); + a2->f (); +}
virtual8.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: local4.C =================================================================== --- local4.C (nonexistent) +++ local4.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do run } +// Test that a local declaration of one of a global overload set works + +int f () { return 0; } +int f (int); + +int main () +{ + int f (); + return f (); +}
local4.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: static7.C =================================================================== --- static7.C (nonexistent) +++ static7.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do run } +// Origin: Jason Merrill + +int j = 42; + +int main () +{ + static int i = j; + return (i != 42); +}
static7.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: typedef1.C =================================================================== --- typedef1.C (nonexistent) +++ typedef1.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } + +typedef const struct { + int x; +} Test; + +static void foo(Test); + +static void foo(Test t) +{ + t.x = 0; // { dg-error "" } assignment of read-only member + return; +}
typedef1.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: sc1.C =================================================================== --- sc1.C (nonexistent) +++ sc1.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +void f() { + int *i = 0; + const int *c = 0; + + static_cast (i); + static_cast (c); // { dg-error "" } casts away constness +}
sc1.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: inline18.C =================================================================== --- inline18.C (nonexistent) +++ inline18.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// { dg-options "-O3" } +// Origin: Jakub Jelinek + +static void foo (int a) +{ + a = a; +} + +static void bar (void) +{ + foo (-1); +}
inline18.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,18 @@ +// { dg-do run } +// Test for use of typedef in explicit destructor call. + +#include + +struct X { + typedef X foo; +}; + +X x; +unsigned char bar[sizeof (X)]; + +int +main () +{ + X* p = new (bar) X; + p->~foo(); +}
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: new.C =================================================================== --- new.C (nonexistent) +++ new.C (revision 338) @@ -0,0 +1,60 @@ +// { dg-do assemble } + +#include + +inline void * +operator new(size_t alloc_sz, const char *fname, unsigned lineno) +{ + return ::operator new (alloc_sz); +} +inline void * +operator new[](size_t alloc_sz, const char *fname, unsigned lineno) +{ + return ::operator new[] (alloc_sz); +} +inline void +operator delete(void *ptr, const char *fname, unsigned lineno) +{ +} +inline void +operator delete[](void *ptr, const char *fname, unsigned lineno) +{ +} + +class DEF { +public: + DEF( DEF *parent=0, const char *name=0 ); +}; + +class ABC +{ +public: + enum stuff { ID0, ID1 }; + ABC( stuff, DEF *parent=0, const char *name=0 ); +}; + +class GHI : public DEF +{ +}; + +class LMNFrame; +class LMN : public DEF +{ + friend class LMNFrame; + public: +public: + LMN(); +private: + LMNFrame *draw_area; + + ABC *scroll_h; +}; +class LMNFrame : public GHI { +}; +LMN::LMN() +{ + draw_area = new ("abc", 69) LMNFrame; + + scroll_h = new ("def", 71) ABC(ABC::ID0, this); +} +
new.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: parse1.C =================================================================== --- parse1.C (nonexistent) +++ parse1.C (revision 338) @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Test that we save declspecs before a class defn properly. + +static volatile union { + void f() { } +} u;
parse1.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: syshdr1.C =================================================================== --- syshdr1.C (nonexistent) +++ syshdr1.C (revision 338) @@ -0,0 +1,8 @@ +// { dg-do assemble } +// { dg-options "" } +// Origin: Mark Mitchell + +# 1 "foo" 3 +void f () {} +extern "C" void foo(int); +extern "C" void foo(int) throw();
syshdr1.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: decl8.C =================================================================== --- decl8.C (nonexistent) +++ decl8.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Origin: Sergei Organov + +void foo(void) +{ + extern int i; // { dg-error "" } previous declaration + extern double i; // { dg-error "" } conflicting type + extern int j; + extern int j; +}
decl8.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: comdat3.h =================================================================== --- comdat3.h (nonexistent) +++ comdat3.h (revision 338) @@ -0,0 +1,8 @@ +template struct A { + static const bool b = false; +}; + +template +const bool A::b; + +void f ();
comdat3.h 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: inline2.C =================================================================== --- inline2.C (nonexistent) +++ inline2.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do assemble } +// { dg-options "-O2 -Winline" } +// Origin: Martin Reinecke + +#include + +int main() +{ + double foo = 4.5; + if (std::abs (0.5-std::abs (foo-0.5)) < 1e-10) foo+=1; +}
inline2.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,14 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 24 Jul 2000 + +// Bug 306 +// binding a reference in for scope creates nameless objects. Make sure +// we don't try and inject them into scope, for ARM compatibility. + +void foo () +{ + for (const int &thing = 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: defarg1.C =================================================================== --- defarg1.C (nonexistent) +++ defarg1.C (revision 338) @@ -0,0 +1,28 @@ +// { dg-do assemble } + +int f (int x) +{ + extern void g (int i = f (x)); // { dg-error "" } default argument uses local + + g(); + + return 0; +} + +int f (void); + +int h1 (int (*)(int) = f); +int h2 (int (*)(double) = f); // { dg-error "" } no matching f + +template +int j (T t) +{ + extern void k (int i = j (t)); // { dg-error "" } default argument uses local + + k (); + + return 0; +} + +template int j (double); +
defarg1.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: init16.C =================================================================== --- init16.C (nonexistent) +++ init16.C (revision 338) @@ -0,0 +1,29 @@ +// { dg-do run } +// Origin: Jakub Jelinek + +struct bar { + char c; + bar (const char *); + bar (const bar &); +}; + +struct foo { + bar x; +}; + +extern const struct foo y = { "foo" }; + +bar::bar (const bar &ref) +{ + c = ref.c; +} + +bar::bar (const char *p) +{ + c = p[2]; +} + +int main () +{ + return y.x.c != 'o'; +}
init16.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: dll-4.C =================================================================== --- dll-4.C (nonexistent) +++ dll-4.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble { target arm-*-*pe } } +// Ensure dllexport overrides dllimport. +// set compiler_result "\.section${spaces}\.drectve\n\[^\n\]*-export:foo1.*\.section${spaces}\.drectve\n\[^\n\]*-export:foo2" +// set not_compiler_result "(__imp_foo1|__imp_foo2)" + +__declspec (dllimport) int foo1 (); +__declspec (dllexport) int foo1 (); + +__declspec (dllexport) int foo2 (); +__declspec (dllimport) int foo2 (); + +__declspec (dllexport) int foo1 () { return foo2 (); } +__declspec (dllexport) int foo2 () { return foo1 (); }
dll-4.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: using7.C =================================================================== --- using7.C (nonexistent) +++ using7.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } + +class A { +protected: + static void f() {} +}; + +class B : A { +public: + using A::f; + void g() { + f(); + A::f(); + } + struct C { + void g() { + f(); + A::f(); + } + }; +};
using7.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: crash2.C =================================================================== --- crash2.C (nonexistent) +++ crash2.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do assemble } + +struct A { + int rep; + static const A a(0); // { dg-error "" } initialization + static const A b = 3; // { dg-error "" } initialization + static const A& c = 2; // { dg-error "" } initialization + A(int x) : rep(x) {} +};
crash2.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: vbase4.C =================================================================== --- vbase4.C (nonexistent) +++ vbase4.C (revision 338) @@ -0,0 +1,27 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 10 Jan 2001 +// Origin snyder@fnal.gov + +// Bug 933. Secondary vtables weren't correctly located for non-primary +// virtual bases. Causing us to ICE. + +class d0_Object +{ +public: +virtual ~d0_Object (); +}; + + +class M10 : virtual public d0_Object {}; +class M4 : virtual public M10 {}; + +class M9 +: public M4, virtual public M10 +{ +public: +M9 (); +}; + +M9::M9 () {}
vbase4.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: delete4.C =================================================================== --- delete4.C (nonexistent) +++ delete4.C (revision 338) @@ -0,0 +1,53 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 15 Apr 1999 + +// delete (void *)e and delete[] (void *)e result in undefined behavior +// [expr.delete/3]. Check we warn about them +// operator new functions can only return NULL, if their exceptions +// specification is `throw()'. All other cases must return a non-null pointer +// [expr.new/13]. + +typedef __SIZE_TYPE__ size_t; + +void *operator new(size_t) +{ + return 0; // { dg-warning "NULL" } cannot return NULL +} +void *operator new[](size_t) +{ + return 0; // { dg-warning "NULL" } cannot return NULL +} + +struct X +{ + void *operator new(size_t) + { + return 0; // { dg-warning "NULL" } cannot return NULL + } + void *operator new[](size_t) + { + return 0; // { dg-warning "NULL" } cannot return NULL + } +}; + +struct Y +{ + void *operator new(size_t) throw() + { + return 0; // ok + } + void *operator new[](size_t) throw() + { + return 0; // ok + } +}; + +void fn(double *d, void *v) +{ + delete d; // ok + delete v; // { dg-warning "" } deleting void + delete[] d; // ok + delete[] v; // { dg-warning "" } deleting void +}
delete4.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: mangle3.C =================================================================== --- mangle3.C (nonexistent) +++ mangle3.C (revision 338) @@ -0,0 +1,42 @@ +// { dg-do run } +struct foo { + static int bar () + { + int i; + static int baz = 1; + { + static int baz = 2; + i = baz++; + } + { + struct baz { + static int m () + { + static int n; + return n += 10; + } + }; + baz a; + i += a.m (); + } + { + static int baz = 3; + i += baz; + baz += 30; + } + i += baz; + baz += 60; + return i; + } +}; + +int main () +{ + foo x; + + if (x.bar () != 16) + return 1; + if (x.bar() != 117) + return 1; + return 0; +}
mangle3.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: bitfld5.C =================================================================== --- bitfld5.C (nonexistent) +++ bitfld5.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// { dg-options "-w" } + +struct S +{ + int i : 1756; +};
bitfld5.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: comdat4.C =================================================================== --- comdat4.C (nonexistent) +++ comdat4.C (revision 338) @@ -0,0 +1,57 @@ +// PR c++/16276 +// { dg-do link } +// { dg-additional-sources " comdat4-aux.cc" } +// { dg-options "-O2" } + +extern void +bar (int x); + +inline void +foo (int i) +{ + switch (i) + { + case 3: + case 5: + case 6: + case 9: + case 15: + bar (1); + break; + case 2: + case 4: + case 7: + case 10: + case 11: + case 12: + bar (2); + break; + case 0: + case 1: + case 8: + case 13: + case 16: + bar (3); + break; + case 14: + bar (4); + break; + default: + bar (5); + break; + } +} + +void *fooaddr = (void *) foo; + +void +bar (int x) +{ + __asm __volatile ("" : : "r" (x)); +} + +int +main (void) +{ + return 0; +}
comdat4.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: friend5.C =================================================================== --- friend5.C (nonexistent) +++ friend5.C (revision 338) @@ -0,0 +1,6 @@ +// { dg-do assemble } +// submitted by David C Binderman + +struct A { + friend bool(); // { dg-error "" } invalid declaration +};
friend5.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: lookup6.C =================================================================== --- lookup6.C (nonexistent) +++ lookup6.C (revision 338) @@ -0,0 +1,26 @@ +// { dg-do run } +int f(int i) +{ + struct C { + int i; + C () : i(1) {} + int f() { + struct D { + int i; + D () : i(2) {} + int g() { return i; } + } d; + + return d.g(); + } + } c; + + return c.f(); +} + + +int main() +{ + if (f(0) != 2) + return 1; +}
lookup6.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: nested1.C =================================================================== --- nested1.C (nonexistent) +++ nested1.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do assemble } + +struct C +{ + struct D + { + }; +}; + +struct E +{ + C& c; + void g(); +}; + +void E::g() +{ + c.D().f(); // { dg-error "" } no matching function +}
nested1.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: debug1.C =================================================================== --- debug1.C (nonexistent) +++ debug1.C (revision 338) @@ -0,0 +1,48 @@ +// { dg-do assemble } +// { dg-options "-g" } + +typedef unsigned int size_t; + + +struct dummy { }; + +struct arrrrrgh { }; + + +template +struct whyyyyyyy { }; + + + + +template +struct grrrrrrrr { }; + + +template +class no_future +{ +public: + + + template + no_future(const grrrrrrrr*,S>& man ) { } + + ~no_future( ) { } + +private: + + + no_future(const no_future&); + no_future& operator=(const no_future&); +}; + + +int main( ) +{ + grrrrrrrr*> man; + + no_future here(man); + + return 0; +}
debug1.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,6 @@ +// { dg-do assemble } + +template class A { + T *d; + public: void f() { (T[10])d; } +};
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: rttid2.C =================================================================== --- rttid2.C (nonexistent) +++ rttid2.C (revision 338) @@ -0,0 +1,101 @@ +// { dg-do run } +// { dg-options "-frtti" } +// test of rtti of single inheritance and multiple inheritance classes +// dynamic casting + +#include + +extern "C" { + int printf(const char *, ...); + void exit(int); +} + +class X { + public: + int xi; +}; + +class Y : public X { + short ys; +}; + +class Z : public Y { + int zi; +}; + +Z z; +Y y; +Y *yp = &z; +X *xp = &z; +Z *zp = &z; + +class A { + public: + int Ai; +}; + +class B { + public: + int Bi; +}; + +class D : public A, public B { + int Di; +}; + +/* +class E : public D, public B { + int Ei; +}; +*/ +class E { + int Ei; +}; + +class F : public E, public D { + int Fi; +}; + +D d; +A *ap = &d; +B *bp = &d; +F f; +F *fp = &f; +A *aap = &f; +D *dp = &f; +B *bbp = dp; + +void *vp = zp; + +/* +void error (int i) +{ + printf("FAIL\n"); + exit(i); +} +*/ + +void error (int i) +{ + exit(i); +} + +int main () +{ + + vp = (void *)0; + + vp = dynamic_cast (&z); + if (vp == 0) error(11); + + vp = dynamic_cast (yp); + if (vp == 0) error(12); + + vp = dynamic_cast (dp); + if (vp != (void *)dp) error(21); + + vp = dynamic_cast (fp); + if (vp != (void *)bbp) error(22); + +} +
rttid2.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: signed.C =================================================================== --- signed.C (nonexistent) +++ signed.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 24 Mar 1999 + +// Determine that function style casts are groked + +void fn() +{ + +char(5); + +short(5); + +int(5); + +long(5); + +signed(5); + +unsigned(5); +}
signed.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: cvqual1.C =================================================================== --- cvqual1.C (nonexistent) +++ cvqual1.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +int i = 3; +void *pv=&i; +const void* pcv=&i; +int main() +{ + pcv = 0 ? pv : pcv; +}
cvqual1.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: virtual9.C =================================================================== --- virtual9.C (nonexistent) +++ virtual9.C (revision 338) @@ -0,0 +1,46 @@ +// { dg-do run } +// Source: Neil Booth, from PR #111. + +class A +{ +public : + int i; +}; + +class B : virtual public A +{ +}; + +class C : virtual public A +{ +}; + +class D : public B, public C +{ +public : + int f(void); + int g(void); +}; + +int D::f(void) +{ + return B::i; +} + +int D::g(void) +{ + return this->B::i; +} + +D d; +extern "C" void abort (void); + +int main(void) +{ + d.C::i=325; + + if (d.f() != d.B::i || d.f() != d.g()) + abort (); + + return 0; +}
virtual9.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: typedef2.C =================================================================== --- typedef2.C (nonexistent) +++ typedef2.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +struct S{ + + static const int i; + static const int j; +}; + +typedef S T; +const int T::i = 4; +const int T::j = 4;
typedef2.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: inline19.C =================================================================== --- inline19.C (nonexistent) +++ inline19.C (revision 338) @@ -0,0 +1,22 @@ +// { dg-do assemble } +// { dg-options "-O1" } +// Origin: Scott Snyder via PR 1733. +// + +struct TBtItem +{ + TBtItem(); +}; + + +struct TBtInnerNode +{ + TBtInnerNode(); + int MaxIndex() const { return 10; } +}; + + +TBtInnerNode::TBtInnerNode() +{ + new TBtItem[MaxIndex()+1]; +}
inline19.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,13 @@ +// { dg-do assemble } + +class K { +public: + friend class C; + +private: + static K qwe; + K(); + ~K(); +}; + +K K::qwe;
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: parse2.C =================================================================== --- parse2.C (nonexistent) +++ parse2.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 24 Nov 2000 + +// Bug 531: We ICEd trying to give a parse error. + +struct X +{ + bool operator (const X &) const; // { dg-error "" } parse error +};
parse2.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: decl9.C =================================================================== --- decl9.C (nonexistent) +++ decl9.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Build don't link +// Origin: batali@cogsci.ucsd.edu +// Contributed by Gabriel Dos Reis + +typedef struct { } S; // OK +typedef struct { }; // { dg-error "" } Missing type-name + +typedef union { } U; // OK +typedef union { }; // { dg-error "" } Missing type-name
decl9.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: crash10.C =================================================================== --- crash10.C (nonexistent) +++ crash10.C (revision 338) @@ -0,0 +1,52 @@ +// { dg-do assemble } +// Origin: Loring Holden + +template +class REFptr { + public: + REFptr(); + REFptr(T *pObj); + virtual ~REFptr(); + operator T* () const; +}; + +class GEL; +class GELsubc { + public : + virtual GEL *GELcast() const; +}; +class GELptr : public REFptr{ + public : + GELptr(const GELptr &p); + GELptr(const GELsubc &p); +}; +class GEL { }; + +class GEOM; +class GEOMptr : public REFptr, public GELsubc { + public: + GEOMptr() { } + GEOMptr(GEOM *g); +}; +class GEOM : public GEL { + public: + GEOM(const GEOMptr &o); + GEOM(); +}; + +class TEXT2D; +class TEXT2Dptr : public REFptr { + public: + TEXT2Dptr(); + TEXT2Dptr(TEXT2D *g); +}; +class TEXT2D : public GEOM { }; + +void testit(const GELptr g); + +void +FPS() +{ + TEXT2Dptr fps_text; + testit(GEOMptr(&*fps_text)); +}
crash10.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: inline3.C =================================================================== --- inline3.C (nonexistent) +++ inline3.C (revision 338) @@ -0,0 +1,51 @@ +// { dg-do assemble } +// { dg-options "-O3" } +// Origin: Mark Mitchell + +class ostream; + +struct S +{ + virtual void print(ostream&) const = 0; +}; + +template +class vector +{ +public: + _Tp& operator[](unsigned __n) const { return *(_M_start + __n); } + _Tp* _M_start; +}; + +class T +{ +public: + + void print(ostream&) const; + + vector bcList_m; +}; + +void T::print(ostream& o) const +{ + int n = 3; + + for (int i = 0; i < n; ++i) + bcList_m[i]->print(o); + return; +} + +ostream& +operator<<(ostream& o, const T& bcList) +{ + bcList.print(o); + return o; +} + + + + + + + +
inline3.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: explicit1.C =================================================================== --- explicit1.C (nonexistent) +++ explicit1.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// Origin: Jason Merrill + +struct A +{ + A (); + explicit A (int); +}; + +int main () +{ + const A& r = 1; // { dg-error "" } no suitable constructor +}
explicit1.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: defarg2.C =================================================================== --- defarg2.C (nonexistent) +++ defarg2.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do run } +// Test that default args don't mess up pmf type comparisons. +// Contributed by Jason Merrill . + +struct A { + void f (int = 0) { } +}; + +int +main () +{ + void (A::*p)(int) = 0; + p = &A::f; + if (p != &A::f) + return 1; +}
defarg2.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: builtins1.C =================================================================== --- builtins1.C (nonexistent) +++ builtins1.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do run } +// { dg-options "-O2" } +// Test whether this builtin minimally works in G++. +// Origin: Kaveh Ghazi Jan 16, 2001 +// Copyright (C) 2001 Free Software Foundation. +// + +namespace std +{ + extern "C" void abort (void); +} + +int main () +{ + using namespace std; + + if (::__builtin_strlen ("hello") != 5) + abort (); + + return 0; +}
builtins1.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: init17.C =================================================================== --- init17.C (nonexistent) +++ init17.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 17 Jan 2001 + +// Bug 1631. Default initialization of enumeral types did not convert to the +// enumeral type. + +enum X { alpha, beta }; + +void f(void *ptr) +{ + X y = X (); + X y1 (0); // { dg-error "" } cannot convert + X y2 = X (0); + X *x = new X (); + X *x2 = new X (0); // { dg-error "" } cannot convert +}
init17.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: dll-5.C =================================================================== --- dll-5.C (nonexistent) +++ dll-5.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble { target arm-*-*pe } } +// dllimport is "sorta like" to "extern". +// set compiler_result "(\nfoo1:.*\nfoo2:|\nfoo2:.*\nfoo1:)" +// set not_compiler_result "__imp_" + +__declspec (dllimport) int foo1; +int foo1; + +__declspec (dllimport) int foo2; +int foo2 = 5; + +int f () { return foo1 + foo2; }
dll-5.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: using8.C =================================================================== --- using8.C (nonexistent) +++ using8.C (revision 338) @@ -0,0 +1,43 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 14 Nov 2000 + +// We rejected using decls bringing in functions from a base which would hide a +// nested class of the same name, but only if we had no functions by that name +// already. Also, we failed to find that using declaration during lookup. Also +// we failed to reject using declarations which matched the constructor name. + +struct A +{ + int f (); + void D (); +}; + +struct A2 { + typedef int f; +}; + +struct B : A +{ + using A::f; + struct f {}; +}; + +struct C : A +{ + using A::f; + int f (int); + struct f {}; +}; + +void foo (B *bp, C* cp) +{ + bp->f (); + cp->f (); +} + +struct D : A +{ + using A::D; // { dg-error "" } names constructor +};
using8.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: crash3.C =================================================================== --- crash3.C (nonexistent) +++ crash3.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// { dg-options "-g -O2" } + +inline void f() { + struct S {}; + S s; +} + +void g() +{ + for (int i = 0; i < 2; ++i) + f(); +} +
crash3.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: vbase5.C =================================================================== --- vbase5.C (nonexistent) +++ vbase5.C (revision 338) @@ -0,0 +1,203 @@ +// { dg-do run } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 19 Jan 2001 + +// Bug 1701. building a vbase path was not using the shortest number of +// vbases. Normally that's just a pessimization, unfortunately during +// constructoring it leads to uninitialized reads. + +extern "C" int printf (...); + +int fail = 0; + +/*{{{ struct Base*/ +struct Base +{ + unsigned m; + static Base *addr; + + Base (); + virtual ~Base (); +}; +/*}}}*/ +Base *Base::addr; +/*{{{ Base::Base ()*/ +Base::Base () +{ + printf ("Base (%u) ctor %x\n", sizeof (Base), this); + if (fail) ; + else if (addr) + fail = 1; + else + addr = this; +} +/*}}}*/ +/*{{{ Base::~Base ()*/ +Base::~Base () +{ + printf ("Base dtor %x\n", this); + if (fail) + ; + else if (this != addr) + fail = 2; + else + addr = 0; +} +/*}}}*/ + +/*{{{ struct M10 : virtual Base*/ +struct M10 : virtual Base +{ + int m; + static M10 *addr; + + M10 (); + virtual ~M10 (); +}; +/*}}}*/ +M10 *M10::addr; +/*{{{ M10::M10 ()*/ +M10::M10 () +{ + printf ("M10 (%u) ctor %x\n", sizeof (M10), this); + if (fail) ; + else if (addr) + fail = 3; + else + addr = this; +} +/*}}}*/ +/*{{{ M10::~M10 ()*/ +M10::~M10 () +{ + printf ("M10 dtor %x\n", this); + if (fail) + ; + else if (this != addr) + fail = 4; + else + addr = 0; +} +/*}}}*/ + +/*{{{ struct M4 : virtual Base, virtual M10*/ +struct M4 : virtual Base, virtual M10 +{ + int m; + static M4 *addr; + + M4 (); + virtual ~M4 (); +}; +/*}}}*/ +M4 *M4::addr; +/*{{{ M4::M4 ()*/ +M4::M4 () +{ + printf ("M4 (%u) ctor %x\n", sizeof (M4), this); + if (fail) ; + else if (addr) + fail = 5; + else + addr = this; +} +/*}}}*/ +/*{{{ M4::~M4 ()*/ +M4::~M4 () +{ + printf ("M4 dtor %x\n", this); + if (fail) + ; + else if (this != addr) + fail = 6; + else + addr = 0; +} +/*}}}*/ + +/*{{{ struct M5 : M4*/ +struct M5 : M4 +{ + int m; + static M5 *addr; + + M5 (); + virtual ~M5 (); +}; +/*}}}*/ +M5 *M5::addr; +/*{{{ M5::M5 ()*/ +M5::M5 () +{ + printf ("M5 (%u) ctor %x\n", sizeof (M5), this); + if (fail) ; + else if (addr) + fail = 7; + else + addr = this; +} +/*}}}*/ +/*{{{ M5::~M5 ()*/ +M5::~M5 () +{ + printf ("M5 dtor %x\n", this); + if (fail) + ; + else if (this != addr) + fail = 8; + else + addr = 0; +} +/*}}}*/ + +/*{{{ struct M9 : M5, virtual M10*/ +struct M9 : M5, virtual M10 +{ + int m; + static M9 *addr; + + M9 (); + virtual ~M9 (); +}; +/*}}}*/ +M9 *M9::addr; +/*{{{ M9::M9 ()*/ +M9::M9 () +{ + printf ("M9 (%u), ctor %x\n", sizeof (M9), this); + if (fail) ; + else if (addr) + fail = 9; + else + addr = this; +} +/*}}}*/ +/*{{{ M9::~M9 ()*/ +M9::~M9 () +{ + printf ("M9 dtor %x\n", this); + if (fail) + ; + else if (this != addr) + fail = 10; + else + addr = 0; +} +/*}}}*/ + +int main () +{ + M9 *m9; + Base *r; + + m9 = new M9 (); + r = m9; + if (fail) + return fail; + void *top = dynamic_cast (r); + if (top != m9) + return 20; + r->~Base (); + + return fail; +}
vbase5.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: delete5.C =================================================================== --- delete5.C (nonexistent) +++ delete5.C (revision 338) @@ -0,0 +1,42 @@ +// { dg-do assemble } +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 15 Apr 1999 + +typedef __SIZE_TYPE__ size_t; + +struct X +{ + int i; + + X():i(){} + void *operator new(size_t) + { + return 0; // { dg-warning "" } cannot return NULL + } + void *operator new[](size_t) + { + return 0; // { dg-warning "" } cannot return NULL + } +}; + +struct Y +{ + int i; + + Y():i(){} + void *operator new(size_t) throw() + { + return 0; // ok + } + void *operator new[](size_t) throw() + { + return 0; // ok + } +}; + +int main() +{ + Y *yp = new Y; + + return yp != 0; +}
delete5.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,20 @@ +// { dg-do assemble } +// Origin: mrs@wrs.com (Mike Stump) + +class Wrapper { +public: + static const char msgPtr[]; + static const char *JunkFunc() { + return &msgPtr[0]; + } +}; + +const char Wrapper::msgPtr[] = "Hello world."; + +int main() { + const char *p1 = &Wrapper::msgPtr[0]; + const char *p2 = Wrapper::JunkFunc(); + + if (p1 != p2) + return 1; +}
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: linkage1.C =================================================================== --- linkage1.C (nonexistent) +++ linkage1.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } +typedef struct { + int i; +} *p; + +void f (p) { } // { dg-error "uses anonymous type" } +p q; // { dg-warning "uses anonymous type" } + +int main() +{ + extern p j; // { dg-warning "uses anonymous type" } + struct A { int j; }; + extern A a; // { dg-warning "uses local type" } + extern void f (A); // { dg-error "uses local type" } +}
linkage1.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: comdat5.C =================================================================== --- comdat5.C (nonexistent) +++ comdat5.C (revision 338) @@ -0,0 +1,7 @@ +// PR target/17828 +// { dg-do link { target fpic } } +// { dg-additional-sources " comdat5-aux.cc" } +// { dg-options "-O2 -fPIC" } +// { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } { "*" } { "" } } + +#include "comdat4.C"
comdat5.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: friend6.C =================================================================== --- friend6.C (nonexistent) +++ friend6.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do assemble } +// Origin: Martin v. Löwis +// Test for resolution of core issue 125. + +struct A{ + struct B{}; +}; + +A::B C(); + +namespace B{ + A C(); +} + +class Test{ + friend A (::B::C)(); // Ok + friend A::B (::C)(); // Ok + friend A::B::C(); // { dg-error "" } no A::B::C +};
friend6.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: lookup7.C =================================================================== --- lookup7.C (nonexistent) +++ lookup7.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do run } +// Test for handling of type shadowing in function scope. + +int main() +{ + int A = 42; + struct A + { + enum { a }; + }; + A = A::a; + return A; +}
lookup7.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: mangle10.C =================================================================== --- mangle10.C (nonexistent) +++ mangle10.C (revision 338) @@ -0,0 +1,26 @@ +// { dg-do assemble } + +template +struct A { + char *a; + A (const char* x) + { + a = (char*) x; + } +}; + +template +struct B { + T a[V-U+1]; + friend A f (B const &x) + { + return A ((char*) x.a); + } +}; + +const int a = 8; + +typedef B<1,a,int> C; +struct D { + C x; +};
mangle10.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: nested2.C =================================================================== --- nested2.C (nonexistent) +++ nested2.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// by Bert Bril + +struct M1 { + struct I {}; +}; + +struct M2 { + struct I {}; + struct J : virtual public M2::I, + virtual public M1::I {}; +};
nested2.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: shadow1.C =================================================================== --- shadow1.C (nonexistent) +++ shadow1.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Bug: g++ thinks that the i in g() shadows the parm from f() +// Contributed by Jason Merrill + +void f (int i) +{ + struct A { + void g () { + int i; + } + }; +}
shadow1.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: friend10.C =================================================================== --- friend10.C (nonexistent) +++ friend10.C (revision 338) @@ -0,0 +1,30 @@ +// { dg-do assemble } +// Origin: Neil Booth, from PR #78 + +namespace MySpace + { + class Tag1 { }; + class Tag2 { }; + + template + class Object + { + public: + + friend void Forgotten(Object const & m) {} + }; + + typedef Object U1; + typedef Object U2; + + void foo() + { + Forgotten(U1()); + Forgotten(U2()); + } + + void bar() + { + Forgotten(U1()); + } + }
friend10.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: debug2.C =================================================================== --- debug2.C (nonexistent) +++ debug2.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do assemble } +// { dg-options "-funroll-loops -O2 -g" } + +inline void f() +{ + typedef int T; +} + +inline void g() +{ + typedef double U; +} + +int n; + +struct B +{ + ~B() { + for (int i = 0; i < n; ++i) + g(); + } +}; + +struct D : public B { + ~D() { + for (int j = 0; j < n; ++j) + f(); + } +}; + +D d;
debug2.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: 900519_12.C =================================================================== --- 900519_12.C (nonexistent) +++ 900519_12.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do assemble } +// GROUPS abort +// g++ 1.37.1 bug 900519_12 + +// The following erroneous code causes g++ to segfault. + +// cfront 2.0 passes this test. + +// keywords: segfault, typedef, pointer type, function type + +typedef eek void (*)(); // { dg-error "" }
900519_12.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: rttid3.C =================================================================== --- rttid3.C (nonexistent) +++ rttid3.C (revision 338) @@ -0,0 +1,116 @@ +// { dg-do run } +// { dg-options "-frtti" } +// test of rtti of single inheritance and multiple inheritance with +// virtual functions +// dynamic casting + +#include + +extern "C" { + int printf(const char *, ...); + void exit(int); +} + +class X { + public: + int xi; + virtual int f() {return 0;}; +}; + +class Y : public X { + short ys; +}; + +class Z : public Y { + int zi; +}; + +Z z; +Y y; +Y *yp = &z; +X *xp = &z; +Z *zp = &z; + +class A { + public: + int Ai; + virtual int a() {return 0;}; +}; + +class B { + public: + int Bi; + virtual int g() {return 0;}; +}; + +class D : public A, public B { + int Di; +}; + +/* +class E : public D, public B { + int Ei; +}; +*/ +class E { + int Ei; +}; + +class F : public E, public D { + int Fi; +}; + +D d; +A *ap = &d; +B *bp = &d; +D *dp = &d; +F f; +F *fp = &f; +A *aap = &f; +B *bbp = &f; + +void *vp = zp; + +/* +void error (int i) +{ + printf("FAIL\n"); + exit(i); +} +*/ + +void error (int i) +{ + exit(i); +} + +int main () +{ + vp = (void *)0; + + vp = dynamic_cast (&z); + if (vp == 0) error(11); + + vp = dynamic_cast (yp); + if (vp == 0) error(11); + + vp = dynamic_cast (yp); + if (vp == 0) error(12); + + vp = dynamic_cast (dp); + if (vp != (void *)dp) error(21); + + vp = dynamic_cast (dp); + if (vp == (void *)dp) error(21); + + vp = dynamic_cast (fp); + if (vp != (void *)bbp) error(22); + + vp = dynamic_cast (aap); + if (vp != (void *)fp) error(23); + + vp = dynamic_cast (aap); + if (vp != (void *)bbp) error(24); + +} +
rttid3.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: lookup10.C =================================================================== --- lookup10.C (nonexistent) +++ lookup10.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } + +struct A { + struct B { + static int i; + }; + enum { a }; +}; + +int A::B::i = a;
lookup10.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: anon1.C =================================================================== --- anon1.C (nonexistent) +++ anon1.C (revision 338) @@ -0,0 +1,6 @@ +// { dg-do assemble } + +static union { + union { + }; +}; // { dg-warning "" } anonymous union with no members
anon1.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: static9.C =================================================================== --- static9.C (nonexistent) +++ static9.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// Origin: Ulrich Drepper + +struct st +{ + int a, b, c, d; +}; + +void g () +{ + static const st i = { 0,1,2,3 }; +} + +void h () +{ + static const st i = { 0,1,2,3 }; +}
static9.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: typedef3.C =================================================================== --- typedef3.C (nonexistent) +++ typedef3.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } +template +struct X{ + T v; + X(){} + virtual ~X(){} + virtual inline T f(T x){return x;} +}; + +void f() +{ + typedef int H; + X y; +}
typedef3.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,21 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct S +{ + S (); + ~S (); +}; + +void f () +{ + { + S s1; // { dg-error "" } skips initialization + + t: // { dg-error "" } jump to label + S s2; + ; + } + + goto t; // { dg-error "" } from here +}
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,51 @@ +// { dg-do assemble } + +struct S1 +{ + ~S1(int); // { dg-error "" } destructors may not have parameters +}; + + +template +struct S2 +{ + ~S2(int); // { dg-error "" } destructors may not have parameters +}; + + +struct S3 +{ + ~S3(double) {} // { dg-error "" } destructors may not have parameters +}; + + +template +struct S4 +{ + ~S4(double) {} // { dg-error "" } destructors may not have parameters +}; + + +struct S5 +{ + ~S5(); +}; + +S5::~S5(float) // { dg-error "" } destructors may not have parameters +{ +} + + +template +struct S6 +{ + ~S6(); +}; + +template +S6::~S6(float) // { dg-error "" } destructors may not have parameters +{ +} + + +
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: headers1.C =================================================================== --- headers1.C (nonexistent) +++ headers1.C (revision 338) @@ -0,0 +1,59 @@ +// { dg-do run } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Loren J. Rittle 07 Jun 2000 +// +// This test catches the occasional macro/symbol conflict between +// C++ and system-provided headers. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// The VxWorks kernel-mode headers define macros named "max" and +// "min", which is not ISO-compliant, but is part of the VxWorks API. +#if defined __vxworks && !defined __RTP__ +#undef max +#undef min +#endif +#include +#include + +int main () +{ + return 0; +}
headers1.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: overload1.C =================================================================== --- overload1.C (nonexistent) +++ overload1.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do run } +struct A { + A operator+ (int) const { return *this; } +}; + +A operator+ (A, float); + +int main () +{ + A a; + a + 1; +}
overload1.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: crash11.C =================================================================== --- crash11.C (nonexistent) +++ crash11.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// Origin: Alfred Minarik + +template +struct allocator +{ + typedef int size_type; +}; + +template +struct string +{ + typedef typename allocator::size_type size_type; + + static size_type size; + + size_type + max_size() const { return size; } +}; + +template struct string ;
crash11.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: inline4.C =================================================================== --- inline4.C (nonexistent) +++ inline4.C (revision 338) @@ -0,0 +1,25 @@ +// { dg-do assemble } +// { dg-options "-O2" } +// Origin: Mark Mitchell + +inline void f () +{ + return; +} + +inline void g (); + +void (*gp)() = &g; + +inline void g () +{ + f (); +} + +extern int array_size; + +void h () +{ + int lookup_array[array_size]; + g (); +}
inline4.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,9 @@ +// { dg-do run } +struct foo {}; +typedef long unsigned int & (foo::*pmf)(void); +void fn (...) {} +int main () +{ + pmf y = 0; + fn (y); +}
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: syntax1.C =================================================================== --- syntax1.C (nonexistent) +++ syntax1.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// { dg-options "-fsyntax-only" } +// Origin: Mark Mitchell + +class AAA{ +public: + virtual void fff(); +}; + +void AAA::fff() {} + +AAA aaa; + +main () +{ + aaa.fff(); +}
syntax1.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: defarg3.C =================================================================== --- defarg3.C (nonexistent) +++ defarg3.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +int* hp; +int* jp; + +void f (int *ip, int kp = hp - jp) +{ +}
defarg3.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: builtins2.C =================================================================== --- builtins2.C (nonexistent) +++ builtins2.C (revision 338) @@ -0,0 +1,23 @@ +// { dg-do run } +// { dg-options "-O2" } +// Test whether this builtin minimally works in G++. +// Origin: Kaveh Ghazi Jan 16, 2001 +// Copyright (C) 2001 Free Software Foundation. +// + +namespace std +{ + extern "C" void abort (void); +} + +int main () +{ + using namespace std; + char f[16]; + + if (::__builtin_strcpy (f, "hello world") != f + || __builtin_memcmp (f, "hello world", sizeof ("hello world"))) + abort (); + + return 0; +}
builtins2.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: init18.C =================================================================== --- init18.C (nonexistent) +++ init18.C (revision 338) @@ -0,0 +1,42 @@ +// Some targets (e.g. those with "set_board_info needs_status_wrapper 1" +// in their dejagnu baseboard description) require that the status is +// final when exit is entered (or main returns), and not "overruled" by a +// destructor calling _exit. It's not really worth it to handle that. +// +// Any platform that doesn't have proper __cxa_atexit support will also fail. +// +// { dg-do run } +// { dg-require-effective-target unwrapped } +// { dg-require-effective-target cxa_atexit } + +#include +extern "C" void _exit (int); + +static int cnt = 0; + +class Foo2 +{ + public: + Foo2() {} + ~Foo2() { if (++cnt == 2) _exit (0); } +}; + +static Foo2& GetFoo2() +{ + static Foo2 foo2; + return foo2; +} + +class Foo1 +{ + public: + Foo1() {} + ~Foo1() { if (++cnt != 1) abort(); GetFoo2(); } +}; + +int main( int argc, const char* argv[] ) +{ + static Foo1 anotherFoo; + exit (1); +} +
init18.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: perf1.C =================================================================== --- perf1.C (nonexistent) +++ perf1.C (revision 338) @@ -0,0 +1,78 @@ +// { dg-do assemble } + +// Test of severe performance regression from 2.95. This code generates +// a heavily self-referential tree which caused the inliner to take +// O(3**N) time to scan it for function calls. +// Reported by Kelley Cook . PR c++/1687. + +bool in0 ; +bool in1 ; +bool in2 ; +bool in3 ; +bool in4 ; +bool in5 ; +bool in6 ; +bool in7 ; +bool in8 ; +bool in9 ; +bool in10; +bool in11; +bool in12; +bool in13; +bool in14; +bool in15; +bool in16; +bool in17; +bool in18; +bool in19; +bool in20; +bool in21; +bool in22; +bool in23; +bool in24; +bool in25; +bool in26; +bool in27; +bool in28; +bool in29; +bool in30; +bool in31; +unsigned long output; + +void mux(void) +{ + output = + (in0 ? 0x00000001 : 0) | + (in1 ? 0x00000002 : 0) | + (in2 ? 0x00000004 : 0) | + (in3 ? 0x00000008 : 0) | + (in4 ? 0x00000010 : 0) | + (in5 ? 0x00000020 : 0) | + (in6 ? 0x00000040 : 0) | + (in7 ? 0x00000080 : 0) | + (in8 ? 0x00000100 : 0) | + (in9 ? 0x00000200 : 0) | + (in10 ? 0x00000400 : 0) | + (in11 ? 0x00000800 : 0) | + (in12 ? 0x00001000 : 0) | + (in13 ? 0x00002000 : 0) | + (in14 ? 0x00004000 : 0) | + (in15 ? 0x00008000 : 0) | + (in16 ? 0x00010000 : 0) | + (in17 ? 0x00020000 : 0) | + (in18 ? 0x00040000 : 0) | + (in19 ? 0x00080000 : 0) | + (in20 ? 0x00100000 : 0) | + (in21 ? 0x00200000 : 0) | + (in22 ? 0x00400000 : 0) | + (in23 ? 0x00800000 : 0) | + (in24 ? 0x01000000 : 0) | + (in25 ? 0x02000000 : 0) | + (in26 ? 0x04000000 : 0) | + (in27 ? 0x08000000 : 0) | + (in28 ? 0x10000000 : 0) | + (in29 ? 0x20000000 : 0) | + (in30 ? 0x40000000 : 0) | + (in31 ? 0x80000000 : 0) ; +} +
perf1.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: dll-6.C =================================================================== --- dll-6.C (nonexistent) +++ dll-6.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble { target arm-*-*pe } } +// set not_compiler_result "__imp_" +// dll.h +class aClass + { +public: + __declspec(dllimport) aClass(); + }; + +// dll.cpp + +__declspec(dllexport) aClass::aClass() + { + }
dll-6.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: using9.C =================================================================== --- using9.C (nonexistent) +++ using9.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 26 Feb 2001 + +// Bug 75. using declarations cannot introduce functions which ambiguate +// those in the current namespace, BUT here we're reaccessing the current +// namespace -- the function is not being 'introduced'. + +extern int a(); +struct x {}; + +using ::x; +using ::a; + +extern "C" void foo (); // { dg-error "previous declaration" } + +namespace { + extern "C" int foo (); // { dg-error "C.*linkage" } + using ::foo; // { dg-error "" } already in use +}
using9.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: access1.C =================================================================== --- access1.C (nonexistent) +++ access1.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } + +class X{ + unsigned int i; + public: + void f(); +}; + +void X::f() +{ + union { + int foo[sizeof (i)]; + }; +}
access1.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: crash4.C =================================================================== --- crash4.C (nonexistent) +++ crash4.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } + +struct T { + struct S __attribute__ ((packed)) { // { dg-error "" } parse error + int i; + }; +};
crash4.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: delete6.C =================================================================== --- delete6.C (nonexistent) +++ delete6.C (revision 338) @@ -0,0 +1,28 @@ +// { dg-do run } +// Origin: Alexander Schiemann (aschiem@count.math.uni-sb.de) + +typedef __SIZE_TYPE__ size_t; + +int i; + +struct B{}; + +struct A{ + + static void* operator new(size_t) + {return &i;} + + inline static void operator delete(void*p); + + static void operator delete(void*, const B&){} + +}; + + +inline void A::operator delete(void*p) +{A::operator delete(p,B());} + + +int main() +{A *ap=new A; +delete ap;}
delete6.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: string2.C =================================================================== --- string2.C (nonexistent) +++ string2.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do run } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 6 Mar 2000 + +// A char const array should never be confused for a string literal. + +int main () +{ + static const char ary[] = "wibble"; + void const *ptr = 0; + + ptr = ary; + if (ptr == "wibble") + return 1; + if (ptr != ary) + return 1; + return 0; +}
string2.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: linkage2.C =================================================================== --- linkage2.C (nonexistent) +++ linkage2.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// From: Klaus-Georg Adams +extern "C" +{ +typedef struct {int dummy[10];} *GDBM_FILE; +extern GDBM_FILE gdbm_open(); +} + +typedef struct { int dummy[10]; } *FAIL_FILE; +extern FAIL_FILE fail_open(); // { dg-error "" } non-local function + +typedef struct { int dummy[10]; } *SUCCESS_FILE, S; +extern SUCCESS_FILE success_open(); +
linkage2.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: null2.C =================================================================== --- null2.C (nonexistent) +++ null2.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do run } +// Based on a testcase by Eric Dumazet + +extern "C" void abort (); + +const char * const foo = ""; // foo is not NULL + +int main() { + if ((foo == 0) ? 0 : foo) // so this should evaluate to `foo' + return 0; + else + abort(); +}
null2.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: friend7.C =================================================================== --- friend7.C (nonexistent) +++ friend7.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// Origin: Martin v. Löwis +// Test that a friend declaration with an explicit :: finds the right fn. + +namespace M { +class S; +} +void foo(M::S *); + +namespace M { +class S { + friend void (::foo)(S *); + void Fn(); + static S s; +}; +} + +void (foo)(M::S *ptr) { + M::S::s.Fn(); + ptr->Fn(); +}
friend7.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: lookup8.C =================================================================== --- lookup8.C (nonexistent) +++ lookup8.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } + +struct S { + int A; + struct A { + enum { a = 0 }; + }; + + void f(); +}; + +void S::f() { + A = A::a; +}
lookup8.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: crash20.C =================================================================== --- crash20.C (nonexistent) +++ crash20.C (revision 338) @@ -0,0 +1,38 @@ +// { dg-do assemble } + +#include + +struct GcspFlags +{ + enum Enum + { + OffYes, + OffNo, + Root + }; + + static char const* name(Enum flag); + + template + struct btmFlag + { + static Enum const f=OffNo; + }; + +}; + +template<> +struct +GcspFlags::btmFlag +{ + static GcspFlags::Enum const f=GcspFlags::OffYes; +}; + +int +main () +{ + GcspFlags::btmFlag f; + const std::type_info& ti = typeid (f); + return 0; +} +
crash20.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: local-alloc1.C =================================================================== --- local-alloc1.C (nonexistent) +++ local-alloc1.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble { target fpic } } +// { dg-options "-O0 -fpic" } +// { dg-skip-if "requires unsupported run-time relocation" { spu-*-* } { "*" } { "" } } +// Origin: Jakub Jelinek + +struct bar { + bar() {} + double x[3]; +}; + +static bar y[4]; + +void foo(int z) +{ + bar w; + y[z] = w; +}
local-alloc1.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: nested3.C =================================================================== --- nested3.C (nonexistent) +++ nested3.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Origin: Chip Salzenberg + +class Foo { + public: + class Bar; +}; + +class Foo::Bar { + public: + Bar() {} +};
nested3.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: friend11.C =================================================================== --- friend11.C (nonexistent) +++ friend11.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Origin: robt@flyingpig.com + +class Outer +{ + friend void f1(); + class Inner2; +}; + +class Outer::Inner2 +{ +};
friend11.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: debug3.C =================================================================== --- debug3.C (nonexistent) +++ debug3.C (revision 338) @@ -0,0 +1,22 @@ +// { dg-do assemble } +// { dg-options "-O2" } +// Origin: Mark Mitchell + +struct S +{ + ~S(); +}; + +inline void f() +{ + static S s; +} + +typedef void (*fn_t)(); + +fn_t g() +{ + return &f; +} + +
debug3.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: rttid4.C =================================================================== --- rttid4.C (nonexistent) +++ rttid4.C (revision 338) @@ -0,0 +1,112 @@ +// { dg-do run } +// { dg-options "-w" } +// test of rtti of single inheritance and multiple inheritance with +// virtual inheritance +// dynamic casting + +#include + +extern "C" { + int printf(const char *, ...); + void exit(int); +} + +class X { + public: + int xi; + virtual int f() {}; +}; + +class Y : public virtual X { + short ys; +}; + +class Z : public virtual Y { + int zi; +}; + +Z z; +Y y; +Y *yp = &z; +X *xp = &z; +Z *zp = &z; + +class A { +public: + int Ai; + virtual int a() {}; +}; + +class B { +public: + int Bi; + virtual int g() {}; +}; + +class D : public virtual A, private B { + int Di; +}; + +class E : public virtual D, public B { + int Ei; +}; + +class F : public E, public virtual D { + int Fi; +}; + +D d; +A *ap = &d; +B *bp = (B *)&d; +F f; +F *fp = &f; +A *aap = &f; +D *dp = &f; +E *ep = &f; +B *bbp = (B *)dp; + +void *vp = zp; + +/* +void error (int i) +{ + printf("FAIL\n"); + exit(i); +} +*/ + +void error (int i) +{ + exit(i); +} + +int main () +{ + vp = (void *)0; + + vp = dynamic_cast (&z); + if (vp == 0) error(11); + + vp = dynamic_cast (yp); + if (vp == 0) error(11); + + vp = dynamic_cast (yp); + if (vp == 0) error(12); + + vp = dynamic_cast (dp); + if (vp != (void *)dp) error(21); + + // Ill-formed: dynamic_cast to private or ambiguous base + // vp = dynamic_cast (dp); + // if (vp == (void *)dp) error(21); + + // vp = dynamic_cast (fp); + // if (vp == (void *)bbp) error(22); + + vp = dynamic_cast (aap); + if (vp != (void *)fp) error(23); + + vp = dynamic_cast (aap); + if (vp == (void *)bbp) error(24); + +}
rttid4.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: lookup11.C =================================================================== --- lookup11.C (nonexistent) +++ lookup11.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } + +namespace A { + int i; +} +using namespace A; +namespace B { + int i; +} +using namespace B; + +int i;
lookup11.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: anon2.C =================================================================== --- anon2.C (nonexistent) +++ anon2.C (revision 338) @@ -0,0 +1,32 @@ +// { dg-do run } +extern "C" void abort (void); + +static union { + int x1; + long x2; + short x3; + long x4; +}; + +static union { + union { + union { + int z; + }; + }; + union { + union { + double d; + int i; + }; + }; +}; + + +int main() +{ + z = 3; + if (i != 3) + abort (); + d = 2.5; +}
anon2.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: typedef4.C =================================================================== --- typedef4.C (nonexistent) +++ typedef4.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do assemble } + +struct A { + void f (); +}; + +typedef A foo; + +void foo::f() { }
typedef4.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: fnname1.C =================================================================== --- fnname1.C (nonexistent) +++ fnname1.C (revision 338) @@ -0,0 +1,8 @@ +// { dg-do link } +// { dg-options "-g" } +// Origin: Loren James Rittle + +int main () +{ + const char *s = __FUNCTION__; +}
fnname1.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: vtbl1.C =================================================================== --- vtbl1.C (nonexistent) +++ vtbl1.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do link } +// Origin: DJ Delorie + +class X { +public: + int i; + X() { i = 0; } + ~X(); + virtual int foo() { return i; } + virtual void bar(); +}; + +int main() +{ +}
vtbl1.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: comdat3-aux.cc =================================================================== --- comdat3-aux.cc (nonexistent) +++ comdat3-aux.cc (revision 338) @@ -0,0 +1,6 @@ +#include "comdat3.h" + +void f () +{ + const bool *p = &A::b; +} Index: goto2.C =================================================================== --- goto2.C (nonexistent) +++ goto2.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// { dg-options "-Wunused" } +// Origin: Mark Mitchell + +struct S +{ + S (); + ~S (); +}; + +void f () +{ + { + S s1; + int j; // { dg-warning "" } unused + + t: // { dg-warning "" } unused + S s2; + } +}
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: scope1.C =================================================================== --- scope1.C (nonexistent) +++ scope1.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do run } +// Testcase for proper scoping of local externs. + +int x = 1; + +int main() +{ + int x = 2; + { + extern int x; + return (x != 1); + } +}
scope1.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: eh.C =================================================================== --- eh.C (nonexistent) +++ eh.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble } + +class foo { +public: + ~foo(); + foo &operator=(const foo &); + foo e() const; +}; +class bar { +public: + foo d() const; +}; +struct x { + foo a; + bar* b; +}; +void baz(x *f, int ic) +{ + f->a = ic ? f->b->d().e() : f->b->d(); +}
eh.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: dtor4.C =================================================================== --- dtor4.C (nonexistent) +++ dtor4.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do assemble } + +struct S1 { + ~S1(); // { dg-error "" } candidate +}; + +S1::~S1() const // { dg-error "" } prototype does not match +{ +} + + +struct S2 { + ~S2() volatile; // { dg-error "" } destructors may not be volatile +}; + + +template +struct S3 { + ~S3(); // { dg-error "" } candidate +}; + +template +S3::~S3() volatile // { dg-error "" } prototype does not match +{ +} + + +template +struct S4 { + ~S4() const; // { dg-error "" } destructors may not be const +};
dtor4.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: overload2.C =================================================================== --- overload2.C (nonexistent) +++ overload2.C (revision 338) @@ -0,0 +1,24 @@ +// { dg-do link } + +template +class ConstArray { +}; + +template +void operator+(const ConstArray&, const ConstArray&) +{ +} + +template +void operator+(const ConstArray&, T2); + +template +void operator+(T1, const ConstArray&); + +const ConstArray cai() { return ConstArray(); } +const ConstArray cad() { return ConstArray(); } + +int main() +{ + cai () + cad (); +}
overload2.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: asm1.C =================================================================== --- asm1.C (nonexistent) +++ asm1.C (revision 338) @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct S { + int i asm ("abc"); // { dg-error "" } `asm' specifier not permitted +};
asm1.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: crash12.C =================================================================== --- crash12.C (nonexistent) +++ crash12.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// { dg-options "" } +// Origin: Alfred Minarik + +template +struct S +{ + void f() {} +}; + +int main() +{ + S s; + int len = 50; + char array[len]; + s.f(); +}
crash12.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: inline5.C =================================================================== --- inline5.C (nonexistent) +++ inline5.C (revision 338) @@ -0,0 +1,30 @@ +// { dg-do assemble } +// { dg-options "-O2" } +// Origin: Matt Austern + +class X; + +extern X* tab1; + +struct Y { + explicit Y(int); +}; + +void* x (); + +Y k (void *); + +inline void f() { k (x ()); } + +inline void* x () +{ + return 0; +} + +static void g() { + f(); +} + +static void h() { + f(); +}
inline5.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: pod1.C =================================================================== --- pod1.C (nonexistent) +++ pod1.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 28 Feb 2001 + +// DR 148. Now allows pointer to members in POD struct. + +struct X +{ + int X::*m; + int (X::*f) (); +}; + +void Foo (int, ...); + +void Baz () +{ + X x; + + Foo (1, x); +}
pod1.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: pmf2.C =================================================================== --- pmf2.C (nonexistent) +++ pmf2.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } + +// submitted by David C Binderman + +struct S +{ + void f(); +}; + +void (S ::* pmf) (); + +S * pf; + +void +f() +{ + pmf = & pf->f; // { dg-error "" } not a valid pmf expression +}
pmf2.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: syntax2.C =================================================================== --- syntax2.C (nonexistent) +++ syntax2.C (revision 338) @@ -0,0 +1,28 @@ +// { dg-do assemble } +// { dg-options "-fsyntax-only" } +// Origin: Mark Mitchell + +struct B +{ + double d; + + virtual void f (); +}; + +struct C: virtual public B +{ + char c; +}; + +struct D: virtual public B +{ + int i; + virtual void f (); +}; + +struct E : public C, public D +{ +}; + +E e; +
syntax2.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: lex1.C =================================================================== --- lex1.C (nonexistent) +++ lex1.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 26 April 2001 + +// Bug 2510. We ICEd when a bogus char was present. + +void foo () +{ + // there is a ctrl-h on the next line +  // { dg-error "" } stray char +}
lex1.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: lookup20.C =================================================================== --- lookup20.C (nonexistent) +++ lookup20.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Bug: typename_sub2 returned the type, so we tried to look up "A" in B. + +struct A { struct A1 { }; }; + +struct B { + typedef A Q; +}; + +struct C: public B::Q::A1 { };
lookup20.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: defarg4.C =================================================================== --- defarg4.C (nonexistent) +++ defarg4.C (revision 338) @@ -0,0 +1,28 @@ +// { dg-do assemble } +// Origin: scott snyder + +class complex +{ +public: + complex(); +}; + +struct MLC33 +{ + MLC33( const complex& = complex() ); +}; + +void EmptyClone() +{ + MLC33(); +} + +void makeM33() +{ + MLC33(); +} + +void Clone() +{ + MLC33(); +}
defarg4.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: builtins3.C =================================================================== --- builtins3.C (nonexistent) +++ builtins3.C (revision 338) @@ -0,0 +1,24 @@ +// { dg-do run } +// { dg-options "-O2" } +// Test whether this builtin minimally works in G++. +// Origin: Kaveh Ghazi Jan 16, 2001 +// Copyright (C) 2001 Free Software Foundation. +// + +namespace std +{ + extern "C" void abort (void); +} + +int main () +{ + using namespace std; + void *foo; + + foo = ::__builtin_alloca (32); + if (!foo) + abort (); + + return 0; +} +
builtins3.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: init19.C =================================================================== --- init19.C (nonexistent) +++ init19.C (revision 338) @@ -0,0 +1,85 @@ +// { dg-do run { xfail { { ! cxa_atexit } && { ! *-*-solaris2* } } } } +#include + +#define assert(x) do { if (! (x)) abort(); } while (0) + +int count = 0; + +class A +{ +public: + explicit A(int i); + ~A(); + + int i; + + A(const A&); + A& operator=(const A&); +}; + +A::A(int i_) + : i(i_) +{ +} + +A::~A() +{ + assert(++count == i); + i = -1; +} + +extern "C" { + +void one() +{ + static bool second_time; + if (second_time) + assert(++count == 9); + else + { + assert(++count == 1); + second_time = true; + } + static A a(10); + assert(a.i == 10); +} + +void two() +{ + assert(++count == 7); + static A a(8); + assert(a.i == 8); +} + +void three() +{ + assert(++count == 2); + static A a(6); + assert(a.i == 6); +} + +void five() +{ + assert(++count == 4); + static A a(5); + assert(a.i == 5); +} + +void four() +{ + assert(++count == 3); + atexit(five); +} + +} + +A zero(11); + +int main() +{ + one(); + atexit(one); + atexit(two); + three(); + atexit(four); +}
init19.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: instan1.C =================================================================== --- instan1.C (nonexistent) +++ instan1.C (revision 338) @@ -0,0 +1,24 @@ +// { dg-do link } +// { dg-options "-fno-implicit-templates" } +// Origin: Mark Mitchell + +template +struct U { + static int j; +}; + +template +struct S { + static const int i = 7; +}; + +template +const int S::i; + +template +int U::j = S::i + 5; + +template int U::j; + +int main () { +}
instan1.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: access2.C =================================================================== --- access2.C (nonexistent) +++ access2.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Based on a testcase in the Standard, submitted by several people + +class Outer { + typedef int T; + struct Inner { + T i; // { dg-error "" "" { xfail *-*-* } } not accessible - + void f() { + T j; // { dg-error "" "" { xfail *-*-* } } not accessible - + } + }; +};
access2.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: crash5.C =================================================================== --- crash5.C (nonexistent) +++ crash5.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } + +class TecMesh {}; + +extern TecMesh& m; + +struct X { + X(TecMesh&); +}; + +struct D { + D(); + TecMesh& Mesh; +}; + + +D::D () + : Mesh(m) +{ + X x(D::Mesh); +}
crash5.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: delete7.C =================================================================== --- delete7.C (nonexistent) +++ delete7.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do run } +// Test that we call a class-specific vector op delete. + +#include + +int r = 1; + +struct A +{ + void operator delete[](void *p) { r = 0; ::operator delete (p); } +}; + +int main () +{ + A (*p)[2] = new A[2][2]; + delete [] p; + return r; +}
delete7.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: sibcall1.C =================================================================== --- sibcall1.C (nonexistent) +++ sibcall1.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do run } +// { dg-options "-O2" } + +#include + +std::ostream& foo (const char *x, std::ostream &y) +{ + return y << "" << x; +} + +int main () +{ + foo ("", std::cout); +}
sibcall1.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: linkage3.C =================================================================== --- linkage3.C (nonexistent) +++ linkage3.C (revision 338) @@ -0,0 +1,5 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +extern "C" void f (); // { dg-error "" } previous declaration +static void f () {} // { dg-error "" } extern redeclared static
linkage3.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: null3.C =================================================================== --- null3.C (nonexistent) +++ null3.C (revision 338) @@ -0,0 +1,6 @@ +// { dg-do assemble } + +void x() +{ + int* p = 1==0; +}
null3.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: friend8.C =================================================================== --- friend8.C (nonexistent) +++ friend8.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do assemble } +// +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 14 Aug 2000 + +// We failed to diagnose when a class friend declaration did not use an +// elaborated type specifier. + +struct Y; +struct Z; +struct X +{ + friend class Z; + friend Y; // { dg-error "" } friend must use aggr tag +}; +
friend8.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: lookup9.C =================================================================== --- lookup9.C (nonexistent) +++ lookup9.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do assemble } + +struct S { + typedef long I; +}; + +struct D : virtual public S { + I i; +};
lookup9.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: crash21.C =================================================================== --- crash21.C (nonexistent) +++ crash21.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// Origin: Gabriel Dos Reis + +struct A { + virtual void f(int&) const; +}; + +struct B : public A { + int x; +}; + +void B::f(int& t) { // { dg-error "" } undeclared method + x = t; +}
crash21.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: typename1.C =================================================================== --- typename1.C (nonexistent) +++ typename1.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// { dg-options "-pedantic -Wno-deprecated" } +// This code snippet should be rejected with -pedantic +// Based on a test case by Louidor Erez + + +template +class Vector { +public: + typedef T* iterator; +}; + +template +void f() +{ + Vector::iterator i = 0; // { dg-error "typename" } missing typename +} // { dg-error "expected" "" { target *-*-* } 16 }
typename1.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: nested4.C =================================================================== --- nested4.C (nonexistent) +++ nested4.C (revision 338) @@ -0,0 +1,33 @@ +// { dg-do assemble } +// +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 10 Aug 2000 + +// bug 372 We ICE'd on the out-of-class definition of a nested class of a +// class template. + +struct Bar +{ +}; + +template +struct Foo +{ + struct Baz; + struct Biz; + struct Boz + : Bar + { + }; +}; + +template +struct Foo::Biz +{ +}; + +template +struct Foo::Baz +: Bar +{ +};
nested4.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: debug4.C =================================================================== --- debug4.C (nonexistent) +++ debug4.C (revision 338) @@ -0,0 +1,6 @@ +// { dg-do assemble } +// { dg-options "-g" } + +typedef volatile struct { + int i; +} mutex_t;
debug4.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: lookup12.C =================================================================== --- lookup12.C (nonexistent) +++ lookup12.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct B { + struct X {}; +}; + + +struct D : public B { + void X(); + + struct X x; + + void f(); +}; + + +void D::f() +{ + struct X y; +}
lookup12.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: anon3.C =================================================================== --- anon3.C (nonexistent) +++ anon3.C (revision 338) @@ -0,0 +1,86 @@ +// { dg-do run } +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 20 May 1999 + +// Although anon unions cannot have user defined member functions +// [class.union/2]. They should have implicitly defined copy ctors and +// and the like [class.copy/4]. Make sure we generate one of the correct +// signature and that it works ok. + +extern "C" void abort(); + +struct A +{ + union + { + int a; + }; +}; +union B +{ + int a; +}; + +static A Ctor(A const &src) +{ + A result(src); // this should not cause a const violation + + result = src; // and neither should this + + return result; +} + +typedef __SIZE_TYPE__ size_t; + +void *operator new(size_t, void *ptr) +{ + return ptr; +} + +// check copy ctor and assignment for plain union +void check_union() +{ + B b1; + B b2; + + b1.a = 5; + b2.a = 6; + b2 = b1; + if(b2.a != 5) + abort(); + + b2.a = 6; + new (&b2) B(b1); + if(b2.a != 5) + abort(); + + return; +} + +// check copy ctor and assignment for class containing anon-union +void check_union_member() +{ + A a1; + A a2; + + a1.a = 5; + a2.a = 6; + a2 = a1; + if(a2.a != 5) + abort(); + + a2.a = 6; + new (&a2) A(a1); + if(a2.a != 5) + abort(); + + return; +} + +int main() +{ + check_union(); + check_union_member(); + + return 0; +}
anon3.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: typedef5.C =================================================================== --- typedef5.C (nonexistent) +++ typedef5.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do assemble } + +// by Alexandre Oliva + +typedef int t; +typedef t* u; +typedef u v; +typedef v* (*w)(t); +typedef int t; +typedef t* u; +typedef u v; +typedef v* (*w)(t const); // this is ok +typedef v* (*w)(t); // { dg-error "" } covers message `previously declared here' +typedef v* (*const w)(t); // { dg-error "" } invalid redeclaration +typedef v const* (*w)(t); // { dg-error "" } invalid redeclaration +typedef v* const (*w)(t); // { dg-error "" } invalid redeclaration
typedef5.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: vtbl2.C =================================================================== --- vtbl2.C (nonexistent) +++ vtbl2.C (revision 338) @@ -0,0 +1,77 @@ +// { dg-do run } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 8 Feb 2000 + +// vtable construction reorganisation broke this + +// execution test + +#include + +static int fail = 0; + +void bad (char const *name) +{ + printf ("Bad %s\n", name); + fail = 1; +} +void ok (char const *name) +{ + printf ("Ok %s\n", name); +} + +struct Core +{ + virtual ~Core (); + virtual void Wibble () {bad (__PRETTY_FUNCTION__);} + virtual void Wobble () {bad (__PRETTY_FUNCTION__);} + virtual void Bogus () {bad (__PRETTY_FUNCTION__);} +}; +struct Side +{ + virtual ~Side (); + virtual void Arfle () {bad (__PRETTY_FUNCTION__);} + virtual void Barfle () {bad (__PRETTY_FUNCTION__);} + virtual void Gloop () {bad (__PRETTY_FUNCTION__);} + virtual void Glorp () {bad (__PRETTY_FUNCTION__);} + virtual void Glump () {bad (__PRETTY_FUNCTION__);} + virtual void Bogus () {bad (__PRETTY_FUNCTION__);} +}; +struct Base : Core +{ + virtual ~Base (); + virtual void Bink () {bad (__PRETTY_FUNCTION__);} + virtual void Bonk () {bad (__PRETTY_FUNCTION__);} + virtual void Bogus () {bad (__PRETTY_FUNCTION__);} +}; +struct Multi : Base, Side +{ + virtual ~Multi (); + virtual void Stomped () {ok (__PRETTY_FUNCTION__);} + virtual void Bunk () {bad (__PRETTY_FUNCTION__);} + virtual void Bogus () {bad (__PRETTY_FUNCTION__);} +}; +struct Trail : Multi +{ + virtual ~Trail (); +}; +Core::~Core () {} +Side::~Side () {} +Base::~Base () {} +Multi::~Multi () {} +Trail::~Trail () {} + +void foo (Multi *ptr) +{ + ptr->Stomped (); +} + +int main () +{ + Multi m; + Trail t; + + foo (&m); + foo (&t); + return fail != 0; +}
vtbl2.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: align.C =================================================================== --- align.C (nonexistent) +++ align.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } +#include + +class bar { +public: + bar() { rw = 0; } + static const bar baz; +private: + unsigned char rw; +}; +char buf[4096]; +void foo(char *uc) +{ + memcpy(buf,&bar::baz,sizeof(bar)); +}
align.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: goto3.C =================================================================== --- goto3.C (nonexistent) +++ goto3.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// Testcase for various invalid gotos. +// Origin: Jason Merrill + +void f () +{ + goto foo1; // { dg-error "" } jumps + try { foo1:; } catch (...) { } // { dg-error "" } into try + goto foo2; // { dg-error "" } jumps + try { } catch (...) { foo2:; } // { dg-error "" } into catch + goto foo3; // { dg-error "" } jumps + { int i=2; foo3:; } // { dg-error "" } past init + + try { foo4:; } catch (...) { } // { dg-error "" } + goto foo4; // { dg-error "" } + try { } catch (...) { foo5:; } // { dg-error "" } + goto foo5; // { dg-error "" } + { int i=2; foo6:; } // { dg-error "" } + goto foo6; // { dg-error "" } +}
goto3.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: dtor5.C =================================================================== --- dtor5.C (nonexistent) +++ dtor5.C (revision 338) @@ -0,0 +1,37 @@ +// { dg-do run } +// Origin: Mark Mitchell + +extern "C" void abort (); + +struct B; + +struct S +{ + S (B*); + ~S (); + + B* b_; +}; + +struct B +{ + B () : s (this) { } + + virtual void f () { } + + S s; +}; + +S::S (B* b) : b_ (b) { } + +S::~S () { b_->f (); } + +struct D : public B +{ + virtual void f () { abort (); } +}; + +int main () +{ + D d; +}
dtor5.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: overload3.C =================================================================== --- overload3.C (nonexistent) +++ overload3.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do link } + +void f(const int *); +void f(int *) {} + +void f2(const volatile int *); +void f2(volatile int *) {} + +int i; + +int main() +{ + f(&i); + f2(&i); +} +
overload3.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: asm2.C =================================================================== --- asm2.C (nonexistent) +++ asm2.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct C +{ + void f (); +}; + +void C::f () +{ + asm ("" : : "m" (f)); // { dg-error "" } type could not be determined +}
asm2.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: crash30.C =================================================================== --- crash30.C (nonexistent) +++ crash30.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// Origin: Jakub Jelinek + +struct foo +{ + foo(); + void x(); +}; + +void foo::x() throw(bar) // { dg-error "" } parse error +{ +} + +void bar() +{ + foo x; +}
crash30.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: crash13.C =================================================================== --- crash13.C (nonexistent) +++ crash13.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } + +struct Base_bitset { + unsigned M_w[2]; + void M_do_right_shift(); +}; + + +void Base_bitset::M_do_right_shift () +{ + unsigned n = 0; + M_w[0] = M_w[n + 1] ; +}
crash13.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: inline6.C =================================================================== --- inline6.C (nonexistent) +++ inline6.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do assemble } +// { dg-options "-O2" } +// Origin: Mark Mitchell + +struct S +{ +}; + +void f (S s = S ()); + +inline void g () +{ + f (); +} + +void h () +{ + g (); +}
inline6.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: pmf3.C =================================================================== --- pmf3.C (nonexistent) +++ pmf3.C (revision 338) @@ -0,0 +1,25 @@ +// { dg-do assemble } +// Submitted by Nathan Sidwell +// Bug: g++ was crashing after giving errors. + +template + void connect_to_method( // { dg-message "candidate is" } + T *receiver, + void (T::*method)()) + {} + +class Gtk_Base +{ +public: + void expose(); + void show(); + void show(int); + Gtk_Base(); +}; + + +Gtk_Base::Gtk_Base() +{ + connect_to_method(this,&show); // { dg-error "no match" } invalid pmf expression + connect_to_method(this,&expose); // { dg-error "pointer to member" } invalid pmf expression +}
pmf3.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: syntax3.C =================================================================== --- syntax3.C (nonexistent) +++ syntax3.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 22 June 2000 + +// Origin GNATS bug report 262 from Jeremy Sanders +// and several others. With templates, it's very easy to say something +// erroneous like +// template class X::X +// The culprit +// ... class X::X ... +// caused us to ICE as we got confused about pushing and popping scopes. + +class X +{ + public: + X(); +}; + +class X::X () {} // { dg-error "" } parse error +X::X () {}
syntax3.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: lookup21.C =================================================================== --- lookup21.C (nonexistent) +++ lookup21.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do run } +// Check that we don't complain about ambiguity between the same static +// member function in different subobjects. + +struct A { + static void f() {} +}; + +struct B: public A { }; +struct C: public A { }; +struct D: public B, public C { }; + +int main() +{ + D d; + d.f(); +}
lookup21.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: defarg5.C =================================================================== --- defarg5.C (nonexistent) +++ defarg5.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// Bug: the SAVE_EXPR in the new expression remembers that it's in g(), +// causing the compiler to crash in h(). + + +struct A { + A (); +}; + +void f (A* = new A); + +void g () +{ + f (); +} + +void h () +{ + f (); +}
defarg5.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: builtins4.C =================================================================== --- builtins4.C (nonexistent) +++ builtins4.C (revision 338) @@ -0,0 +1,24 @@ +// { dg-do run } +// { dg-options "-O2" } +// Test whether this builtin minimally works in G++. +// Origin: Kaveh Ghazi Jan 16, 2001 +// Copyright (C) 2001 Free Software Foundation. +// + +namespace std +{ + extern "C" void abort (void); +} + +int main () +{ + using namespace std; + + ::__builtin_printf ("hello world\n"); + ::__builtin_printf ("\n"); + ::__builtin_printf ("%s\n", "hello world"); + ::__builtin_printf ("%c", '\n'); + + return 0; +} +
builtins4.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: qual1.C =================================================================== --- qual1.C (nonexistent) +++ qual1.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// { dg-options "-O" } +// Origin: Benjamin Pflugmann + +// DR 295 allows qualification via typedef + +typedef const char *(func_type)(); + +class C +{ +public: + func_type *Function; + // The following is DR 295 dependent + const func_type* function(void) { return Function; } + volatile func_type* functionv(void); +} action; + +void work(const char *source) +{ + work( action.function()() ); +}
qual1.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: access3.C =================================================================== --- access3.C (nonexistent) +++ access3.C (revision 338) @@ -0,0 +1,26 @@ +// { dg-do assemble } +// The standard sez that a use of a name gets the most access it can through +// the various paths that can reach it. Here, the access decl in B gives +// us access. + +struct A +{ + void f (); +}; + +struct B: private virtual A +{ + A::f; +}; + +struct C: private virtual A, public B +{ +}; + +int +main () +{ + C c; + + c.f (); +}
access3.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: dyncast1.C =================================================================== --- dyncast1.C (nonexistent) +++ dyncast1.C (revision 338) @@ -0,0 +1,123 @@ +// { dg-do run } +// Author: Alfred Miniarik +// test of dynamic_cast +// runtime detecting of nonpublic +// inheritance within a cast +// and therefor failing with result 0. + +extern "C" void abort(); +extern "C" int printf (const char *, ...); + +static int errors = 0; +void error(int i) +{ + printf("Error %i\n",i); + errors++; +} + +// 1. downcast + +// 1.1. single inheritance case + +struct A {virtual ~A(){}}; +struct AA : A {}; +struct B : A {}; +struct BB : B {}; +class C : B {}; +struct D : C {}; + +struct CC : B {}; +class DD : CC {}; + +class CCC : protected B {}; +class DDD : protected CCC {}; + +void +test01 () +{ + D d; + if(dynamic_cast ((A*)&d)) error(1); + if(dynamic_cast ((B*)&d)) error(2); + if(&d != dynamic_cast ((C*)&d)) error(3); //counter example + if(dynamic_cast ((B*)&d)) error(4); + + DD dd; + if(dynamic_cast ((A*)&dd)) error(5); + if(dynamic_cast ((B*)&dd)) error(6); + + DDD ddd; + if(dynamic_cast ((A*)&ddd)) error(7); + if(dynamic_cast ((B*)&ddd)) error(8); + if(dynamic_cast ((B*)&ddd)) error(9); +} + +// 1.2. multiple inheritance case +// 1.2.1. all bases are public + +struct E : D, CC {}; +struct EE : CC, D {}; //Will search in reverse order. + +void +test02 () +{ + E e; + if(dynamic_cast ((A*)(D*)&e)) error(10); + if(dynamic_cast ((B*)(D*)&e)) error(11); + if(&e != dynamic_cast ((C*)(D*)&e)) error(12); //counter example + if(&e != dynamic_cast ((B*)(CC*)&e)) error(13); //counter example + if((CC*)&e != dynamic_cast ((B*)(CC*)&e)) error(14); //counter example + + EE ee; + if(dynamic_cast ((A*)(D*)&ee)) error(15); + if(dynamic_cast ((B*)(D*)&ee)) error(16); + if(&ee != dynamic_cast ((C*)(D*)&ee)) error(17); //counter example + if(&ee != dynamic_cast ((B*)(CC*)&ee)) error(18); //counter example + if((CC*)&ee != dynamic_cast ((B*)(CC*)&ee)) error(19); //counter example +} + +// 1.2.2 one or more branches are nonpublic + +struct X : private BB, E {}; +struct Y : AA, private B {}; + +class XX : BB, E {}; + +void +test03 () +{ + X x; + if(&x != dynamic_cast((B*)(CC*)(E*)&x)) error(20); //counter example + XX xx; + if(dynamic_cast((B*)(CC*)(E*)&xx)) error(21); + Y y; + if(dynamic_cast((B*)&y)) error (22); + if(dynamic_cast((A*)(B*)&y)) error (23); +} + +// 2. crosscast + +struct J {virtual ~J(){}}; +struct K : CC, private J {}; +class KK : J, CC{}; + +void +test04 () +{ + E e; + if(dynamic_cast ((B*)(D*)&e)) error(24); + if((CC*)&e != dynamic_cast ((C*)(D*)&e)) error(25); //counter example + K k; + if(dynamic_cast ((B*)&k)) error(26); + KK kk; + if(dynamic_cast ((CC*)&kk)) error(27); +} + +int +main () +{ + test01(); + test02(); + test03(); + test04(); + return errors ? 1 : 0; +}
dyncast1.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: crash6.C =================================================================== --- crash6.C (nonexistent) +++ crash6.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do assemble } +// { dg-options "-O2" } + +struct E +{ + int f(int); +}; + +void ha() +{ + enum {X = 0}; + + int A, C; + + E vList[10]; + + A = (C + 1) % 3; + vList[1].f(A); +}
crash6.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: conv1.C =================================================================== --- conv1.C (nonexistent) +++ conv1.C (revision 338) @@ -0,0 +1,6 @@ +// { dg-do assemble } + +class X { +public: + const operator int (); // { dg-error "" } invalid declaration. +};
conv1.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: delete8.C =================================================================== --- delete8.C (nonexistent) +++ delete8.C (revision 338) @@ -0,0 +1,40 @@ +// { dg-do run } +// Origin: Mark Mitchell + +#include + +struct S { + ~S (); +}; + +bool flag; +S* s1; +S* s2; + +void* operator new (size_t s) +{ + return malloc (s); +} + +void operator delete (void* p) +{ + if (flag && p != s2) + abort (); +} + +S::~S () { + if (this != s2) + abort (); + s1 = 0; +} + +int main () { + s2 = new S; + s1 = s2; + // Turn on the check in `operator delete'. + flag = true; + delete s1; + // Turn it off again so that normal shutdown code works. + flag = false; +} +
delete8.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: sibcall2.C =================================================================== --- sibcall2.C (nonexistent) +++ sibcall2.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do assemble } +// { dg-options "-O2 -foptimize-sibling-calls -fno-exceptions" } + +struct X +{ + const char *c() const { return b; }; + char *b; +}; +extern "C" int f (const char *); +struct A +{ + X x; + void y(); +}; +void A::y() +{ + const char *const a[] = { x.c() }; + f (a[0]); +}
sibcall2.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: linkage4.C =================================================================== --- linkage4.C (nonexistent) +++ linkage4.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +static int strlen (const char*) { return 0; } + +template +void f () {} + +// Check that the strlen declaration here is given internal linkage by +// using it as a non-type template argument, and expecting an error. +template void f(); // { dg-error "" } no matching template
linkage4.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: friend9.C =================================================================== --- friend9.C (nonexistent) +++ friend9.C (revision 338) @@ -0,0 +1,23 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 24 Nov 2000 + +// Bug 853: We reported the wrong line no for a friend access violation + +class F +{ + class Internal; // { dg-error "" } is private +}; + +class C +{ + friend class F::Internal; // { dg-error "" } in this context + public: + typedef enum { A, B } e; + + C (); + ~C(); + + void m(); +};
friend9.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: access10.C =================================================================== --- access10.C (nonexistent) +++ access10.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do assemble } +// Test that defining a static member of private type with the () syntax works. + +class A { + private: + struct B { B(int) {} }; + static B b; +}; +A::B A::b (1);
access10.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: singleton.C =================================================================== --- singleton.C (nonexistent) +++ singleton.C (revision 338) @@ -0,0 +1,39 @@ +// { dg-do run } +// This tests two things: +// 1. there is an annoying warning. +// singleton.C:26: warning: `class singleton' only defines private constructors and has no friends +// egcs fails to see that there is a public static accessor function. +// 2. the program crashes, because apparently the static variable s in +// singleton::instance() is considered constructed although the ctor +// exited via an exception. (crash changed to nonzero return here) + +class singleton { +public: + static singleton& instance() { + static singleton s; + return s; + } + int check() {return initialized;} + +private: + singleton() : initialized(1) { + if ( counter++ == 0 ) throw "just for the heck of it"; + initialized = 2; + } + singleton( const singleton& rhs ); + void operator=( const singleton& rhs ); + int initialized; + static int counter; +}; + +int singleton::counter; + +int main() +{ + while (1) { + try { + return singleton::instance().check()-2; + } catch (...) { } + } +} +
singleton.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: field1.C =================================================================== --- field1.C (nonexistent) +++ field1.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } + +struct X +{ + static const bool b = true; + static const int i = b ? 1 : 2; +};
field1.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: crash22.C =================================================================== --- crash22.C (nonexistent) +++ crash22.C (revision 338) @@ -0,0 +1,56 @@ +// { dg-do link } +// { dg-options "-O2" } + +class foo +{ +}; + +typedef void *voidp; +class vect : public foo +{ +public: + voidp& a(); + int b(); +}; + +class bar +{ +public: + bar *c(bool (*f)(bar *node), voidp g) + { + int i=0; + bool j; + while (i < d.b()){ + j = (f == __null) || f((bar*)d.a()); + if (j) + ((bar*)d.a())->c(f, g); + i++; + } + return this; + } + public: + vect d; + bar *e(foo *k); +}; + +bar *bar::e(foo *k) +{ + return c(__null, k); +} + +voidp &vect::a() +{ + static voidp x; + return x; +} + +int vect::b() +{ + static int x; + return x; +} + +int main() +{ + return 0; +}
crash22.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: typename2.C =================================================================== --- typename2.C (nonexistent) +++ typename2.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } + +template +void f() +{ + typename T::u; // { dg-error "" } declare anything +}
typename2.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: lineno1.C =================================================================== --- lineno1.C (nonexistent) +++ lineno1.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// { dg-options "-w" } +// Submitted by Nathan Sidwell +// Bug: g++ was giving the wrong line number for statics. + +class A +{ + A(); // { dg-error "" } private + ~A(); // { dg-error "" } private +}; + +static A a; // { dg-error "" } here + + +
lineno1.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,21 @@ +// { dg-do run } +// Bug: fold is too eager about pushing down CLEANUP_POINT_EXPR. + +int d; + +struct A { + A() { } + ~A() { d = 1; } +}; + +int f (const A& a) +{ + return 1; +} + +int main () +{ + if (f (A()) && d == 0) + return 0; + return 1; +}
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: debug5.C =================================================================== --- debug5.C (nonexistent) +++ debug5.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// { dg-options "-g" } +// Origin: Mark Mitchell + +struct S +{ + ~S (); +}; + +void f () +{ + t: + S s3; +} +
debug5.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: std1.C =================================================================== --- std1.C (nonexistent) +++ std1.C (revision 338) @@ -0,0 +1,12 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +extern "C" int memcmp (const void * __s1, + const void * __s2, + __SIZE_TYPE__ __n) throw (); + +namespace std { +void f () { + memcmp (0, 0, 0); +} +}
std1.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: lookup13.C =================================================================== --- lookup13.C (nonexistent) +++ lookup13.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do run } +// Origin: Mark Mitchell + +int main() +{ + typedef double I; + + struct S1 { + typedef char I; + + struct S2; + }; + + struct S1::S2 { + typedef I J; + }; + + return !(sizeof (S1::S2::J) == 1); +}
lookup13.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: anon4.C =================================================================== --- anon4.C (nonexistent) +++ anon4.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do assemble } + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 20 May 1999 + +// Anon unions cannot have user defined member functions +// [class.union/2]. Make sure we spot that. + + +struct A +{ + union + { // { dg-error "" } anon union cannot have member fns + void bad(); + }; +};
anon4.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: typedef6.C =================================================================== --- typedef6.C (nonexistent) +++ typedef6.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// Submitted by Jason Merrill . +// Bug: g++ fails to see through the T typedef in the C ctor. + +struct A { + A (int) { } +}; + +typedef A T; + +struct B: public virtual T { + B (): T(1) { } +}; + +struct C: public B { + C (): T(1) { } +};
typedef6.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: goto4.C =================================================================== --- goto4.C (nonexistent) +++ goto4.C (revision 338) @@ -0,0 +1,27 @@ +// { dg-do run } +// Test that we clean up temporaries bound to references properly when +// jumping out of their scope. + +int ret = 1; + +struct A +{ + ~A() { ret = 0; } +}; + +void f() +{ + if (0) + { + out: + return; + } + const A& a = A(); + goto out; +} + +int main() +{ + f(); + return ret; +}
goto4.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: dtor6.C =================================================================== --- dtor6.C (nonexistent) +++ dtor6.C (revision 338) @@ -0,0 +1,45 @@ +// { dg-do run } +// Origin: Mark Mitchell + +extern "C" void abort (); + +int count; + +struct S +{ + S (); + S (const S&); + ~S (); + + int i; +}; + +S::S () +{ + i = count++; +} + +S::S (const S&) +{ + i = count++; +} + +S::~S () +{ + if (--count != i) + abort (); +} + +void f (S, S) +{ +} + +int main () +{ + { + S s; + f (s, s); + } + return count != 0; +} +
dtor6.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: overload4.C =================================================================== --- overload4.C (nonexistent) +++ overload4.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do link } + +void f(int* const volatile * const * const*); +void f(int* const * const * const*) {} + +int main() +{ + int*** ip; + f(&ip); +}
overload4.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: asm3.C =================================================================== --- asm3.C (nonexistent) +++ asm3.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble { target i?86-*-* x86_64-*-* } } +// { dg-options "-O2" } + +typedef unsigned long long uint64; +uint64 fstps(void) +{ + uint64 ret; + asm volatile("fstps %0" : "=m" (ret)); + return ret; +}
asm3.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: crash31.C =================================================================== --- crash31.C (nonexistent) +++ crash31.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do assemble } +// Origin: Jakub Jelinek + +namespace bar +{ +struct foo +{ + foo(); +}; // { dg-error "expected" }
crash31.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: crash14.C =================================================================== --- crash14.C (nonexistent) +++ crash14.C (revision 338) @@ -0,0 +1,22 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct S +{ +}; + +struct T : public S +{ +}; + +struct U : public T +{ +}; + +void f (U); + +int main () +{ + U u; + f (u); +}
crash14.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: inline7.C =================================================================== --- inline7.C (nonexistent) +++ inline7.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do run } +// { dg-options "-O2" } +// Origin: Mark Mitchell + +#include + +std::list li; + +void f () +{ + li.size (); +} + +int main () +{ + li.push_back (0); + f (); +}
inline7.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: pmf4.C =================================================================== --- pmf4.C (nonexistent) +++ pmf4.C (revision 338) @@ -0,0 +1,39 @@ +// { dg-do run } +// Bug: g++ doesn't compensate for finding a virtual function in a +// non-primary vtable when generating PMFs. +// Submitted by Jason Merrill + +struct A { + virtual ~A() {} +}; + +struct B { + virtual void f () = 0; +}; + +struct C : public A, public B { + void f (); +}; + +void (C::* B_f)() = &B::f; // this works +void (C::* C_f)() = &C::f; // this breaks + +C* p; + +void C::f () +{ + p = this; +} + +int main() +{ + C c; + + (c.*B_f)(); + if (p != &c) + return 1; + + (c.*C_f)(); + if (p != &c) + return 1; +}
pmf4.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: syntax4.C =================================================================== --- syntax4.C (nonexistent) +++ syntax4.C (revision 338) @@ -0,0 +1,26 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 22 June 2000 + +// Origin GNATS bug report 262 from Jeremy Sanders +// and several others. With templates, it's very easy to say something +// erroneous like +// template class X::X +// The culprit +// ... class X::X ... +// caused us to ICE as we got confused about pushing and popping scopes. + +class X { + X (); +}; + +class Y { + public: + typedef ::X W; // { dg-error "" } previous declaration + class Z; +}; + +class Y::Z {}; +class Y::W () {} // { dg-error "" } parse error +Y::W::X () {}
syntax4.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: lookup22.C =================================================================== --- lookup22.C (nonexistent) +++ lookup22.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// Origin: GerhardTonn@gmx.de + +struct super { + union { + int myName; + void* secondMember; + }; +}; + +struct sub : super { + int myName() { return 1; } +};
lookup22.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: defarg6.C =================================================================== --- defarg6.C (nonexistent) +++ defarg6.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// Origin: Gerald Pfeifer + +#include +#include + +class STACK { +public: + std::vector data; + + STACK() : data() + { } +};
defarg6.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: builtins5.C =================================================================== --- builtins5.C (nonexistent) +++ builtins5.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do assemble } +// Test that built-in functions aren't recognized without a prototype. +// Origin: Roger Sayle Mar 20, 2002 +// Copyright (C) 2002 Free Software Foundation. + +int +foo () +{ + return (int) ::strlen ("foo"); // { dg-error "" } undeclared +} + +int +bar () +{ + return (int) std::strlen ("bar"); // { dg-error "" } undeclared +}
builtins5.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: access4.C =================================================================== --- access4.C (nonexistent) +++ access4.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do assemble } + +struct A { // { dg-error "" } inaccessible + static int i; +}; + +struct B : private A { }; + +struct C : public B { + int f () { return A::i; } // { dg-error "" } context +};
access4.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: dyncast2.C =================================================================== --- dyncast2.C (nonexistent) +++ dyncast2.C (revision 338) @@ -0,0 +1,85 @@ +// { dg-do run } +// Author: Alfred Miniarik +// test of dynamic_cast +// runtime detecting of valid +// downcasts within nonpublic +// baseclasses. + +extern "C" void abort(); +extern "C" int printf (const char *, ...); + +static int errors = 0; + +void error(int i) +{ + printf("Error %i\n",i); + errors++; +} + +// 1. downcast +// 1.1 single inheritance case + +struct A {virtual ~A(){} int i;}; +struct B : A {int i;}; +struct C : B {int i;}; +struct CC : C {}; +class D : C {int i;}; + +struct E : D {int i;}; +class F : E {int i;}; + +void +test01 () +{ + D d; + if((C*)&d != dynamic_cast ((A*)&d)) error(1); + if((C*)&d != dynamic_cast ((B*)&d)) error(2); + if((B*)&d != dynamic_cast ((A*)&d)) error(3); + + E e; + if((C*)&e != dynamic_cast ((A*)&e)) error(4); + + F f; + if((C*)&f != dynamic_cast ((B*)&f)) error(5); + if((B*)&f != dynamic_cast ((A*)&f)) error(6); + if((E*)&f != dynamic_cast ((D*)&f)) error(7); + if(dynamic_cast ((C*)&f)) error(8); //counter example +} + +// 1.2 multiple inheritance case + +struct G : CC, F{}; + +void +test02 () +{ + G g; + if((B*)(F*)&g != dynamic_cast ((A*)(F*)&g)) error(9); + if(dynamic_cast ((A*)(F*)&g)) error(10); + if(dynamic_cast ((B*)(F*)&g)) error(11); +} + +// 2. crosscast (always fail) + +struct I : C{}; +struct J : F{}; +struct K : I, J{}; +class L : K{}; + +void +test03 () +{ + L l; + if(dynamic_cast ((I*)&l)) error(12); + if(dynamic_cast ((E*)&l)) error(13); + if(dynamic_cast ((J*)&l)) error(14); +} + +int +main () +{ + test01(); + test02(); + test03(); + return errors ? 1 : 0; +}
dyncast2.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: crash7.C =================================================================== --- crash7.C (nonexistent) +++ crash7.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do assemble } + +void f() +{ + union { + private: + int i; // { dg-error "" } private + } u; + + u.i = 3; // { dg-error "" } within this context +}
crash7.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: conv2.C =================================================================== --- conv2.C (nonexistent) +++ conv2.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do assemble } +// { dg-options "-pedantic-errors" } + +void cheat( int* i ) { ++(*i); } + +struct t { + void cheat( int& i ) { ++i; } +}; + +int main() +{ + void (t::*member)( const int& ) = &t::cheat; // { dg-error "" } conversion + void (*cheater)( const int* ) = &cheat; // { dg-error "" } converting + t t2; + const int i=1; + int j=1; + (t2.*member)( i ); + (t2.*member)( j ); +}
conv2.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: virtual10.C =================================================================== --- virtual10.C (nonexistent) +++ virtual10.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 14 Nov 2000 + +// We failed to spot a static member which overrode a virtual + +struct A +{ + virtual int foo (char); + static int foo (); + virtual int foo (int); // { dg-error "" } this function + static int foo (float); + virtual int foo (double); +}; + +struct B : A +{ + static int foo (int); // { dg-error "" } cannot override +};
virtual10.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: linkage5.C =================================================================== --- linkage5.C (nonexistent) +++ linkage5.C (revision 338) @@ -0,0 +1,6 @@ +// { dg-do assemble } +// Origin: Jason Merrill + +static int f (); +int f (); +static int f ();
linkage5.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: access11.C =================================================================== --- access11.C (nonexistent) +++ access11.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// { dg-options "-w" } +// Origin: r.spatschek@fz-juelich.de + +class A +{ +private: + template void g(T t) {} + int i; +}; + +template <> +void A::g(int t) { i = 1; } // { dg-error "" } private + +int main() +{ + A a; + + a.g(0); // { dg-error "" } private +}
access11.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: overcnv1.C =================================================================== --- overcnv1.C (nonexistent) +++ overcnv1.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } + +class A { +public: + void f(const char * const * ); +}; +void f(const char * const *) {} + +void g() +{ + char *ar[10]; + A a; + f(ar); + a.f(ar); +}
overcnv1.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: crash40.C =================================================================== --- crash40.C (nonexistent) +++ crash40.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do assemble } +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 11 April 2001 +// Origin: Theo Papadopoulo + +// Bug 1917. We were considering thunks to clones to be clones. and +// hence getting confused. + +struct A { virtual ~A(); }; +struct B { virtual ~B(); }; + +struct C: public A,B {}; + +template +inline TYPE +sqr(const TYPE& x) { + return 1; +} +int f(const int t) { return sqr(t); }
crash40.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: field2.C =================================================================== --- field2.C (nonexistent) +++ field2.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do run } +// Test for proper handling of field calls. +// Contributed by Jason Merrill + +struct A { + inline A* operator()() { return this; } +}; + +struct B { + int i; + union { A a; }; +}; + +int +main () +{ + B b; + A* ap = &b.a; + A* ap2 = b.a(); + return (ap != ap2); +}
field2.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: crash23.C =================================================================== --- crash23.C (nonexistent) +++ crash23.C (revision 338) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// Origin: Gerald Pfeifer + +class T; +inline void operator<(T&, T&) { } // { dg-error "" } previous definition +inline void operator<(T&, T&) { } // { dg-error "" } duplicate definition +
crash23.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: lineno2.C =================================================================== --- lineno2.C (nonexistent) +++ lineno2.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } +// Submitted by Nathan Sidwell +// Bug: g++ wasn't listing candidates for a failed conversion. + +void f(int, double); // { dg-error "" } candidate +void f(double, int); // { dg-error "" } candidate +void f(int); // { dg-error "" } candidate + +int +main () +{ + void (*ptr)(int, int); + + ptr = &f; // { dg-error "" } no match +}
lineno2.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: dtor10.C =================================================================== --- dtor10.C (nonexistent) +++ dtor10.C (revision 338) @@ -0,0 +1,41 @@ +// { dg-do run } +// Origin: Mark Mitchell + +extern "C" void abort (); + +int j; + +struct S { + static S* s[5]; + + S () { s[j++] = this; } + S (const S&) { s[j++] = this; } + ~S () { + for (int k = 0; k < j; ++k) + if (s[k] == this) + return; + abort (); + } +}; + +S* S::s[5]; + +struct T { + int i; + S s; +}; + +T t; + +T f () { + return t; +} + +void g (S) { +} + +int main () +{ + g (f ().s); +} +
dtor10.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,27 @@ +// { dg-do run } +// { dg-options "-O -fno-exceptions -w" } +// Origin: Bryan Scattergood + +extern "C" void abort(); + +class A +{ +public: + A(); + ~A(); + int foo(); +}; + +A::A() {} +A::~A() { abort (); } +int A::foo() {} + +extern int f() +{ + return 0; +} + +int main() +{ + return ((f() != 0) ? A().foo() : 0); +}
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: debug6.C =================================================================== --- debug6.C (nonexistent) +++ debug6.C (revision 338) @@ -0,0 +1,24 @@ +// { dg-do assemble } +// { dg-options "-g -O2" } + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 21 Nov 1999 + +// This causes assember relocation errors + +struct X +{ + virtual ~X () {} +}; + +struct Y +{ + Y (){}; +}; + +void foo () +{ + X *x = new X; + x->~X (); + Y ys[2]; +}
debug6.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: lookup14.C =================================================================== --- lookup14.C (nonexistent) +++ lookup14.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +union U { + typedef int I; + + struct S { + void f(); + }; +}; + +void U::S::f() { + I i; +}
lookup14.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: redecl1.C =================================================================== --- redecl1.C (nonexistent) +++ redecl1.C (revision 338) @@ -0,0 +1,6 @@ +// { dg-do assemble } +struct X{ + void i(); + void i(int); // { dg-error "" } + int i; // { dg-error "" } conflict +};
redecl1.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: anon5.C =================================================================== --- anon5.C (nonexistent) +++ anon5.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 14 Nov 2000 + +// Bug 649. A cv qualified anonymous union would cause confusion. + +struct X +{ + int fn () const + { + return member; + } + const union + { + int member; + }; +};
anon5.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: refinit1.C =================================================================== --- refinit1.C (nonexistent) +++ refinit1.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// Test that we don't allow multiple user-defined conversions in reference +// initialization. + +struct B { }; + +struct A { + A (const B&); +}; + +struct C { + operator B (); +}; + +C c; + +const A& ref (c); // { dg-error "" } requires two UDCs
refinit1.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: typedef7.C =================================================================== --- typedef7.C (nonexistent) +++ typedef7.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +typedef int I; +typedef int I; + +// DR56 makes clear that duplicate typedefs in class scopes are +// invalid. + +struct A { + typedef int I; // { dg-error "" } + typedef int I; // { dg-error "" } +}; + +template +struct S { + typedef int I; // { dg-error "" } + typedef int I; // { dg-error "" } +}; +
typedef7.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: store-expr1.C =================================================================== --- store-expr1.C (nonexistent) +++ store-expr1.C (revision 338) @@ -0,0 +1,89 @@ +// { dg-do run { target i?86-*-* x86_64-*-* } } +// { dg-require-effective-target ilp32 } +// { dg-require-effective-target fpic } +// { dg-options "-mtune=i686 -O2 -fpic" } +class G {}; + +struct N { + N *a; +}; + +struct V { + typedef N *W; + W *m, *n; + int s() const { return int(n - m); } + const W &operator[](int x) const { return *(m + x); } +}; + +struct H; + +struct J { + N *c; + H *d; + J(N *x, H *y) : c(x), d(y) {} +}; + +struct K { + const N *c; + const H *d; + K(const N *x, const H *y) : c(x), d(y) {} + K(const J &x) : c(x.c), d(x.d) {} +}; + +struct H { + V e; + int f; + + J u() + { + for (int x = 0; x < e.s(); ++x) + if (e[x]) + return J(e[x], this); + return v(); + } + J v() { return J((N*)64, this); } +}; + +struct I { + H d; + J u() { return d.u(); } + J v() { return d.v(); } +}; + +struct bar { + virtual ~bar() {} +}; + +struct E { + K g; + E(K x) : g(x) {} +}; + +struct foo : public bar { + K h; + E i; + foo(const K x, const E &y) : h(x), i(y) {} +}; + +struct A { + I *l; + foo *baz() const; +}; + +foo *A::baz() const +{ + return new foo(l->u(), E(l->v())); +} + +A x; +I i; +foo *f; + +int main () +{ + x.l = &i; + f = x.baz(); + if (f->h.c != f->i.g.c || f->h.d != f->i.g.d) + return 1; + return 0; +}
store-expr1.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: covar1.C =================================================================== --- covar1.C (nonexistent) +++ covar1.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Origin: Jason Merrill + +struct A { + virtual A& f(); +}; + +struct B: public A { + B& f(); +};
covar1.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: dtor7.C =================================================================== --- dtor7.C (nonexistent) +++ dtor7.C (revision 338) @@ -0,0 +1,43 @@ +// { dg-do run } +// { dg-options "-O2" } +// Origin: Mark Mitchell + +int i; +int j; + +struct A +{ + A (); + A (const A&); + ~A (); +}; + +A::A () +{ + ++i; +} + +A::A (const A&) +{ + ++i; +} + +A::~A () +{ + --i; +} + +A f () +{ + return A (); +} + +void g (const A&) +{ +} + +int main () +{ + g (f ()); + return i; +}
dtor7.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: ambig1.C =================================================================== --- ambig1.C (nonexistent) +++ ambig1.C (revision 338) @@ -0,0 +1,28 @@ +// { dg-do assemble } + +struct A { + int operator ++(); // { dg-error "" } candidates + void operator ()(); // { dg-error "" } candidates + void operator delete(void*); // { dg-error "" } candidates +}; + +struct B { + int operator ++(int); // { dg-error "" } candidates + void operator ()(); // { dg-error "" } candidates + void operator delete(void*); // { dg-error "" } candidates + void f(); +}; + +struct C : public A, public B { +}; + +void f() +{ + C c; + C* cp; + + delete cp; // { dg-error "" } ambiguous + c(); // { dg-error "" } ambiguous + c++; // { dg-error "" } ambiguous +} +
ambig1.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: overload5.C =================================================================== --- overload5.C (nonexistent) +++ overload5.C (revision 338) @@ -0,0 +1,22 @@ +// { dg-do link } + +struct S {}; + +struct T : public S {}; + +struct U : public T {}; + +void f(int T::*) {} +void f(int U::*); + +void g(void (T::*)(int)) {} +void g(void (U::*)(int)); + +int main() +{ + int S::*ip; + void (S::*fp)(int); + + f(ip); + g(fp); +}
overload5.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: crash32.C =================================================================== --- crash32.C (nonexistent) +++ crash32.C (revision 338) @@ -0,0 +1,29 @@ +// { dg-do assemble } +// Origin: Jakub Jelinek + +struct foo +{ + enum e + { + not // { dg-error "" } + }; // { dg-bogus "" } + ~foo(); // { dg-bogus "" "" { xfail *-*-* } } + void x (foo *&a, bool b = (unsigned char)0); +}; // { dg-bogus "" "" { xfail *-*-* } } + +namespace N +{ + struct bar; + + template + struct baz + { + baz(T *p); + }; + + typedef baz c; +} + +{ + int a; +};
crash32.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: crash15.C =================================================================== --- crash15.C (nonexistent) +++ crash15.C (revision 338) @@ -0,0 +1,43 @@ +// { dg-do assemble } +// { dg-options "-O2" } +// g++ crashed because we unsaved the TARGET_EXPR for the return value +// for get_allocator without first expanding it, because it was part of the +// cleanup for the temporary string. + +// Derived from libstdc++ v3 code. + + +class AA {}; + +void fee (const AA&); + +class basic_string +{ +public: + basic_string(const char*); + + ~basic_string() + { fee (this->get_allocator()); } + + AA get_allocator(); +}; + +class failure +{ +public: + failure(const basic_string& __str); +}; + +class foo +{ +public: + foo(int x) + { + throw failure (""); + } +}; + +void test05() +{ + foo ofs(0); +}
crash15.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: inline8.C =================================================================== --- inline8.C (nonexistent) +++ inline8.C (revision 338) @@ -0,0 +1,69 @@ +// { dg-do run } +// { dg-options "-O1" } +// Origin: Gerald Pfeifer + +#include +#include +#include + +using namespace std; + +class NAMES_ITEM + { +public: + char *name; + + NAMES_ITEM(const NAMES_ITEM& item2); + + NAMES_ITEM(const char* name2); + + ~NAMES_ITEM(); + + bool operator==(const NAMES_ITEM& n) const; + }; + + +NAMES_ITEM::NAMES_ITEM (const NAMES_ITEM& item2) + { + size_t length=std::strlen(item2.name); + + name=new char[length+1]; + std::memcpy(name,item2.name,length+1); + } + +NAMES_ITEM::NAMES_ITEM (const char* name2) + { + size_t length=std::strlen(name2); + + name=new char[length+1]; + std::memcpy(name,name2,length+1); + } + +NAMES_ITEM::~NAMES_ITEM () +{ + if (std::strcmp (name, "one") != 0) + abort (); + + name=0; +} + +bool NAMES_ITEM::operator==(const NAMES_ITEM& n) const +{ + return (std::strcmp(name,n.name) == 0); +} + +bool operator<(const NAMES_ITEM& n1, const NAMES_ITEM& n2) + { + return (std::strcmp(n1.name,n2.name) < 0); + } + + typedef map > lookup_t; + + lookup_t lookup; + + NAMES_ITEM item ("one"); +main() + { + lookup.insert(pair(item,0)); + } +
inline8.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: pmf5.C =================================================================== --- pmf5.C (nonexistent) +++ pmf5.C (revision 338) @@ -0,0 +1,39 @@ +// { dg-do run } +// Bug: g++ expanded b->member() multiple times, causing the optimizer to +// decide that things weren't related and optimize 'die' into an infinite +// loop. + +struct A { + virtual ~A() { } + void f (bool) { } +}; + +typedef void (A::*pmf_void)(); +typedef void (A::*pmf_bool)(bool); + +struct B { + ~B() {} + pmf_void member() const { return mbr; } + pmf_void mbr; +}; + +A *a; +B *b; + +void die (bool param) { + pmf_bool pmf = (pmf_bool)(b->member()); + (a->*pmf)(param); +} + +int main () +{ + A a2; + B b2; + + b2.mbr = reinterpret_cast(&A::f); + + a = &a2; + b = &b2; + + die (true); +}
pmf5.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: lookup23.C =================================================================== --- lookup23.C (nonexistent) +++ lookup23.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// Test for proper handling of type lookup if base class has field with the +// same name as the containing class. + +struct a { int a; }; +struct b : a {}; + +b x; + +void foo () +{ + x.a = 22; +}
lookup23.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: typeinfo1.C =================================================================== --- typeinfo1.C (nonexistent) +++ typeinfo1.C (revision 338) @@ -0,0 +1,15 @@ +// { dg-do assemble } + +#include + +struct S { + S (const char*); +}; + +void f(S s); +void f(std::type_info); + +void g() +{ + f("abc"); +}
typeinfo1.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: defarg7.C =================================================================== --- defarg7.C (nonexistent) +++ defarg7.C (revision 338) @@ -0,0 +1,44 @@ +// { dg-do assemble } + +// Copyright (C) 2000, 2002 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 7 Jan 2001 + +// As of G++ 3.4, we no longer attempt to detect dependencies; the +// standard does not require that we do. + +// Bug 1038. Default args on class members can produce circular dependencies. +// Make sure we spot them, and don't depend on a particular ordering. + +struct A +{ + static int Foo (int = Baz ()); // { dg-error "" } + static int Baz (int = Foo ()); +}; + +struct Test +{ + Test (void * = 0); + void set (const Test &arg = Test ()); +}; + +struct B +{ + static int Bar (int = Foo (1)); + static int Foo (int = Baz ()); // { dg-error "" } + static int Baz (int = Foo (1)); +}; + +int main () +{ + Test t; + t.set (); + t.set (t); + B::Bar (); + B::Bar (1); + B::Baz (); + B::Baz (1); + B::Foo (); + B::Foo (1); + + return 0; +}
defarg7.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: builtins6.C =================================================================== --- builtins6.C (nonexistent) +++ builtins6.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do run } +// { dg-options "-O2" } +// Test that built-in functions are recognized with a prototype. +// Origin: Roger Sayle Mar 20, 2002 +// Copyright (C) 2002 Free Software Foundation. +// + +typedef __SIZE_TYPE__ size_t; +extern "C" size_t strlen (const char*); +extern "C" void link_error (void); + +int +main () +{ + if (strlen ("foo") != 3) + link_error (); + return 0; +} +
builtins6.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,15 @@ +// { dg-do assemble } + +class x +{ +public: + virtual int is_constant(); +}; + +void foo() +{ + x* y; + if (y->is_constant) // { dg-error "" } assuming & + { + } +}
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: access5.C =================================================================== --- access5.C (nonexistent) +++ access5.C (revision 338) @@ -0,0 +1,22 @@ +// { dg-do assemble } + +class A +{ +protected: + int i; +}; + +class B : private A +{ +protected: + A::i; +}; + +struct C : public B { + friend int f(C *p); +}; + +int f(C *p) { + return p->i; +} +
access5.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: dyncast3.C =================================================================== --- dyncast3.C (nonexistent) +++ dyncast3.C (revision 338) @@ -0,0 +1,33 @@ +// { dg-do run } +// Author: Alfred Miniarik +// test of dynamic_cast +// runtime detecting of nonpublic +// inheritance within a cast +// and therefor failing with result 0. + +extern "C" void abort(); +extern "C" int printf (const char *, ...); + +static int errors = 0; + +void error(int i) +{ + printf("Error %i\n",i); + errors++; +} + +struct A {virtual ~A(){}}; +struct B : private virtual A {}; +struct C : virtual A {}; +struct D : B, C {}; + +int +main() +{ + D d; + A* ap= &d; + if(&d != dynamic_cast(ap)) error(1); + if((B*)&d != dynamic_cast(ap)) error(2); + if((C*)&d != dynamic_cast(ap)) error(3); + return errors ? 1 : 0; +}
dyncast3.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: crash8.C =================================================================== --- crash8.C (nonexistent) +++ crash8.C (revision 338) @@ -0,0 +1,10 @@ +// { dg-do assemble } +// Origin: Jason Merrill + +int main() +{ + void f(); + class A { + friend void f(); + }; +}
crash8.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: conv3.C =================================================================== --- conv3.C (nonexistent) +++ conv3.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } + +// submitted by David C Binderman + +typedef const int ci; +typedef ci aci[ 10]; +aci var = { 2, 3, 5, 7, 11, 13 }; + +void +f() +{ + int * ip = var; // { dg-error "" } requires const_cast +}
conv3.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: virtual11.C =================================================================== --- virtual11.C (nonexistent) +++ virtual11.C (revision 338) @@ -0,0 +1,31 @@ +// { dg-do assemble } + +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 14 Nov 2000 + +// We failed to check virtual functions hidden by using declarations. + +struct A +{ + virtual int foo (); +}; + +struct B +{ + virtual void foo (); // { dg-error "" } of this function +}; + +struct C : A , B +{ +}; + +struct D : C +{ + void foo (short); + using A::foo; +}; + +struct E : D +{ + virtual int foo (); // { dg-error "" } invalid override +};
virtual11.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: externC1.C =================================================================== --- externC1.C (nonexistent) +++ externC1.C (revision 338) @@ -0,0 +1,22 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +extern "C" +{ + struct T + { + ~T (); + }; + + struct S + { + T t; + }; +} + +S* s; + +void f () +{ + delete s; +}
externC1.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: comdat4-aux.cc =================================================================== --- comdat4-aux.cc (nonexistent) +++ comdat4-aux.cc (revision 338) @@ -0,0 +1,40 @@ +extern void +bar (int x); + +inline void +foo (int i) +{ + switch (i) + { + case 3: + case 5: + case 6: + case 9: + case 15: + bar (1); + break; + case 2: + case 4: + case 7: + case 10: + case 11: + case 12: + bar (2); + break; + case 0: + case 1: + case 8: + case 13: + case 16: + bar (3); + break; + case 14: + bar (4); + break; + default: + bar (5); + break; + } +} + +void *fooaddr2 = (void *) foo; Index: volatile1.C =================================================================== --- volatile1.C (nonexistent) +++ volatile1.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// Test that failed lvalue-to-rvalue conversion of vf doesn't crash the +// compiler. + +class f_class +{ }; // { dg-message "candidates" "candidates" } +// { dg-message "note" "note" { target *-*-* } 6 } + +volatile f_class +ret_v_f_class() +{ + f_class t; + return t; +} + +int main(void) +{ + volatile f_class vf; + 0 ? ret_v_f_class() : vf; // { dg-error "match" } can't copy volatile lvalue + return 0; +}
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: linkage6.C =================================================================== --- linkage6.C (nonexistent) +++ linkage6.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// { dg-options "-fno-weak" } +// Origin: Mark Mitchell + +template +void f (); + +void h () { f (); } + +template +void g () {} + +template +void f () +{ + g<&f >(); +} +
linkage6.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: rtti1.C =================================================================== --- rtti1.C (nonexistent) +++ rtti1.C (revision 338) @@ -0,0 +1,122 @@ +// { dg-do run } +// { dg-options "-frtti" } +// test of rtti of non-class types + +#include + +extern "C" { + int printf(const char *, ...); + void exit(int); +} + +int i; +short s; +char c; +long l; + +unsigned int ui; +unsigned short us; +unsigned char uc; +unsigned long ul; + +float f; +double d; + +int& ri = i; +const volatile int cvi = 10; +volatile const int vci = 20; +const int ci = 100; + +int *pi; +int ai[10]; + +enum color { red, blue, green, yellow}; + +int (*fp)(); +int (*gp)(); +int (*hp)(int); + +class XX { +public: + int xxi; + float xxf; + int xxf1 () { return 0; }; + int xxf2 (int k) { return 0; }; +}; + +class YY { +public: + int yyi; + double yyd; + int yyf1 (float f) { return 0; }; + double yyf2 () {return yyd;}; +}; + +int XX::*ptmd1; +int XX::*ptmd2; +float XX::*ptmd3; +int YY::*ptmd4; + +int (XX::*ptmf1) (); +int (XX::*ptmf2) (); +int (XX::*ptmf3) (int); +int (YY::*ptmf4) (); + +int func1 () +{ return 0;} + +int func2 () +{ return 1;} + +int func3 (int i) +{ return i;} + +short func4 () +{ return 99;} + +void error (int i) +{ + exit(i); +} + +int main () +{ + if (typeid(i) != typeid(int)) error(1); + if (typeid(s) != typeid(short)) error(2); + if (typeid(c) != typeid(char)) error(3); + if (typeid(l) != typeid(long)) error(4); + if (typeid(ui) != typeid(unsigned int)) error(5); + if (typeid(us) != typeid(unsigned short)) error(6); + if (typeid(uc) != typeid(unsigned char)) error(7); + if (typeid(ul) != typeid(unsigned long)) error(8); + if (typeid(f) != typeid(float)) error(9); + if (typeid(d) != typeid(double)) error(10); + + if (typeid(*pi) != typeid(int)) error(51); + if (typeid(pi) == typeid(ai)) error(52); + if (typeid(ri) != typeid(i)) error(53); + if (typeid(cvi) != typeid(vci)) error (54); + if (typeid(vci) != typeid(i)) error(55); + if (typeid(ci) != typeid(cvi)) error (56); + if (typeid(ci) != typeid(const int)) error(57); + + if (typeid(func1) != typeid(func2)) error (81); + if (typeid(func2) == typeid(func3)) error (82); + if (typeid(func1) == typeid(func4)) error (83); + if (typeid(func3) == typeid(func4)) error (84); + + if (typeid(red) != typeid(color)) error (101); + if (typeid(green) != typeid(blue)) error (102); + + if (typeid(fp) != typeid(gp)) error (103); + if (typeid(gp) == typeid(hp)) error (104); + + if (typeid(ptmd1) != typeid(ptmd2)) error (105); + if (typeid(ptmd1) == typeid(ptmd3)) error (106); + if (typeid(ptmd2) == typeid(ptmd4)) error (107); + + if (typeid(ptmf1) != typeid(ptmf2)) error (108); + if (typeid(ptmf2) == typeid(ptmf3)) error (109); + if (typeid(ptmf1) == typeid(ptmf4)) error (110); + return 0; +}
rtti1.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: overcnv2.C =================================================================== --- overcnv2.C (nonexistent) +++ overcnv2.C (revision 338) @@ -0,0 +1,27 @@ +// { dg-do assemble } +// { dg-options "-Wconversion" } +// Test that we resolve this case as mandated by the standard, but also +// warn about it. We choose op char* not because it is a member of B -- +// the standard says that all conversion ops are treated as coming from +// the type of the argument -- but because it is non-const. + +struct A { + operator const char *() const { return ""; } +}; + +struct B : public A { + operator char *() { return 0; } +}; + +int main() +{ + B b; + if ((const char *)b != 0) // { dg-warning "choosing 'B" "B" } surprising overload resolution + // { dg-warning "for conversion" "conv" { target *-*-* } 19 } + // { dg-message "note" "note" { target *-*-* } 19 } + return 1; + if ((const char *)(const B)b == 0) + return 2; + if ((const char *)(const B &)b == 0) + return 3; +}
overcnv2.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: crash41.C =================================================================== --- crash41.C (nonexistent) +++ crash41.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 8 May 2001 + +// Bug 2744. We ICE'd on strange characters + +@ // { dg-error "" } parse error +int a; #// { dg-error "" } parse error +## // { dg-error "" } parse error +$ // { dg-error "" } parse error +£ // { dg-error "" } parse error +` // { dg-error "" } parse error
crash41.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: crash24.C =================================================================== --- crash24.C (nonexistent) +++ crash24.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// Origin: Jakub Jelinek + +class foo { + public: + class __iterator; + friend class __iterator; + typedef __iterator const_iterator; + virtual ~foo() { } + __iterator begin(); // { dg-message "candidate is" } +}; +static void iteratorTest(const foo &x) +{ + foo::const_iterator i = x.begin(); // { dg-error "incomplete type" "incomplete type" } + // { dg-error "no matching" "no matching" { target *-*-* } 14 } + for (; i; ++i) + *i; +}
crash24.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: lineno3.C =================================================================== --- lineno3.C (nonexistent) +++ lineno3.C (revision 338) @@ -0,0 +1,29 @@ +// { dg-do assemble } +// Bug: g++ gets confused by the #line directive within a method. +// Contributed by Mark Mitchell + +struct S +{ + void f () + { + int i; + + + + + + + + + + + + + + + + + + int j; + } +};
lineno3.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: dtor11.C =================================================================== --- dtor11.C (nonexistent) +++ dtor11.C (revision 338) @@ -0,0 +1,35 @@ +// { dg-do run } +// Origin: Mark Mitchell + +extern "C" void abort (); + +int j; + +struct S { + S () { ++j; } + S (const S&) { ++j; } + ~S () { + if (--j < 0) + abort (); + } +}; + +struct T { + void g (S) { + } +}; + +struct U { + int i; + S s; +}; + +U u; + +U f () { return u; } + +int main () +{ + T t; + t.g (f ().s); +}
dtor11.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: debug7.C =================================================================== --- debug7.C (nonexistent) +++ debug7.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do link } +// { dg-options "-g -O2" } +// Origin: Loren James Rittle + +namespace std { + const int __stl_chunk_size = 7; +} + +int main () +{ +}
debug7.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: lookup15.C =================================================================== --- lookup15.C (nonexistent) +++ lookup15.C (revision 338) @@ -0,0 +1,37 @@ +// { dg-do assemble } +// Origin: Benjamin Kosnik + +class b +{ + int j; +public: + b(int a = 6): j(a) {} + void imbue(int a) {++j;} +}; + +class d: public b +{ + int k; +public: + d(int a = 7): b(a), k(a) {} + void imbue(int a) {++k;} +}; + +//virtual public kills, public ok +class mostd: virtual public d +{ + int l; +public: + mostd(int a = 9): d(a), l(a) {} +}; + +int main() { + + d dobj; + dobj.imbue(5); + + mostd mobj; + mobj.imbue(5); + + return 0; +}
lookup15.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: redecl2.C =================================================================== --- redecl2.C (nonexistent) +++ redecl2.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do assemble } + +struct S { + S(int); // { dg-error "with" } + S(int); // { dg-error "overloaded" } already declared + + ~S();// { dg-error "with" } + ~S(); // { dg-error "overloaded" } already declared +};
redecl2.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: typeck1.C =================================================================== --- typeck1.C (nonexistent) +++ typeck1.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } + +extern int a[][]; // { dg-error "" } invalid multidimensional array +extern int b[7][]; // { dg-error "" } invalid multidimensional array +extern int c[][7]; // OK + +extern int (*i)[]; // { dg-error "" } previous declaration +extern int (*i)[7]; // { dg-error "" } conflicting types for `i' + +extern int m[]; +extern int m[7]; // OK + +void f(int (*j)[3]) +{ + extern int (*k)[]; + f(k); // { dg-error "" } passing wrong type +}
typeck1.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: anon6.C =================================================================== --- anon6.C (nonexistent) +++ anon6.C (revision 338) @@ -0,0 +1,37 @@ +// { dg-do run } +extern "C" void abort (); + +struct A { + union { + int a; + double b; + int d; + }; + int c; +}; + +struct B : public A { + union { + double a; + void *c; + }; + float b; + int e; +}; + +int main () +{ + struct B b; + + b.a = 1.5; + b.b = 2.5; + b.d = 1; + b.e = 2; + if (b.a != 1.5 || b.b != 2.5 || b.d != 1 || b.e != 2) + abort (); + b.c = &b.a; + b.d = b.e; + if (b.c != &b.a || b.d != 2) + abort (); + return 0; +}
anon6.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: refinit2.C =================================================================== --- refinit2.C (nonexistent) +++ refinit2.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do assemble } +// +// Copyright (C) 2000, 2002 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 10 Aug 2000 + +// bug 381. We gave slightly different diagnostics, when binding an rvalue to +// a non-const reference, depending on the precise type to the rvalue. + +namespace A { +template void f(T) {} +} +void (* &h)(int) = A::f; // { dg-error "" } rvalue to non-const +void (*const volatile &i)(int) = A::f; // { dg-error "" } rvalue to volatile +void (*const &j)(int) = A::f; + +int &k = 1; // { dg-error "" } rvalue to non-const +int &const volatile l = 1; // { dg-error "" } rvalue to volatile +int const &m = 1;
refinit2.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: init1.C =================================================================== --- init1.C (nonexistent) +++ init1.C (revision 338) @@ -0,0 +1,11 @@ +// { dg-do run } +extern "C" void abort(); + +int i; +int j = i++; + +int main() +{ + if (i != 1) + abort(); +}
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: reload1.C =================================================================== --- reload1.C (nonexistent) +++ reload1.C (revision 338) @@ -0,0 +1,47 @@ +// { dg-do run } +extern "C" void abort (); + +struct A { + unsigned long long u; +} *a; + +struct B { + unsigned long long v; + unsigned long long w () + { + return a->u - v; + } +} b; + +struct C { + static unsigned long long x; + static void y (unsigned long long z); +}; + +unsigned long long C::x = 0; + +int main () +{ + a = new A; + b.v = 333418; + a->u = 1132270; + C::x = 0; + C::y (799016); +} + +void foo (unsigned long long a, unsigned long long b, unsigned long long c) +{ +} + +void C::y (unsigned long long z) +{ + unsigned long long c = b.w () - x; + if (z < b.w ()) + { + if ((long long) c < 0) + { + foo (b.w (), a->u, b.v); + abort (); + } + } +}
reload1.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: static10.C =================================================================== --- static10.C (nonexistent) +++ static10.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } +// { dg-options "-w" } +// Origin: Ulrich Drepper + +struct st +{ + int a; +}; + +int +foo (int a) +{ + static const st i = { 0 }; + + if (i.a == a) + return 0; +}
static10.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: typedef8.C =================================================================== --- typedef8.C (nonexistent) +++ typedef8.C (revision 338) @@ -0,0 +1,26 @@ +// { dg-do assemble } +// +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 17 Aug 2000 + +// bug 39. We'd generated bogus errors when using a typedef of a nested class. + +struct X1 +{ + typedef struct { + } MyStruct1; + typedef struct M2 { + } MyStruct2; +}; + +X1::MyStruct1 foo() +{ +X1::MyStruct1 m1; +return m1; +} + +X1::MyStruct2 baz() +{ +X1::MyStruct2 m1; +return m1; +}
typedef8.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: badopt1.C =================================================================== --- badopt1.C (nonexistent) +++ badopt1.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do run } +// { dg-options "-O2" } +// Based on a testcase by Bryan Weston +// egcs 1.1 fails to increment count + + +struct Base { Base() {} }; // removing the constructor fixes the problem +struct Derived : Base {}; // so does removing the base class + +int main() { + int count = 0; + Derived* array[1]; // making this Base*[1] does not fix the problem + array[count++] = new Derived (); // but then new Base() does + if (count!=1) + return 1; +}
badopt1.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: store-expr2.C =================================================================== --- store-expr2.C (nonexistent) +++ store-expr2.C (revision 338) @@ -0,0 +1,88 @@ +// { dg-do run { target i?86-*-* x86_64-*-*} } +// { dg-require-effective-target ilp32 } +// { dg-options "-mtune=i686 -O2" } +class G {}; + +struct N { + N *a; +}; + +struct V { + typedef N *W; + W *m, *n; + int s() const { return int(n - m); } + const W &operator[](int x) const { return *(m + x); } +}; + +struct H; + +struct J { + N *c; + H *d; + J(N *x, H *y) : c(x), d(y) {} +}; + +struct K { + const N *c; + const H *d; + K(const N *x, const H *y) : c(x), d(y) {} + K(const J &x) : c(x.c), d(x.d) {} +}; + +struct H { + V e; + int f; + + J u() + { + for (int x = 0; x < e.s(); ++x) + if (e[x]) + return J(e[x], this); + return v(); + } + J v() { return J((N*)64, this); } +}; + +struct I { + H d; + J u() { return d.u(); } + J v() { return d.v(); } +}; + +struct bar { + virtual ~bar() {} +}; + +struct E { + K g; + E(K x) : g(x) {} +}; + +struct foo : public bar { + K h; + E i; + foo(const K x, const E &y) : h(x), i(y) {} +}; + +struct A { + I *l; + foo *baz() const; +}; + +foo *A::baz() const +{ + return new foo(l->u(), E(l->v())); +} + +A x; +I i; +foo *f; + +int main () +{ + x.l = &i; + f = x.baz(); + if (f->h.c != f->i.g.c || f->h.d != f->i.g.d) + return 1; + return 0; +}
store-expr2.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,10 @@ +// { dg-do assemble } + +int f(); + +void g() +{ + const int& i = f(); // OK + int& j = f(); // { dg-error "" } initialization of non-const reference + const volatile int& k = f(); // { dg-error "" } initialization of volatile ref +}
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: dtor8.C =================================================================== --- dtor8.C (nonexistent) +++ dtor8.C (revision 338) @@ -0,0 +1,39 @@ +// { dg-do run } +// { dg-options "-O1" } +// Origin: Mark Mitchell + +int result; + +struct S +{ + S (); + S (const S&); + ~S (); + + int i; + double d[18]; +}; + +S* s; + +S::S () +{ + s = this; +} + +S::~S () +{ + if (s != this) + result = 1; +} + +inline S f () +{ + return S (); +} + +int main () +{ + f (); + return result; +}
dtor8.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: ambig2.C =================================================================== --- ambig2.C (nonexistent) +++ ambig2.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// Copyright (C) 1999, 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 29 Aug 1999 + +// We should spot all ambiguities + +struct A {int m;}; +struct B : A { int m; }; +struct C : A { int m; }; +struct D0 : virtual B, virtual C { int m; }; +struct D1 : virtual B, C { int m; }; +struct D2 : B, virtual C { int m; }; +struct D3 : B, C { int m; }; + +void fn(D0 *d0, D1 *d1, D2 *d2, D3 *d3) +{ + A *a0 = d0; // { dg-error "" } A is an ambiguous base + A *a1 = d1; // { dg-error "" } A is an ambiguous base + A *a2 = d2; // { dg-error "" } A is an ambiguous base + A *a3 = d3; // { dg-error "" } A is an ambiguous base +}
ambig2.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: overload6.C =================================================================== --- overload6.C (nonexistent) +++ overload6.C (revision 338) @@ -0,0 +1,19 @@ +// { dg-do run } +extern "C" void abort(); + +struct S1 +{ + int f() { return 0; } + int f() const { return 1; } +}; + +struct S2 : public S1 +{ +}; + +int main() +{ + S2 s2; + if (s2.f() != 0) + abort (); +}
overload6.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: crash33.C =================================================================== --- crash33.C (nonexistent) +++ crash33.C (revision 338) @@ -0,0 +1,13 @@ +// { dg-do assemble } +// Origin: Jakub Jelinek + +template +inline const T& bar(const T& a, const T& b) +{ + return a < b ? b : a; +} + +int foo(void) +{ + return bar(sizeof(int), sizeof(long)); +}
crash33.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: deref1.C =================================================================== --- deref1.C (nonexistent) +++ deref1.C (revision 338) @@ -0,0 +1,14 @@ +// { dg-do assemble } +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 1 Sep 1999 + +// [expr.unary.op]/1 says you can dereference all pointers except for pointers +// to cv void. + +void fn (void *vp, volatile void *vvp) +{ + *vp; // { dg-error "" } not a pointer to object + *vvp; // { dg-error "" } not a pointer to object + &*vp; // { dg-error "" } not a pointer to object + &*vvp; // { dg-error "" } not a pointer to object +}
deref1.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: inline9.C =================================================================== --- inline9.C (nonexistent) +++ inline9.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// { dg-options "-O2" } +// Origin: Mark Mitchell + +inline void f () +{ + int n; + int i[n]; +} + +void g () +{ + f (); +} + +void h () +{ + f (); +} +
inline9.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: crash16.C =================================================================== --- crash16.C (nonexistent) +++ crash16.C (revision 338) @@ -0,0 +1,20 @@ +// { dg-do assemble } +// { dg-options "-O2" } +// Origin: scott snyder + + +void _S_initialize(); + +class locale +{ +public: + locale() throw() + { _S_initialize (); } +}; + +void foo(const locale& __loc); + +void print (const int&) +{ + foo(locale()); +}
crash16.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: exprstmt1.C =================================================================== --- exprstmt1.C (nonexistent) +++ exprstmt1.C (revision 338) @@ -0,0 +1,26 @@ +// { dg-do run } +// { dg-options "-O" } +// { dg-error "limited range of data type" "16-bit target" { target xstormy16-*-* } 0 } +// { dg-error "shift count >=" "16-bit target" { target xstormy16-*-* } 0 } + +int main() +{ + unsigned int x = 1381237248; + + if (sizeof (x) != 4) + return 0; + + x = + ({ + unsigned int y = x; + ({ + unsigned int z = y; + (unsigned int) + ((((unsigned int)z & (unsigned int)0x000000ffUL) << 24) + | (((unsigned int)z & (unsigned int)0x0000ff00UL) << 8) + | (((unsigned int)z & (unsigned int)0x00ff0000UL) >> 8) + | (((unsigned int)z & (unsigned int)0xff000000UL) >> 24)); + }); + }); + return x != 152658; +}
exprstmt1.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: pmf6.C =================================================================== --- pmf6.C (nonexistent) +++ pmf6.C (revision 338) @@ -0,0 +1,27 @@ +// { dg-do run } +// Test that we only call f once and that pointers to different subobjects +// compare as different. + +struct A { void f() { } }; +struct B: public A { }; +struct C: public A { }; +struct D : public B, public C { }; + +typedef void (B::*bp)(); +typedef void (C::*cp)(); +typedef void (D::*dp)(); + +dp d1; + +int call; + +dp f () { ++call; return d1; } + +int main() +{ + bp b = &A::f; + cp c = &A::f; + d1 = b; + dp d2 = c; + return (f() == d2 || call != 1); +}
pmf6.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: builtins7.C =================================================================== --- builtins7.C (nonexistent) +++ builtins7.C (revision 338) @@ -0,0 +1,21 @@ +// { dg-do run } +// { dg-options "-O2" } +// Test that built-in functions are recognized with a prototype. +// Origin: Roger Sayle Mar 20, 2002 +// Copyright (C) 2002 Free Software Foundation. +// + +extern "C" void link_error (void); + +namespace std { +typedef __SIZE_TYPE__ size_t; +extern "C" size_t strlen (const char*); +} + +int +main () +{ + if (std::strlen ("foo") != 3) + link_error (); + return 0; +}
builtins7.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: defarg8.C =================================================================== --- defarg8.C (nonexistent) +++ defarg8.C (revision 338) @@ -0,0 +1,27 @@ +// { dg-do assemble } +// { dg-options "-pedantic-errors -ansi -w" } + +// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 7 Jan 2001 + +// As of G++ 3.4, we no longer attempt to detect dependencies; the +// standard does not require that we do. + +// Bug 1038. Default args on class members can produce circular dependencies. +// Make sure we spot them, and don't depend on a particular ordering. + +struct AA +{ + static int Foo (int = Baz ()); // { dg-error "" } not yet been parsed + static int Baz (int = Foo ()); +}; + +int main () +{ + AA::Foo (); + AA::Foo (1); + AA::Baz (); + AA::Baz (1); + + return 0; +}
defarg8.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,16 @@ +// { dg-do assemble } +class cow { +public: + void moo (char *); +}; + +void f() +{ + cow* c; + + void (cow::*fp0)(char*) = &cow::moo; // OK + void (cow::*fp1)(int) = &cow::moo; // { dg-error "" } conversion + int (cow::*fp2)(char*) = &cow::moo; // { dg-error "" } conversion + int (cow::*fp3)(char*, void*) = fp2; // { dg-error "" } conversion + int (cow::*fp4)(double) = (int (cow::*)(double)) fp2; // OK +}
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: access6.C =================================================================== --- access6.C (nonexistent) +++ access6.C (revision 338) @@ -0,0 +1,17 @@ +// { dg-do assemble } + +template +struct S { + void g(); +}; + +class C { + static const int i = 3; // { dg-bogus "" } private +public: + S* f(); // { dg-bogus "" } redeclared +}; + +S* C::f() { // { dg-bogus "" } private + return 0; +} +
access6.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: conv4.C =================================================================== --- conv4.C (nonexistent) +++ conv4.C (revision 338) @@ -0,0 +1,18 @@ +// { dg-do run } +// Testcase for proper hiding of base conversion ops. + +struct A +{ + operator const char *(); +}; + +struct B : public A +{ + operator const char *() { return 0; } +}; + +int main( void ) +{ + B b; + const char *p = b; +}
conv4.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: crash9.C =================================================================== --- crash9.C (nonexistent) +++ crash9.C (revision 338) @@ -0,0 +1,9 @@ +// { dg-do assemble } +// Origin: Jason Merrill + +struct A { }; +struct B : public A +{ + int A; +}; +struct C : public B { };
crash9.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: dyncast4.C =================================================================== --- dyncast4.C (nonexistent) +++ dyncast4.C (revision 338) @@ -0,0 +1,28 @@ +// { dg-do run } +// Author: Alfred Miniarik + +// Even in a derived class, a private base cannot be dynamically downcasted +// from. + +extern "C" void abort(); + +struct A { + virtual ~A () {} +}; + +struct B : private A { + B* a2b (A* objp) + { + return dynamic_cast (objp); + } +}; + +int +main () +{ + B b; + A* aptr = (A*) &b; + if (dynamic_cast (aptr)) abort (); + if (b.a2b (aptr)) abort(); + return 0; +}
dyncast4.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: externC2.C =================================================================== --- externC2.C (nonexistent) +++ externC2.C (revision 338) @@ -0,0 +1,16 @@ +// { dg-do assemble } +// Origin: Boris Zentner + +extern "C" +{ +struct xx +{ + int x; + xx(); +}; + +xx::xx() +{ + x = 0; +} +}
externC2.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.