Commit 44957663 by Jason Merrill

fix implicit int

From-SVN: r23760
parent ff0cf464
......@@ -19,7 +19,7 @@ void blah (const T &) {
x (4);
};
main () {
int main () {
const foo<int> v;
blah (v);
}
......
......@@ -14,7 +14,7 @@ public:
char* m1 () { C::m1(); return ""; } // ERROR -
};
main () {
int main () {
A a;
B b;
C c;
......
......@@ -36,6 +36,7 @@ void C::f() {
}
B b(3);
int
main() {
A *z = &b; // ERROR -
}
......@@ -43,6 +43,7 @@ public:
ExchangeableList i_theWatchList; // Instruments being monitored
};
int
main()
{
}
......@@ -14,6 +14,7 @@ class B {
A w;
};
int
main() {
B<int> c;
return c.f();
......
......@@ -3,6 +3,7 @@
// GROUPS passed ARM-compliance
// ARM $5.7, it's illegal to do math on a `void*'.
int
main()
{
void *p;
......
......@@ -5,7 +5,7 @@
int i:8;
} s;
main()
int main()
{
int &ir = s.i; // ERROR - address of bitfield
int *ip = &s.i; // ERROR - address of bitfield
......
// Build don't link:
// GROUPS passed boolean
int
main()
{
typedef char Boolean; // Instrinsic.h
......
......@@ -8,7 +8,7 @@ public:
operator int () { return 0; }
};
int
main ()
{
C c1 (1);
......
......@@ -64,7 +64,7 @@ void foo(Compound a)
die (5);
}
int
main()
{
Compound a;
......
......@@ -48,6 +48,7 @@ public:
void Foo(B b) { b.Bar(); }
int
main()
{
B b;
......
......@@ -58,6 +58,7 @@ public:
int operator != (const BaseClass irv, int x) { return irv.i != x; }
int
main ()
{
DerivedClass a;
......
......@@ -19,6 +19,7 @@ public:
A(const B &) { printf ("FAIL\n"); exit (1); }
};
int
main()
{
A a;
......
......@@ -27,6 +27,7 @@ public:
ParseToken () { tok = 0; intval = 0;}
};
int
main () {
ParseToken a;
a.tok = T_Float;
......
......@@ -18,6 +18,7 @@ class B : public A {
friend virtual void f2() { printf("i=%d j=%d\n",i,j); }// ERROR - virtual.*// ERROR - member.*// ERROR - member.*
};
int
main() {
A * a = new A;
}
......@@ -32,4 +32,5 @@ gen_op Spul_U_axis()
U1 = Fe();
}; // ERROR - reaches end of non-void function
int
main () {};
......@@ -11,6 +11,7 @@ public:
int get_i() {return i;}
};
int
main()
{
cl ob[3] = {1, 2, 3};
......
......@@ -12,6 +12,7 @@ class B : public A {
virtual ~B() {cout << "executed ~B()\n";};
};
int
main() {
cout << "starting\n";
B b;
......
// Special g++ Options:
// Special g++ Options:
// Build don't link:
// GROUPS passed old-abort
typedef unsigned long _G_clock_t;
......@@ -1394,7 +1394,7 @@ class queue : public object {
DESTROYER destroy_f;
STRINGER string_f;
int count;
swap()
int swap()
{
QUEUE tmp = Q;
Q = Q2;
......
......@@ -11,6 +11,7 @@ struct GlobalAddress
GlobalAddress(Value *nvar){}// ERROR - .*
};// ERROR - candidates .*
int
main()
{
new GlobalAddress(Value()); // internal error occured here// ERROR - no matching function .*
......
......@@ -2,6 +2,7 @@
// GROUPS passed old-abort
#include <string>
int
main(void) {
string a[] = {"Hello"};
......
// Build don't link:
// GROUPS passed old-abort
extern void foo(void *);
int
main() {
foo((struct bar *)0);
}
......@@ -31,6 +31,7 @@ template< class T, int n> class Implicit : public T {
BASE operator=(BASE t) { return T::operator=(t); }
};
int
main()
{
Implicit<Implicit<INTEGER, 2> , 3> y;
......
......@@ -18,6 +18,7 @@ template <class T> void bug<T>::Foo(const int)
{
}
int
main()
{
bug<char> InstantiatedBug;
......
......@@ -85,6 +85,7 @@ public:
int i;
};
int
main()
{
Ref<XRep> y;
......
......@@ -15,6 +15,7 @@ bug::bug(int size)
numbers = new internal(size * size);// ERROR - no match.*
}
int
main()
{
bug test;// ERROR - no match
......
......@@ -96,6 +96,7 @@ class Dummy
Dummy() {}
};
int
main()
{
SimpleSet<Dummy *> bs1;
......
......@@ -22,7 +22,7 @@ public:
C &(C::*DD)(const C &x) = &C::operator=;
main()
int main()
{
&DD;
......
// Build don't link:
// GROUPS passed old-abort
main()
int main()
{
int a[100], **p;
......
......@@ -7,7 +7,7 @@ public:
foo();
};
main()
int main()
{
static foo& a = *(new foo);
}
// Build don't link:
// GROUPS passed templates
template<class T>
class Vector
{
......@@ -16,7 +17,7 @@ template<class T>// ERROR - previous definition of T
struct Comparator
{
typedef T T;// ERROR - use of template type T in typedef to T
static lessthan (T &a, T &b) { return a < b; }
static int lessthan (T &a, T &b) { return a < b; }
};
template<class Comp>
......
......@@ -7,7 +7,7 @@ public:
class derv : public foo { };
main()
int main()
{
foo::bar x = foo::baz;
derv::bar y = derv::bat;
......
......@@ -12,7 +12,7 @@ public:
class derv : public foo, public foo2 { };
main()
int main()
{
foo::bar x = foo::baz;
derv::bar2 y = derv::bat2;
......
......@@ -3,7 +3,7 @@
// GROUPS passed enums
enum Thing { FIRST, SECOND } ;
main()
int main()
{
Thing x = FIRST ;
x = 27 ; // this line should be a type error.// ERROR - .*
......
......@@ -16,4 +16,4 @@ public:
B b;
main () {}
int main () {}
......@@ -20,7 +20,7 @@ public:
void *lookup(const char *) {}
};
main()
int main()
{
char buf[2048];
dictionary exceptions;
......
......@@ -2,7 +2,7 @@
// GROUPS passed array-bindings
char * bob();
main()
int main()
{
char a[1][2];
a[0] = bob();// ERROR - .*
......
......@@ -31,7 +31,7 @@ public:
// bar1 should get built before bar2
foo::foo (int x, int y) : b(x), a(y) {}
main()
int main()
{
foo f (1, 2);
printf ("PASS\n");
......
......@@ -9,4 +9,4 @@ public:
static int New(int);// ERROR - declaration.*
};
main() {}
int main() {}
// GROUPS passed miscellaneous
extern "C" void printf (char *, ...);
main()
int main()
{
int i = 0;
// Make sure build_unary_op correctly computes this.
......
......@@ -12,7 +12,7 @@ foo::foo(int a)
foo::a=a;
}
main()
int main()
{
foo obj(4);
}
......@@ -25,6 +25,6 @@ void A::B::g (int val)
}
main ()
int main ()
{
}
......@@ -71,7 +71,7 @@ Dump2::operator<<(double r)
strcpy (output, tempout);
return *this; }
main()
int main()
{
BDDRetrace::Dump1 d1;
Dump2 d2;
......
......@@ -9,4 +9,4 @@ public:
X::M2 X::g(int i) { X::M2 m2; return m2; }
main() { }
int main() { }
......@@ -13,6 +13,6 @@ void MakeBug() {
job = new AStruct;
}
main () {
int main () {
MakeBug();
}
......@@ -8,7 +8,7 @@ int operator()(A x,float y) { // MUST be a member function// ERROR - .*
return 1;
}
main() {
int main() {
A x;
x(1.0); // ERROR - no match for call
}
......@@ -12,7 +12,7 @@ public:
int f (int); // ERROR - candidates are
};
main ()
int main ()
{
Bar b;
......
......@@ -24,7 +24,7 @@ class Casted {
operator double() const { return y; }
};
main()
int main()
{
Casted c(10,12.34);
......
......@@ -4,6 +4,6 @@ typedef struct{double re,im;} complex;
class Complex{public:double re,im;
inline void operator=(Complex&X){re=X.re; im=X.im;};};
void zxcvbnm(int n,...){n=1;}
main(){complex c; Complex C;
int main(){complex c; Complex C;
zxcvbnm(1,c);
zxcvbnm(1,C);}
......@@ -11,7 +11,7 @@ class CGLogger : public CLogger
{
} GLog;
main()
int main()
{
Log(1,"Test");// ERROR - call of.*
Log(1,"Test %d",3);
......
......@@ -9,7 +9,7 @@ public:
void mf() { s='\"'; }
};
main()
int main()
{
Try x;
x.mf();
......
......@@ -14,7 +14,7 @@ public:
int g() { return 0; } // gets bogus error - referenced below XFAIL *-*-*
main()
int main()
{
int try1;
B( try1 ).f(); // no syntax error
......
......@@ -7,7 +7,7 @@
class A { };
main() {
int main() {
A a = a;
A b(b); // gets bogus error - XFAIL *-*-*
}
......@@ -5,7 +5,7 @@ public:
operator ++ (); // ERROR - no type or storage class
};
main()
int main()
{
foo x;
......
......@@ -62,7 +62,7 @@ int PTcl::three(int, char** argv) {
return 0;
}
main (int argc, char** argv) {
int main (int argc, char** argv) {
PTcl obj;
obj.dispatcher(1,argc,argv);
return 0;
......
......@@ -71,7 +71,7 @@ public:
friend class DataBase;
};
main()
int main()
{
DBpathrec a(), b();
......
......@@ -21,7 +21,7 @@ B GLOBAL_B;
B& foo() {return GLOBAL_B;}
main()
int main()
{
// build_scoped_method_call and build_scoped_ref should know how
// to deal with a reference for this
......
......@@ -13,7 +13,7 @@ class A
}
};
main()
int main()
{
A::staticMember();
}
......@@ -37,7 +37,7 @@ struct myStruct
int action() {return 24;};
};
main()
int main()
{
myStruct toto;
......
......@@ -9,6 +9,6 @@ public:
template <class Q>
int Conc<Q>::body() {return 0;}
main () {
int main () {
Conc<int> s2;
}
......@@ -15,7 +15,7 @@ public :
int find();
};
main()
int main()
{
int z = Foo::bar.find();
}
......@@ -14,7 +14,7 @@ func (int const& i)
{}
main ()
int main ()
{
Foo<int const> foo;
printf ("PASS\n");
......
......@@ -11,7 +11,7 @@ public:
int func (int h = 1, int z = 2) { return h+z; }
main ()
int main ()
{
Temp<int(*)(int, int)> temp (func);
......
......@@ -7,7 +7,7 @@ public:
operator const char*() { return fptr; }
};
main(){
int main(){
X x1("1234");
X x2(x1+1);
}
......@@ -9,4 +9,4 @@
template <class ElementType> ElementType A<ElementType>::get() const
{ return ElementType(0); }
main() { const A<short> a(3); }
int main() { const A<short> a(3); }
......@@ -10,7 +10,7 @@ union Double_alignt{
};
main(){
int main(){
Double_alignt<20000> heap;
......
......@@ -2,7 +2,7 @@
// GROUPS passed temporaries
#include <stdio.h>
main ()
int main ()
{
int a = 2;
......
......@@ -5,7 +5,7 @@ int bar ()
throw 100;
}
main ()
int main ()
{
int i = 0; // this gets deleted after flow analysis
try
......
......@@ -17,7 +17,7 @@ void foo (B*);
int newed, created;
main ()
int main ()
{
try {
foo (new B (A ()));
......
......@@ -17,7 +17,7 @@ void foo (B*);
int newed, created;
main ()
int main ()
{
try {
foo (new B (A ()));
......
......@@ -12,7 +12,7 @@ struct A {
void * operator new (size_t size, int, int) { return operator new (size); }
main ()
int main ()
{
try {
A* ap = new (1, 5) A;
......
......@@ -12,7 +12,7 @@ struct A {
void * operator new (size_t size, int, int) { return operator new (size); }
main ()
int main ()
{
try {
A* ap = new (1, 5) A;
......
......@@ -31,7 +31,7 @@ eh_test (int level)
}
}
main ()
int main ()
{
std::set_terminate (&eh_terminate);
eh_test (0);
......
......@@ -13,7 +13,7 @@ f () throw (char, int, std::bad_exception)
throw 'a';
}
main ()
int main ()
{
std::set_terminate (my_term);
std::set_unexpected (my_unexp);
......
......@@ -13,7 +13,7 @@ f () throw (int, std::bad_exception)
throw 'a';
}
main ()
int main ()
{
std::set_terminate (my_term);
std::set_unexpected (my_unexp);
......
......@@ -13,7 +13,7 @@ f () throw (std::bad_exception)
throw 'a';
}
main ()
int main ()
{
std::set_terminate (my_term);
std::set_unexpected (my_unexp);
......
......@@ -13,7 +13,7 @@ f () throw (short)
throw 'a';
}
main ()
int main ()
{
std::set_terminate (my_term);
std::set_unexpected (my_unexp);
......
......@@ -11,7 +11,7 @@ public:
A*(*A::ptr)(int) = &A::func;
main()
int main()
{
A foo;
......
......@@ -2,7 +2,7 @@
void f (int *) { }
void f (char, char);
main ()
int main ()
{
f (__null);
}
......@@ -502,7 +502,7 @@ operator<<(ostream& o, const SLS& s)
SLS gsls;
const SLS gcsls;
foo()
int foo()
{
const unsigned SIZE = 20;
......@@ -563,7 +563,7 @@ foo()
}
// Dummy function so it'll run
main()
int main()
{
cout << "PASS" << endl;
}
......
......@@ -14,7 +14,7 @@ public:
void bar() { b::foo(); } // gets bogus error
};
main() {
int main() {
c test;
test.bar();
}
......@@ -14,7 +14,7 @@ struct B : public A
void func() { foo(); } // ERROR -
};
main()
int main()
{
B b;
b.func();
......
......@@ -38,7 +38,7 @@ private:
struct Bar : public Foo {
public:
DoSomething() {
void DoSomething() {
PUB_A = 0;
Foo::A = 0;
printf("%x\n",pX);
......@@ -57,7 +57,7 @@ public:
}
};
main()
int main()
{
Foo a;
......
struct A { int i; };
main()
int main()
{
A a1 = { 42 };
A a2 (a1);
......
......@@ -2,7 +2,7 @@
struct T { ~T(); };
main()
int main()
{
foo:
T t; // ERROR - redeclared
......
......@@ -5,7 +5,7 @@ struct F {
bool b2 : 7;
};
main()
int main()
{
F f = { true, true };
......
......@@ -2,7 +2,7 @@
struct A { };
main ()
int main ()
{
bool b = (void*)0;
b = (int A::*)0;
......
main ()
int main ()
{
bool b = false;
int i = b++;
......
......@@ -3,7 +3,7 @@
bool b;
main ()
int main ()
{
return ((!b) != 0);
}
......@@ -12,7 +12,7 @@ struct A {
void foo (A a)
{ }
main()
int main()
{
foo (1);
return count;
......
......@@ -9,7 +9,7 @@ public:
Class varOfClass;
main() {
int main() {
// This MUST be 'const' to generate the error...
const Class arrayOfClass[1] = { varOfClass }; // causes abort
}
......@@ -2,7 +2,7 @@
// GROUPS passed rtti
// Negative testcase for decls in conditions.
main()
int main()
{
float i;
......
......@@ -14,7 +14,7 @@ struct T
operator int () { return i; }
};
main ()
int main ()
{
int t;
......
......@@ -11,4 +11,4 @@ struct T {
void T::f() { printf ("%p", &letter); }
const char T::letter; // still need def after class
main() { }
int main() { }
......@@ -4,7 +4,7 @@ extern int i;
const int bar = i;
int i = 5;
main()
int main()
{
return bar != 5;
}
......@@ -30,7 +30,7 @@ typedef unsigned short Type;
typedef Container<Type> TypeContainer;
main(void)
int main(void)
{
TypeContainer myTypeContainer(2);
Type t = myTypeContainer;
......
// PRMS id: 8279
main ()
int main ()
{
char *const *p = 0;
char **q = 0;
......
......@@ -2,7 +2,7 @@ struct A {
A();
A(A); // ERROR - copy ctor must take reference
};
main()
int main()
{
A a;
A b(a); // causes compiler segfault
......
......@@ -15,7 +15,7 @@ void f(void)
r = 0;
}
main()
int main()
{
struct xx p;
......
......@@ -2,7 +2,7 @@ struct A { virtual void f() { } };
struct B { virtual void g() { } };
struct C : public A, public B { };
main ()
int main ()
{
C* cp = 0;
B* bp = 0;
......
......@@ -14,7 +14,7 @@ struct C2 : public B2 { };
struct D2 : public B2 { };
struct E2 : public C2, public D2 { };
main ()
int main ()
{
E e;
E2 e2;
......
......@@ -9,7 +9,7 @@ int add(int const &symbol,
int add_sym(int const &symbol,
const unsigned char flags=0);
main()
int main()
{
int fname;
add_sym(fname); // Guarantee a symbol exists
......
......@@ -7,7 +7,7 @@ public:
extern "C" int printf(const char *, ...);
main () {
int main () {
A a;
a.i = 1;
A b (a);
......
......@@ -15,7 +15,7 @@ public:
typedef char * cp;
main ()
int main ()
{
A<int> a;
A<cp> b;
......
......@@ -12,7 +12,7 @@ class Test
void Print() { printf("%c", ch); }
};
main()
int main()
{
Test *p = new Test('x');
......
......@@ -6,7 +6,7 @@ struct B {
~B();
};
main()
int main()
{
A a;
a.~B(); // ERROR - wrong name
......
......@@ -4,7 +4,7 @@
template <class T> struct A { };
A<int> a;
main()
int main()
{
a.~A(); // gets bogus error
}
......@@ -12,7 +12,7 @@ template <class T> struct A {
~A() { p[--i].~T(); r = i; }
};
main()
int main()
{
{ A<int> a; }
......
......@@ -14,7 +14,7 @@ int f (enum foo ef)
}
}
main ()
int main ()
{
return f (one);
}
......@@ -12,7 +12,7 @@ struct B {
friend void g () { f (); }
};
main ()
int main ()
{
g ();
}
......@@ -29,7 +29,7 @@ void S::foo(const A &pos)
exit (1);
}
main()
int main()
{
A pos;
pos.x = 17;
......
......@@ -13,7 +13,7 @@ void Class<I>::func1(int n) {}
//void Class<I>::func1(int n=1) {}
//the code compiles.
main() {
int main() {
Class<int> C;
return 0;
}
......@@ -3,7 +3,7 @@
extern int i, j;
static const int foo [] = { i, j };
int i = 5, j = 42;
main()
int main()
{
return foo[1] != 42;
}
......@@ -35,7 +35,7 @@ My_string::My_string(const My_string &string)
memcpy(str, string.str, len);
}
main()
int main()
{
My_string str1 = strings[0];
return strcmp ("first string", str1.char_p ()) != 0;
......
......@@ -15,7 +15,7 @@ public:
~C() { }
};
#line 18 "inline.C"
main()
int main()
{
C<int> c;
}
......@@ -2,7 +2,7 @@
extern int a;
main() {
int main() {
switch (a) {
case 1:
int v2 = 3; // ERROR - referenced below
......
main()
int main()
{
char c = '\351';
if (c != '\351')
......
......@@ -3,7 +3,7 @@
// Bug: incomplete instantiation messes with lineno
template <class T> class A;
main()
int main()
{
A<int> *p;
undef1();// ERROR -
......
main() {
int main() {
int i = 2;
int *pi = &(++i);
......
......@@ -6,7 +6,7 @@ struct C : public A, public B { };
struct D { virtual void baz () { } };
struct E : public D, public C { void foo () { status = 0; } };
main ()
int main ()
{
E* ep = new E;
......
......@@ -4,7 +4,7 @@ struct X
mutable int x;
};
main ()
int main ()
{
const X x;
x.x = 0;
......
......@@ -13,7 +13,7 @@ void * operator new (size_t siz) throw (std::bad_alloc) {
return malloc (siz);
}
main()
int main()
{
s = 0;
......
main ()
int main ()
{
const int *p = new const int (0);
delete p;
......
......@@ -14,7 +14,7 @@ struct yy : public xx {
yy(foo& a) { xx::a = a; }
};
main()
int main()
{
foo f;
yy y (f);
......
......@@ -7,7 +7,7 @@ public:
void foo(int &i) { i = 1; }
};
main()
int main()
{
A a;
const A& b = a;
......
......@@ -9,7 +9,7 @@ struct B {
B b_;
const B &b () { return b_; }
main()
int main()
{
return b().foo();
}
......@@ -19,7 +19,7 @@ void operator>>(xistream& i, int j)
i.j = 0;
}
main() {
int main() {
int i;
xifstream ifs;
......
void f (int); // ERROR -
void f (long); // ERROR -
main()
int main()
{
f (1 & 0xffffff00UL); // ERROR - ambiguous
}
......@@ -19,7 +19,7 @@ public:
ostream& operator<< (ostream& os, const X& x);
main()
int main()
{
X x;
ostream os;
......
......@@ -11,7 +11,7 @@ struct A {
} *a;
void bing(const char *);
main ()
int main ()
{
a->f(foo); // gets bogus error because foo's size unknown.
a->f(baz);
......
void f(const int &) { }
void f(const float &);
main()
int main()
{
f(false); // gets bogus error
}
......@@ -5,7 +5,7 @@ struct Foo {
Foo(int i = 25) { } // ERROR - candidate
};
main()
int main()
{
Foo* f1 = new Foo(); // ERROR - ambiguous
}
......@@ -2,7 +2,7 @@
extern "C" int printf (const char *, ...);
main()
int main()
{
int j = 0, k = 0;
1 ? j : k = 5; // should be parsed 1 ? j : (k = 5)
......
......@@ -9,7 +9,7 @@ struct B {
int f () { return (*p)(42); } // gets bogus error
};
main ()
int main ()
{
B b = { new A };
......
......@@ -9,7 +9,7 @@ public:
void print() { }
};
main(int argc, char * argv[])
int main(int argc, char * argv[])
{
int * i = &argc;
......
......@@ -33,7 +33,7 @@ struct myStruct
int action() {return 0;};
};
main()
int main()
{
myStruct toto;
......
......@@ -3,7 +3,7 @@
struct A { int i; };
struct B : public A { int j; int f (); };
main ()
int main ()
{
int A::*apm = &A::i;
int B::*bpm = apm;
......
......@@ -16,7 +16,7 @@ A& foo ()
return a;
}
main ()
int main ()
{
void (A::*p)() = &A::f;
(foo ().*p)();
......
......@@ -18,7 +18,7 @@ public:
};
main()
int main()
{
User a;
......
......@@ -24,7 +24,7 @@ int bar(V *r) {
return (r != gp);
}
main() {
int main() {
D *p = new D;
foo(p);
return bar(p);
......
void f (char *const &) { }
main ()
int main ()
{
f ("hi");
}
......@@ -12,7 +12,7 @@ struct A {
A a;
A foo () { return a; }
main()
int main()
{
const A& ar = foo();
const A& ar2 = A();
......
......@@ -7,7 +7,7 @@ struct B {
};
struct C : public B, public A {};
main() {
int main() {
C c;
A& ar = c;
......
......@@ -12,7 +12,7 @@ A f()
return b;
}
main ()
int main ()
{
A a = f ();
return a.i != 10;
......
......@@ -4,7 +4,7 @@ struct A {
const A * get_this () const { return this; }
};
main ()
int main ()
{
A a;
int r = 0;
......
main ()
int main ()
{
int i;
int &ir = (int&)(int)i; // ERROR - casting rvalue to reference type
......
// Test that the integer hides the struct in block scope.
main ()
int main ()
{
int A;
struct A { };
......
......@@ -22,7 +22,7 @@ A::A(Ptr string) { // gets bogus error -
s = string; // gets bogus error -
}
main() {
int main() {
A a("testing");
A *a_ptr;
B b(&a);
......
......@@ -25,7 +25,7 @@ extern AAA arr1[];
AAA arr1[] = {(int)E1 };
main()
int main()
{
return 0;
}
......@@ -11,4 +11,4 @@ struct A {
struct B: public A {
};
#line 5 "synth5.C"
main() { }
int main() { }
......@@ -3,7 +3,7 @@
struct B { ~B() { } };
struct A { B b; };
main()
int main()
{
A a, b (a), c = A();
A& (A::*afp)(const A&) = &A::operator=;
......
......@@ -12,7 +12,7 @@ public:
typedef unsigned int ui;
main()
int main()
{
A<ui> *ap = new A<ui>;
......
......@@ -8,7 +8,7 @@ int foo () { return 1; }
int A<int>::t = foo ();
main ()
int main ()
{
return (A<int>::t != 1);
}
......@@ -5,6 +5,6 @@
template <class T> inline T min (T a, T b) { return a<b?a:b; }
double min (double, double);
main () {
int main () {
return (int) min (0, 1.0);
}
......@@ -10,7 +10,7 @@ template <class T> struct A {
template <class T> A<T>::A(int) { } // causes compiler abort
template <class T> A<T>::~A() { }
main()
int main()
{
A<int> a;
}
......@@ -12,7 +12,7 @@ public:
class A { };
main()
int main()
{
int i;
X<int> xi(i);
......
// Make sure type deduction isn't confused by top-level cv-quals.
template <class T> T max (const T a, const T b) { return a>b?a:b; }
main()
int main()
{
int a = 0, b = 1;
int c = max (a, b);
......
// Make sure type deduction works for both types of array parameters.
template <class T> void f (T (&a)[2]) { }
template <class T> void g (T a[2]) { }
main()
int main()
{
int a[2] = { 0, 0 };
f (a);
......
......@@ -19,7 +19,7 @@ template <class T> void g1 (const T&);
template <class T> void g2 (T&);
template <class T> void g3 (T);
main()
int main()
{
g1 (f1 ());
g1 (f2 ());
......
......@@ -14,7 +14,7 @@ ostream & operator<< (ostream & os, A<T> & a)
return os;
}
main ()
int main ()
{
A<int> a = { 1 };
cout << a << endl;
......
......@@ -34,7 +34,7 @@ do_foo (Bar<T, T> const & bar)
{}
main ()
int main ()
{ int i;
Bar<char, int> bar1;
Bar<int, int> bar2;
......
......@@ -28,16 +28,16 @@ void Test<T>::doThat()
class A
{
public:
thiss() {};
void thiss() {};
};
class B
{
public:
that() {};
void that() {};
};
main()
int main()
{
Test<A> a;
a.doThiss(); // a.doThat() is not well formed, but then
......
......@@ -7,7 +7,7 @@ A<int> *a;
template <class T> struct A { T t; };
main()
int main()
{
if (a)
a->t = 1; // gets bogus error
......
......@@ -7,7 +7,7 @@ int func(T, U)
return 2;
}
main ()
int main ()
{
func (0, 1); // ERROR - ambiguous
}
......@@ -30,7 +30,7 @@ private:
CopyMe myStrvec;
};
main(int argc, char**argv) {
int main(int argc, char**argv) {
IncludeIt foo;
IncludeIt* bar;
exit(0);
......
......@@ -19,6 +19,6 @@ Set<T>::Compare Set<T>::cmp1 = &gen_cmp;
template<class T>
int (*Set<T>::cmp2)(const T&, const T&) = &gen_cmp;
main() {
int main() {
Set<int> s;
}
......@@ -27,7 +27,7 @@
{
}
main()
int main()
{
ONE<char>::func();
ONE<int>::func();
......
......@@ -13,7 +13,7 @@ private:
int size;
};
main(int argc, char *argv[])
int main(int argc, char *argv[])
{
Array<long> ia; // looping occurs on this line
}
......@@ -10,7 +10,7 @@ struct A {
void f (T t = T()) { }
};
main ()
int main ()
{
A<X> a;
X x (1);
......
......@@ -19,7 +19,7 @@ int equals_x_y = EQUAL<&x,&y>::value; // expected value: 0
int equals_y_x = EQUAL<&y,&x>::value; // expected value: 0
int equals_y_y = EQUAL<&y,&y>::value; // expected value: 1
main ()
int main ()
{
if (equals_x_x == 1
&& equals_x_y == 0
......
......@@ -9,7 +9,7 @@ public:
X foo() { X x; return x; }
main()
int main()
{
X x(foo()); // ERROR - Compiler doesn't warn about temporary reference.
x.bar(foo()); // ERROR - The same mistake is warned about in this case.
......
......@@ -15,7 +15,7 @@ struct A {
A f ()
{ return 1; }
main ()
int main ()
{
{
A a (1);
......
......@@ -24,7 +24,7 @@ struct B {
B(): i(foo()), j(foo()) { }
};
main()
int main()
{
B b;
return r;
......
......@@ -9,7 +9,7 @@ struct A {
operator int () { return 1; }
};
main ()
int main ()
{
A::A();
return c;
......
......@@ -3,7 +3,7 @@
struct foo { double f(int); };
main() {
int main() {
double f (int);
const std::type_info &r = typeid (f);
cout << typeid(f).name() << endl;
......
......@@ -21,7 +21,7 @@ public:
}
};
main()
int main()
{
Flock<Chicken> x;
printf ("%s\n", typeid(x).name());
......
......@@ -35,7 +35,7 @@ public:
virtual void b1() {};
};
main()
int main()
{
D d; // gets bogus error
}
......@@ -6,7 +6,7 @@ struct B: public A {
virtual B* f () { return 0; }
};
main ()
int main ()
{
A* ap = new B;
return (ap->f () != 0);
......
......@@ -7,7 +7,7 @@ struct A {
struct B: public A { int f () { } };
main()
int main()
{
B* bp;
A& ar = (A&)bp; // WARNING -
......
......@@ -14,7 +14,7 @@ private:
};
main()
int main()
{
Foo<int>(1);// ERROR -
}
......@@ -19,7 +19,7 @@ public:
void f(double* p) { cout << "B(double*)\n"; } // ERROR - candidate
};
main()
int main()
{
A a;
B b;
......
......@@ -11,7 +11,7 @@ template <class T> void func(T, const Ptr& p);
Ptr& return_ref();
main()
int main()
{
char* x;
......
......@@ -22,7 +22,7 @@ void ovf( int, short, unsigned long) { printf ("FAIL\n"); }
// (unsigned long => int, unsigned int => short) and a promotion
// (unsigned int => unsigned long).
main(int, char**)
int main(int, char**)
{
unsigned long pixmap = 0;
unsigned int x = 0;
......
......@@ -25,7 +25,7 @@ public:
private:
};
main() {
int main() {
int t[5];
t[1] = 1; t[2] = 2;t[3] = 3;t[4] = 4;
......
......@@ -4,7 +4,7 @@
inline void *operator new(size_t, void *place) { return place; }
main()
int main()
{
int* p = (int*) malloc(sizeof(int));
(void) new (p) int(1);
......
......@@ -21,7 +21,7 @@ public:
};
void B::set (f2 f) { cout << "called B\n";} // ERROR - candidate
main() {
int main() {
B b;
b.set(F1); // ARM page 309: should call A.set(f1) and that what g++ does,// ERROR - .*
// but 13.1 of ARM clearly states that it should call B::set()
......
......@@ -22,7 +22,7 @@ public:
foo* foo::array = new foo [5];
main()
int main()
{
if (i != 5)
printf ("FAIL\n");
......
......@@ -14,7 +14,7 @@ class X : public ParX
void fn2() { cout << "hi" << endl; }
};
main()
int main()
{
X x;
ParX* pParX = &x;
......
......@@ -7,7 +7,7 @@
#include <stdio.h>
main()
int main()
{
int i = 0;
(++i)++;
......
......@@ -18,7 +18,7 @@ A oA;
extern "C" int printf( const char *, ...);
main()
int main()
{
oA.c = 'q';
......
......@@ -261,7 +261,7 @@ operator=( double d )
int makeforms( Vector cen, Vector **a, Vector **b );
main()
int main()
{
Vector *a[8], *b[8], disp(3);
Vector cen(3), cen2(3);
......
......@@ -54,7 +54,7 @@ test(person argp)
;
}
main()
int main()
{
person mainp;
test(mainp);
......
......@@ -15,7 +15,7 @@ private:
public:
}; // ERROR - non-default constructor
main()
int main()
{
B(10);// ERROR - B doesn't have a constructor taking int
}
......@@ -21,7 +21,7 @@ public:
int complex::count=0;
main()
int main()
{
complex v[6] = {1, complex(1,2), complex(), 2 }; // ARM Sect. 12.6.1
int i; // page 289
......
......@@ -6,7 +6,7 @@ class A {
A() {} // private constructor// ERROR - .*
};
main() {
int main() {
A* a = new A();// ERROR - .*
if (a) {
cout << "a != NULL\n";
......
......@@ -38,7 +38,7 @@ public:
};
main() {
int main() {
C c;
D d;
E e;
......
......@@ -13,7 +13,7 @@ class X : public ifstream {
public:
X(int a, char *b) {} // ERROR - candidate
}; // ERROR - candidate
main()
int main()
{
X *y = new X(10, "123");
// the compiler must reject this constructor call:
......
......@@ -56,7 +56,7 @@ CONST Sig::SigTable Sig::sigTable[] = {
{ Bad_t, BadMagic }
};
main() {
int main() {
if (strcmp (Sig::sigTable[0].Magic, "BYTE")
|| strcmp (Sig::sigTable[1].Magic, "WORD")
|| strcmp (Sig::sigTable[2].Magic, "LONG")
......
......@@ -14,7 +14,7 @@ struct foo {
foo *arr = new foo[2];
main()
int main()
{
if (arr[0].index == -1
&& arr[1].index == -1)
......
......@@ -30,7 +30,7 @@ int blort(Foo& f)
return f->a;
};
main()
int main()
{
var_Foo b(2);// ERROR -
b->a = 0;
......
......@@ -6,7 +6,7 @@
// Subject: g++ mixes up array dimensions with new
// Message-ID: <9311211640.AA11787@messua>
main()
int main()
{
int (*a)[5] = new int[6][5];
}
......@@ -51,7 +51,7 @@ public:
};
main()
int main()
{
C *cp= new C;
cp->va();
......
......@@ -26,5 +26,5 @@ void Bar::doit(void)
printf("i = %d\n", j);
}
Thing::Thing(int y) { x = y; }
main(){ Bar x; x.doit(); }
int main(){ Bar x; x.doit(); }
......@@ -17,7 +17,7 @@ public:
int& geti() {return i;} // same thing, but different
};
main()
int main()
{
test t(3.14, 5); // Create an object t of class "test"
int x = (int&)t; // This should call operator int&() but it does not ...
......
......@@ -12,7 +12,7 @@ void f(array &arg)
{
}
main()
int main()
{
array var;
f(var);
......
......@@ -7,7 +7,7 @@
// From: "Malcolm C. Strickland" <chucks@orl.mmc.com>
main()
int main()
{
double *d;
d = new double(10);
......
......@@ -12,7 +12,7 @@ class Point {};
class Line_Segment{ public: Line_Segment(const Point&){} };
class Node { public: Point Location(){ Point p; return p; } };
main()
int main()
{
Node** node1;
Line_Segment(node1->Location()); // intended (*node1)// ERROR - .*
......
......@@ -18,7 +18,7 @@ class A {
};
main()
int main()
{
A a;
if (a!=0) {
......
......@@ -35,7 +35,7 @@ A(const char* s)
printf ("PASS\n");
}
main()
int main()
{
A(B("aaa"));
}
......
......@@ -14,7 +14,7 @@ void f(char *& x)
x++;
}
main()
int main()
{
f ("foo");// ERROR - init of non-const ref from char*
}
......@@ -24,7 +24,7 @@ class Int
int value;
};
main()
int main()
{
Int data = 2;
Int test;
......
......@@ -8,7 +8,7 @@
typedef int A[10];
main()
int main()
{
int* a1 = new A;
};
......@@ -18,7 +18,7 @@ int destruct = 2;
~Test() {if (--destruct == 0) printf ("PASS\n");}
};
main()
int main()
{
long i=1;
Test t;
......
......@@ -19,7 +19,7 @@ public:
void f(A&) {}
main(){
int main(){
R r;
f(r); // problem to cast to B& and then to A&
......
......@@ -22,7 +22,7 @@ public:
};
main() {
int main() {
foo f;
f.test(34); // line 18
}
......@@ -46,7 +46,7 @@ B::run()
}
}
main()
int main()
{
A a(1);
......
......@@ -28,7 +28,7 @@ void f(A &a) { // ERROR - in passing argument
printf("A at %x is %d\n", &a, a.i);
}
main() {
int main() {
B b;
b.i = 99;
f(b);// ERROR - .*
......
......@@ -25,7 +25,7 @@ public:
// passed as value)
};
main() {
int main() {
ulk dumm;
......
......@@ -29,7 +29,7 @@ public:
}
};
main()
int main()
{
Foo() << 1 << 3 << 5 << 7;
printf ("PASS\n");
......
......@@ -14,7 +14,7 @@ a test(){
return a();
}
main(){
int main(){
a ai;
ai = test();
......
......@@ -24,7 +24,7 @@ sub(foo f) {
};
main() {
int main() {
sub(foo());
if (things == 0)
printf ("PASS\n");
......
......@@ -16,6 +16,6 @@ public:
virtual void off(void) { toggle = on; };// ERROR - .*
};
main()
int main()
{
}
......@@ -13,7 +13,7 @@ struct Exception
Exception(int i) { v = i; };
};
inc(int &i)
void inc(int &i)
{
try {
if (i == 0)
......
......@@ -10,7 +10,7 @@ struct S { int a; int c; };
int i = 3;
S s = {6, i};
S * the_s () { return &s; };
main ()
int main ()
{
S * cls = the_s ();
if (cls->a != 6)
......
......@@ -15,7 +15,7 @@ struct foo {
struct foo Ack = {5, X, 3};
main()
int main()
{
if (Ack.a == 5 && Ack.b == 7 && Ack.c == 3)
printf ("PASS\n");
......
......@@ -15,7 +15,7 @@ struct foo {
struct foo Ack = {5, X, 3};
main()
int main()
{
if (Ack.a != 5
|| Ack.b != 7
......
......@@ -6,7 +6,7 @@
// Subject: small bug
// Message-ID: <9209300638.AA22334@moose.cs.columbia.edu>
main() {
int main() {
int offset;
char buf[offset]=""; // ERROR - ansi forbids variable arrays
}
......@@ -14,7 +14,7 @@ public:
int get_a() { return a; }
};
main() {
int main() {
samp ob[4] [2] = { // Generated Error
1, 2,
3, 4,
......
......@@ -12,7 +12,7 @@ template <class T> inline T func(const T& x) { return x; }
inline int func(const int& x) { return x; }
main()
int main()
{ int x;
func(x);
printf ("PASS\n");
......
......@@ -11,7 +11,7 @@
inline int max(int a, int b) {return a > b ? a : b;}; // ERROR - candidate
inline double max(double a, double b) {return a > b ? a : b;}; // ERROR - candidate
main() {
int main() {
static void foo(int i, int j, double x, double y) ;// ERROR - .*
foo(4, -37, 14.39, 14.38);
......
......@@ -18,7 +18,7 @@ struct outer {
}
};
main() {
int main() {
outer::f();
cout << endl;
return 0;
......
......@@ -15,6 +15,6 @@ void f()
};
}
main()
int main()
{
}
......@@ -16,7 +16,7 @@ public:
operator B & () { return *p; }
};
main()
int main()
{
A a;
B &b = (B &)a;
......
......@@ -13,7 +13,7 @@ struct Test {
};
main()
int main()
{
Test<int> i, j;
......
......@@ -17,7 +17,7 @@ public:
void EP::operator=(T *) { }
main()
int main()
{
EP ep1, ep2;
ep1 = ep2;
......
......@@ -2,7 +2,7 @@
// GROUPS passed operators
void foo (int * a, int * b, int * c) {}
main() {
int main() {
int a,b,c;
foo (&a, &b, &c);
(a = b) = c;
......
......@@ -19,7 +19,7 @@ struct B {
A a;
};
main(void)
int main(void)
{
B(A());
if (pass)
......
......@@ -9,7 +9,7 @@ int operator()(A x,float y) {// ERROR - .*
return 1;
}
main() {
int main() {
A x;
x(1.0); // ERROR - no match
}
......
......@@ -21,7 +21,7 @@ void* new_test::operator new(size_t sz, int count, int type)
return p;
};
main()
int main()
{
new_test *test;
int count = 13;
......
......@@ -7,11 +7,11 @@
#include <stdio.h>
nop()
void nop()
{
} // ERROR - non-void
}
main ()
int main ()
{
int a = 2;
......
......@@ -37,7 +37,7 @@ if( allocate1d(d1, array) != 0 )
return array;
}
main()
int main()
{
long d1 = 3, d2 = 4;
class foo
......
......@@ -22,7 +22,7 @@ void foo(int s)
Vector junk(s);
}
main()
int main()
{
Vector* test;
for (int i=0;i<40;i++) // was 100000
......
......@@ -40,7 +40,7 @@ class triangle :public shape {
int height;
};
main() {
int main() {
shape* s1 = new square(4,4,5);
shape* s2 = new triangle(6,6,2,3);
*s1 = *s2;
......
......@@ -8,7 +8,7 @@
typedef int (*cow[3])(...);
main() {
int main() {
cow fs;
int (*pig[3])(...); // line 5
......
......@@ -17,7 +17,7 @@
// Date: Thu, 08 Jul 1993 10:54:59 +0900
// Subject: g++ cannot understand `void (**f)()'
// Message-ID: <9307080155.AA00496@kumade.soft.flab.fujitsu.co.jp>
main()
int main()
{
void (**f)();
}
......
......@@ -21,7 +21,7 @@ T bar()
T baz()
{ return 30; }
main()
int main()
{
T (*apfrt[10])();
......
......@@ -12,7 +12,7 @@ int type(long double) { return 3; }
extern "C" int printf( const char *, ...);
main()
int main()
{
int i = 0;
if (type(0.0) != 2)
......
......@@ -31,7 +31,7 @@ void C::count (int& total) {
char * foo[] = {
"one", "two", "three", NULL};
main() {
int main() {
C c(foo);
int i = 0;
c.count(i);
......
......@@ -14,7 +14,7 @@ void foo(const int m, const int n)
printf("FAIL\n");
}
main()
int main()
{
foo(min(2, 1), min(100, 200));
return 0;
......
......@@ -31,7 +31,7 @@ void foo::operator delete (void *data)
overloaded_delete++;
}
main ()
int main ()
{
foo *f = new foo;
foo *ff = ::new foo;
......
......@@ -6,7 +6,7 @@
// Subject: Bug report
// Message-ID: <9308101450.AA28016@methusalix.ert.rwth-aachen.de>
main()
int main()
{
class foo
{
......
......@@ -7,7 +7,7 @@ struct test {
};
main()
int main()
{
test t;
}
......@@ -25,6 +25,6 @@ public:
int fill;
};
main() {
int main() {
Assoc<String,String> table;
}
......@@ -42,7 +42,7 @@ Foo &Foo::method()
return *this;
}
main()
int main()
{
// f1() returns a temporary object. The member function
// method() returns a reference to the same object.
......
......@@ -21,7 +21,7 @@ foo ()
return A (10);
}
main ()
int main ()
{
int x = foo ().a;
}
......
......@@ -14,7 +14,7 @@ int& test(str *arg1, int str::*arg2)
return (arg1->*arg2);
}
main()
int main()
{
test(&xxx, &str::i) = 5;
if (xxx.i == 0)
......
......@@ -11,7 +11,7 @@
class foo : a { };
class bar : a { };
test( const foo* f, const bar* b )
int test( const foo* f, const bar* b )
{
return f == b;// ERROR -
}
......
......@@ -7,7 +7,7 @@
// Message-ID: <199306091558.AA19075@mail.cs.tu-berlin.de>
typedef int arr[10];
main()
int main()
{
int * p = new int[10];
int * q = new arr; /* g++ complains, but shouldn't */
......
......@@ -24,6 +24,6 @@ op_to_charp BINOPS[] = { {"+", PLUS},
{"/", DIV},
{"^", POWR} };
main() {
int main() {
int dummy;
}
......@@ -17,7 +17,7 @@ X<A,C> f(X<A,B>,X<B,C>)
return result;
}
main()
int main()
{
X<1,3> x;
X<1,2> y;
......
......@@ -21,7 +21,7 @@ public:
void bar() { b::foo();}
};
main() {
int main() {
c test;
test.bar();
}
......
......@@ -41,7 +41,7 @@ BugStream& operator<<(ostream& os, Eval_)
return ((BugStream&)os).eval();
}
main() {
int main() {
BugStream bs;
bs << "PASS" << eval;
}
......@@ -16,7 +16,7 @@ class B:public A
void SetProp() { if (!aset) { printf ("FAIL\n"); exit (0);} aset--;}
};
main()
int main()
{
A a;
B b;
......
......@@ -51,7 +51,7 @@ derived_friend()
main(int argc, char *argv[])
int main(int argc, char *argv[])
//==========================
{
base b;
......
......@@ -94,7 +94,7 @@ try_array( Array_RC<Type> &rc )
try_array( ((Array<Type>&)rc) );
}
main()
int main()
{
static int ia[10] = { 12, 7, 14, 9, 128, 17, 6, 3, 27, 5 };
Array_RC<int> iA(ia, 10);// ERROR - instantiated from here
......
......@@ -29,7 +29,7 @@ class C : public A {
}
};
main() {
int main() {
C cvar;
B bvar(&cvar);
}
......@@ -25,7 +25,7 @@ public:
Derived(int n, char* str);
Derived(int n);
getNum() {return num_;}
int getNum() {return num_;}
private:
int num_;
};
......
......@@ -51,7 +51,7 @@ derived_friend()
main(int argc, char *argv[])
int main(int argc, char *argv[])
//==========================
{
base b;
......
......@@ -27,7 +27,7 @@ Derived::noticeThisFunction(Base *b) {
// since it is not called on 'this'
}
main() {
int main() {
Base b;
Derived d;
d.noticeThisFunction(&b);
......
......@@ -34,7 +34,7 @@ private:
};
main()
int main()
{
C c;
}
......@@ -59,7 +59,7 @@ class C {
};
main()
int main()
{
B* bobject = new B(2, 1);
C* cobject = new C(bobject);
......
......@@ -17,7 +17,7 @@ struct B : virtual A {
};
main()
int main()
{
B blist[10];
printf ("PASS\n");
......
......@@ -51,6 +51,6 @@ class interproc_jump_edge : public eel_interproc_jump_edge,
public:
};
main () {
int main () {
void *vp = new interproc_jump_edge();
}
......@@ -6,7 +6,7 @@ public:
int b;
} x;
main()
int main()
{
// printf("Foo offset %d\n", (int)(Foo*)&x - (int)&x);
// printf("b offset %d\n", (int)&x.b - (int)&x);
......
......@@ -23,7 +23,7 @@ class rM : public M {
class D : public lM, rM {
} d; // ERROR - ambiguous function
main() {
int main() {
((lM*)&d)->i = 1;
((rM*)&d)->i = 2;
((rM*)&d)->f();
......
......@@ -4,7 +4,7 @@ E foo() {
return C;
}
main() {
int main() {
if (foo() != C)
return 1;
}
......@@ -4,13 +4,13 @@
class test1 {
public:
class fehler{public:fehler(){};};
func(int a) {
void func(int a) {
if( a == 0 )
throw fehler();
}
};
main() {
int main() {
test1 var;
try {
......
......@@ -7,9 +7,9 @@ void my_unexpected() {
throw 42;
}
foo() throw (int) { throw "Hi"; }
void foo() throw (int) { throw "Hi"; }
main() {
int main() {
std::set_unexpected (my_unexpected);
try {
foo();
......
......@@ -7,9 +7,9 @@ void my_unexpected() {
exit (0);
}
foo() throw () { throw "Hi"; }
void foo() throw () { throw "Hi"; }
main() {
int main() {
std::set_unexpected (my_unexpected);
foo();
return 1;
......
// Build don't link:
// Special g++ Options: -fexceptions
foo() {
void foo() {
throw 1;
}
// Special g++ Options: -fexceptions -O9
// excess errors test - XFAIL a29k-*-* sparc64-*-elf sh-*-* arm-*-pe**-*
main1() {
void main1() {
throw 1;
}
main() {
int main() {
try {
main1();
} catch (...) {
......
......@@ -3,12 +3,12 @@
extern "C" int printf(const char *, ...);
main1() {
void main1() {
throw 1;
}
main() {
int main() {
try {
main1();
} catch (...) {
......
class foo {
public:
apply(foo *(foo::*memptr)()) {
void apply(foo *(foo::*memptr)()) {
this->*memptr(); // ERROR - wrong
}
};
......@@ -31,7 +31,7 @@ void bar() {
int i = int(s+b);
main() {
int main() {
bar();
bar();
return count != 2;
......
......@@ -22,7 +22,7 @@ class C {
--count;
printf("down\n");
}
operator ++() {
int operator ++() {
return ++val;
}
operator int() {
......@@ -38,7 +38,7 @@ void bar() {
foo();
}
main() {
int main() {
bar();
if (C::count)
{
......
......@@ -39,7 +39,7 @@ ivHandler *bar2() {
return &a;
}
main() {
int main() {
want=vf_request;
bar()->request();
want=vf_event;
......
......@@ -18,7 +18,7 @@ public:
}
};
main() {
int main() {
B b;
A *ap = &b;
ap->~A(); // This should call the destructor virtually.
......
......@@ -2,4 +2,4 @@
// GROUPS passed vtable
class T { public: virtual ~T() {} };
template<class P> class X : public virtual T {};
main() { X<int> x; }
int main() { X<int> x; }
......@@ -4,7 +4,7 @@
const int ci=10, *pc = &ci, *const cpc = pc, **ppc;
int i, *p, *const cp = &i;
main()
int main()
{
i = ci;
*cp = ci;
......
......@@ -51,7 +51,7 @@ public:
} e;
main() {
int main() {
if (++i != 6)
exit(1);
return 0;
......
......@@ -7,7 +7,7 @@ public:
class Child : public Parent {
}; // ERROR - called
main() {
int main() {
Child c( "String initializer" ); // ERROR - bad
return 0;
}
......@@ -19,7 +19,7 @@ S s = { &A::foo, &A::vfoo, &A::foo };
A a;
main() {
int main() {
(a.*s.pfn1)();
(a.*s.pfn2)();
printf("PASS\n");
......
......@@ -30,7 +30,7 @@ public:
}
};
main() {
int main() {
multiple m(1,2);
m.print();
}
......@@ -17,7 +17,7 @@ int (C::*vmpb) () = &C::b;
int (C::*vmpb2) () = &C::b2;
int (C::*vmpa) () = &C::a;
main () {
int main () {
C c;
if ((c.*vmpa)() != 1)
return 1;
......
......@@ -5,7 +5,7 @@ class foo {
friend int operator ^(const foo&, const foo&);
};
main ()
int main ()
{
int (*funptr) (const foo &, const foo &) = operator ^;
}
......@@ -12,7 +12,7 @@ struct myint {
}
myint(const myint& mi) {
}
operator=(const myint& mi) {
myint& operator=(const myint& mi) {
}
};
......
......@@ -9,7 +9,7 @@ static void *operator new(size_t size) throw (std::bad_alloc) {
return (void*) 0;
}
main() {
int main() {
cout << "";
new int;
return fail;
......
......@@ -22,7 +22,7 @@ foo (int& a)
{ // ERROR -
}
main ()
int main ()
{
int b;
const int*const a = &b;
......
......@@ -4,7 +4,7 @@
const int ci=10, *pc = &ci, *const cpc = pc, **ppc;
int i, *p, *const cp = &i;
main()
int main()
{
ci = 1; // ERROR - bad
ci++; // ERROR - bad
......
namespace Foo {
bar() {
int bar() {
return 0;
}
}
using namespace Foo;
main() {
int main() {
bar();
}
namespace Foo {
bar() {
int bar() {
return 0;
}
}
main() {
int main() {
return Foo::bar();
}
......@@ -3,16 +3,16 @@ class Foo {
namespace A {
namespace Foo {
bar() {
int bar() {
return 0;
}
}
mymain() {
int mymain() {
return Foo::bar();
}
}
main() {
int main() {
return A::mymain();
}
......@@ -4,6 +4,6 @@ namespace N {
using namespace N;
main() {
int main() {
return i;
}
namespace Foo {
bar() {
int bar() {
return 0;
}
}
using Foo::bar;
main() {
int main() {
return bar();
}
......@@ -6,6 +6,6 @@ class C {
C a, b;
main() {
int main() {
a = b;
}
......@@ -16,7 +16,7 @@ class derived2 : public derived1, public base2 {
struct test {
derived2& fails;
test1() {
void test1() {
fails.base1::x = 5;
}
};
......@@ -26,7 +26,7 @@ void TCRCB::eat () {
this->itc();
}
main() {
int main() {
TCRCB a;
a.eat();
return fail;
......
......@@ -27,7 +27,7 @@ struct D : public B, public C
D() : B(41), C(42) { }
} d;
main() {
int main() {
if (! d.g())
return 1;
}
......@@ -18,7 +18,7 @@ void foo() {
Deranged d;
}
main()
int main()
{
foo();
printf("PASS\n");
......
......@@ -29,7 +29,7 @@ public:
const char* f3() { return A::f3(); }
};
main() {
int main() {
C* tempC = new C;
D* tempD = new D;
A* a = tempC;
......
......@@ -81,7 +81,7 @@ public:
void j () {};
};
main () {
int main () {
firstBase* fbp = new classImplementation;
classImplementation* cip = dynamic_cast <classImplementation*> (fbp);
cip->addRef();
......
......@@ -45,7 +45,7 @@ public:
}
};
main()
int main()
{
C1 *one = new C1;
......
......@@ -23,6 +23,6 @@ foo() {
A a(2);
main() {
int main() {
foo();
}
......@@ -46,7 +46,7 @@ B A::compute(void) const {
return sub;
}
main ()
int main ()
{
A titi;
A toto = titi.compute();
......
......@@ -27,7 +27,7 @@ B D::compute(void) const
return sub;
}
main () {
int main () {
D titi;
titi.compute().print();
return 0;
......
......@@ -44,7 +44,7 @@ B A::compute(void) const
return sub;
}
main ()
int main ()
{
A titi;
titi.compute().beefy();
......
......@@ -24,7 +24,7 @@ public:
virtual void f2() { printf("Test3::f2\n"); }
};
main() {
int main() {
Test3 t3;
return 0;
}
......@@ -26,7 +26,7 @@ public:
void a() { }
};
main()
int main()
{
C c;
return 0;
......
......@@ -26,7 +26,7 @@ void vfunc(VoidObjMemberFunc of, Object *op, void *v1) {
(op->*of)(op, v1);
}
main() {
int main() {
Object o;
vfunc((VoidObjMemberFunc)&Clipper::Feedback, &o, 0);
......
......@@ -51,7 +51,7 @@ public:
}
};
main() {
int main() {
C& bb = *new C;
R& mv = bb;
bb.real(0);
......
......@@ -18,7 +18,7 @@ class C : public B {
int a() { return 42; }
};
main() {
int main() {
B * b = new C;
printf("%d.\n", b->a());
return 0;
......
......@@ -16,7 +16,7 @@ struct C : B {
void print() {superC::print(); printf("C");};
};
main ()
int main ()
{
A a;
B b;
......
......@@ -8,19 +8,19 @@ void *ptr;
class A {
public:
A() { printf ("A is constructed.\n"); }
virtual xx(int doit) { printf ("A is destructed.\n"); }
virtual void xx(int doit) { printf ("A is destructed.\n"); }
};
class A1 {
public:
A1() { printf ("A1 is constructed.\n"); }
virtual xx(int doit) { printf ("A1 is destructed.\n"); }
virtual void xx(int doit) { printf ("A1 is destructed.\n"); }
};
class B : public virtual A, public A1 {
public:
B() { printf ("B is constructed.\n"); }
virtual xx(int doit) {
virtual void xx(int doit) {
printf ("B is destructed.\n");
A1::xx (1);
if (doit) A::xx (1);
......@@ -34,7 +34,7 @@ public:
C() { ++num; printf ("C is constructed.\n");
ptr = this;
}
virtual xx(int doit) {
virtual void xx(int doit) {
--num;
if (ptr != this)
printf("FAIL\n%x != %x\n", ptr, this);
......
......@@ -8,19 +8,19 @@ void *ptr;
class A {
public:
A() { printf ("A is constructed.\n"); }
virtual xx(int doit) { printf ("A is destructed.\n"); }
virtual void xx(int doit) { printf ("A is destructed.\n"); }
};
class A1 {
public:
A1() { printf ("A1 is constructed.\n"); }
virtual xx(int doit) { printf ("A1 is destructed.\n"); }
virtual void xx(int doit) { printf ("A1 is destructed.\n"); }
};
class B : public A1, public virtual A {
public:
B() { printf ("B is constructed.\n"); }
virtual xx(int doit) {
virtual void xx(int doit) {
printf ("B is destructed.\n");
A1::xx (1);
if (doit) A::xx (1);
......@@ -34,7 +34,7 @@ public:
C() { ++num; printf ("C is constructed.\n");
ptr = this;
}
virtual xx(int doit) {
virtual void xx(int doit) {
--num;
if (ptr != this)
printf("FAIL\n%x != %x\n", ptr, this);
......
......@@ -8,19 +8,19 @@ void *ptr;
class A {
public:
A() { printf ("A is constructed.\n"); }
virtual xx(int doit) { printf ("A is destructed.\n"); }
virtual void xx(int doit) { printf ("A is destructed.\n"); }
};
class A1 {
public:
A1() { printf ("A1 is constructed.\n"); }
virtual xx(int doit) { printf ("A1 is destructed.\n"); }
virtual void xx(int doit) { printf ("A1 is destructed.\n"); }
};
class B : public virtual A, public A1 {
public:
B() { printf ("B is constructed.\n"); }
virtual xx(int doit) {
virtual void xx(int doit) {
printf ("B is destructed.\n");
A1::xx (1);
if (doit) A::xx (1);
......@@ -33,7 +33,7 @@ class C : public virtual A {
public:
C() { printf ("C is constructed.\n");
}
virtual xx(int doit) {
virtual void xx(int doit) {
printf ("C is destructed.\n");
if (doit) A::xx (1);
}
......@@ -44,7 +44,7 @@ public:
D() { ++num; printf ("D is constructed.\n");
ptr = this;
}
virtual xx(int doit) {
virtual void xx(int doit) {
--num;
if (ptr != this) {
printf("FAIL\n%x != %x\n", ptr, this);
......
......@@ -16,7 +16,7 @@ void A::d() {
(this->*(f()))();
}
main() {
int main() {
A a;
a.d();
}
......@@ -8,7 +8,7 @@ class A
public:
A() { }
virtual ~A() { }
virtual id() { }
virtual void id() { }
};
class B
......@@ -16,7 +16,7 @@ class B
public:
B() { }
virtual ~B() { }
virtual id() { }
virtual void id() { }
};
class C : public A, public B
......@@ -24,7 +24,7 @@ class C : public A, public B
public:
C() { }
virtual ~C() { }
id() { abort(); }
void id() { abort(); }
};
class D : public C
......@@ -32,10 +32,10 @@ class D : public C
public:
D() { ++num_d; }
virtual ~D() { -- num_d; }
id() { }
void id() { }
};
main()
int main()
{
D* dp2 = new D;
((B*)dp2)->id();
......
......@@ -24,7 +24,7 @@ public:
class E : public D { };
main() {
int main() {
E e;
e.f();
E * ep = &e;
......
// Build don't link:
// prms-id: 4619
main() {
int main() {
int i = 3;
int (*p)[10] = new int [20][10];
int (*p1)[5][7][13][10] = new int [i][5][7][13][10];
......
......@@ -30,6 +30,6 @@ public:
void d_print() { }
};
main() {
int main() {
derived d(1); d.d_print(); return 0;
}
......@@ -18,7 +18,7 @@ public:
void set_var() { }
};
main() {
int main() {
d * test;
test = new d;
}
......@@ -31,7 +31,7 @@ public:
virtual int foo() { return 5; }
};
main() {
int main() {
Main m;
if (m.foo() != 5)
return 1;
......
......@@ -33,7 +33,7 @@ public:
virtual ~Main() { did_fail = 0; }
};
main() {
int main() {
Main* m;
did_fail = 1;
delete new Main;
......
......@@ -11,7 +11,7 @@ public:
int operator== (const A& r) { return 0; }
};
main() {
int main() {
{
A a (1);
if (a == 2 && a == 1)
......
......@@ -11,7 +11,7 @@ public:
int operator== (const A& r) { return 1; }
};
main() {
int main() {
{
A a (1);
if (a == 2 || a == 1)
......
......@@ -19,7 +19,7 @@ public:
virtual ~ParentTwo() {};
private:
int MoreData[12];
virtual foo() { return 0; }
virtual int foo() { return 0; }
};
struct Child : public ParentOne, public ParentTwo {
......@@ -60,7 +60,7 @@ struct Student : public Child {
}
};
main() {
int main() {
Student o;
o.LocalPrintThis();
o.ForcedPrintThis();
......
......@@ -12,7 +12,7 @@ int foo() {
return A();
}
main() {
int main() {
return foo() != 7;
}
......
......@@ -28,7 +28,7 @@ Derived a;
/* Bar<Derived, &Signal::Name> dispatcher1; */
Bar<Derived, &Derived::Name> dispatcher2;
main() {
int main() {
/* int i1 = dispatcher1.value(&a); */
int i2 = dispatcher2.value(&a);
return /* i1 != 1 || */ i2 != 2;
......
......@@ -6,7 +6,7 @@ struct Foo {
int Foo::*pmd = &Foo::member;
main() {
int main() {
if (pmd == 0)
return 1;
if (a.*pmd != 42)
......
......@@ -35,7 +35,7 @@ private:
char _c;
};
main()
int main()
{
Char r, s;
......
......@@ -10,7 +10,7 @@ Object::Object() : Value(-1) { }
Object *pArr = new Object[2];
main() {
int main() {
if (pArr[0].Value != -1 || pArr[1].Value != -1)
return 1;
}
......@@ -27,7 +27,7 @@ A::Safe() const
Munge(i); // ERROR - should not be able to modify a const object
}
main()
int main()
{
const A a(1);
a.Safe();
......
......@@ -35,7 +35,7 @@ class B
void operator delete(void*){}
};
main()
int main()
{
B* p = new B;
delete p;
......
......@@ -48,7 +48,7 @@ void g ()
A::match_this = 0;
}
main() {
int main() {
f();
g();
return fail;
......
......@@ -10,7 +10,7 @@ void* operator new(size_t sz) throw (std::bad_alloc) {
return p;
}
main () {
int main () {
int* i = new int;
delete i;
return 1;
......
......@@ -7,7 +7,7 @@ void operator delete(void *p) throw() {
exit(0);
}
main () {
int main () {
int* i = new int;
delete i;
return 1;
......
......@@ -36,7 +36,7 @@ AFX_MSGMAP_ENTRY CDialog ::_messageEntries[] = {
{ (AFX_PMSG)0 }
};
main() {
int main() {
CDialog d;
(d.*((CDialog::_messageEntries)[0]).pfn)(); // This should call CDialog::OnMyMsg
return fail;
......
......@@ -20,6 +20,6 @@ int DingDong(double A) {
}
main() {
int main() {
DingDong(1.0);
}
......@@ -8,7 +8,7 @@ public:
~C() { }
};
main(int argc, char**argv) {
int main(int argc, char**argv) {
C c,d;
c = (argc&1) ? C() : d;
return 0;
......
......@@ -19,7 +19,7 @@ public:
}
};
main(int argc, char**argv) {
int main(int argc, char**argv) {
C c;
c = C();
return 0;
......
......@@ -28,7 +28,7 @@ C func() {
return g;
}
main(int argc, char**argv) {
int main(int argc, char**argv) {
C c,d;
// printf ("\n");
c = (argc != 1) ? C() : d;
......
......@@ -25,7 +25,7 @@ void testit(const C& a, C& b)
func(a,b);
}
main()
int main()
{
C a;
C b;
......
......@@ -22,7 +22,7 @@ int bar()
return 0;
}
main() {
int main() {
bar();
return count;
}
......@@ -17,7 +17,7 @@ struct bar : virtual public foo
// bar array[3][3];
foo array[3][3];
main ()
int main ()
{
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++) {
......
......@@ -22,7 +22,7 @@ struct foo
int foo::count;
main ()
int main ()
{
{
foo array[3][3];
......
......@@ -7,7 +7,7 @@ public:
extern void bar(int*);
main()
int main()
{
int (C::*mfp)() = &C::func;
bar((int*)mfp); // ERROR - no clear semantics
......
......@@ -26,7 +26,7 @@ class B
int foo(B& b); // ERROR - referenced below
main()
int main()
{
AX a;
foo(a); // ERROR - Ambiguous B(a) or a.operator B() // See ARM 12.3.2
......
......@@ -139,7 +139,7 @@ AFX_MSGMAP_ENTRY CMainWindow ::_messageEntries[] = {
{0, (AFX_PMSG)0 }
};
main( int argc, char **argv) {
int main( int argc, char **argv) {
CMainWindow myWindow;
myWindow.callProc();
......
......@@ -9,7 +9,7 @@ public:
private:
};
main()
int main()
{
A a;
......
......@@ -25,7 +25,7 @@ private:
A d[2][2][2];
};
main() {
int main() {
{ A a; }
{ B b; }
{ C c; }
......
......@@ -16,7 +16,7 @@ public:
};
};
main() {
int main() {
Outer::Inner A;
Outer Thing;
......
......@@ -13,6 +13,6 @@ struct Fails {
Fails d;
main() {
int main() {
return &d.i == &d.c;
}
......@@ -30,7 +30,7 @@ int (MD::* pmf0)(int) = &MD::f;
int (MD::* pmf1)(int) = &MD::g;
int (MD::* pmf2)(int) = &MD::hf;
main()
int main()
{
MD obj;
int fail = 0;
......
......@@ -40,7 +40,7 @@ void B_table::call_fn_fn1(int &item, void *pfn1) {
B_table b;
bar jar;
main() {
int main() {
printf("ptr to B_table=%x, ptr to A_table=%x\n",&b,(A_table*)&b);
B_table::B_ti_fn z = &B_table::func1;
int j = 1;
......
......@@ -6,7 +6,7 @@ public:
void foo() {
pmf(); // WARNING -
}
static foo1(S* sp) {
static void foo1(S* sp) {
(sp->pmf)(); // ERROR -
}
};
#include <typeinfo>
main() {
int main() {
typeid(bool);
}
class A {};
class C {};
main() {
int main() {
A* a = 0;
C* c = static_cast<C*>(a); // ERROR - bad static cast
}
......@@ -25,7 +25,7 @@ public:
int foo() { return getenv("TEST") == 0; }
main() {
int main() {
int i = foo() ? s+b : s;
return i != 2;
}
......@@ -44,7 +44,7 @@ public:
~LAST () { print_STATE(); }
};
main() {
int main() {
MIBASE *o = new LAST;
MID *p = o->VFN();
p->print_STATE();
......
......@@ -8,7 +8,7 @@ int A::f()
return i;
}
main()
int main()
{
return A::f();
}
......@@ -10,7 +10,7 @@ namespace foo{
}
}
main(int,char**)
int main(int,char**)
{
return foo::eine_funktion(1);
}
......@@ -16,7 +16,7 @@ int barney()
return 1;
}
main()
int main()
{
return fred::barney();
}
......@@ -7,7 +7,7 @@ namespace std{
void std::g()
{}
main()
int main()
{
return std::i-5;
}
......@@ -19,7 +19,7 @@ void andere_funktion()
var=4;
}
main(int,char**)
int main(int,char**)
{
andere_funktion();
return 0;
......
......@@ -7,7 +7,7 @@ namespace A{
}
}
main()
int main()
{
return A::i-A::B::i;
}
......@@ -21,7 +21,7 @@ int f(int,int)
using namespace A;
using namespace B;
main()
int main()
{
if(f() != 1)
return 1;
......
......@@ -12,7 +12,7 @@ int f (const A& a)
return 1;
}
main ()
int main ()
{
if (f (A()) && d == 0)
return 0;
......
......@@ -4,7 +4,7 @@ struct A {
A operator+ (A, float);
main ()
int main ()
{
A a;
a + 1;
......
......@@ -3,7 +3,7 @@ template <class T, unsigned N>
template <class T, unsigned N>
unsigned size(T const (&)[N]) { return N; }
main() {
int main() {
short iarray[] = { 1, 2, 3, 4, 5 };
const short carray[] = { 1, 2, 3, 4, 5 };
return size(iarray) - size(carray);
......
......@@ -6,6 +6,6 @@ public:
enum { val = (N == 0) ? M : GCD<N, M % N>::val };
};
main() {
int main() {
GCD< 1, 0 >::val; // ERROR - division
}
......@@ -27,7 +27,7 @@ void doit(T x) {
p2 = TestClass2(); // ERROR - template used as expression
}
main() {
int main() {
double x;
doit(x);
}
......
......@@ -3,7 +3,7 @@
int f1 () {
struct A {
A() : b (2) { }
fred () { return b.hi_mom; }
int fred () { return b.hi_mom; }
struct B {
int hi_mom;
B (int a) { hi_mom = a; }
......
......@@ -5,7 +5,7 @@ template <class T> struct A {
};
};
main ()
int main ()
{
A<int>::B<char> b;
b.f (42);
......
......@@ -8,7 +8,7 @@ template <class T> struct A {
};
};
main ()
int main ()
{
A<int>::B<char> b;
b.f (42);
......
......@@ -13,7 +13,7 @@ template <class T> struct A {
};
};
main ()
int main ()
{
A<int>::B<int>::C<int>::D<int>::E<int>::F<int> b;
b.f (42);
......
......@@ -15,7 +15,7 @@ struct alloc_traits
typedef typename Allocator::template rebind<T>::other allocator_type;
};
main ()
int main ()
{
typedef alloc_traits<int, allocator<void> >::allocator_type at;
......
......@@ -16,7 +16,7 @@ void f ()
template <class T> struct C: public A<T>::B<T> { };
main ()
int main ()
{
f<int, char>();
}
......@@ -8,7 +8,7 @@ public:
void operator=(A<U, N> const & a) { return; }
};
main()
int main()
{
A<float, 3> a;
A<double, 3> b;
......
......@@ -13,7 +13,7 @@ public:
void func(U v1) {}
};
main()
int main()
{
A<float> a;
a.func(3);
......
......@@ -13,7 +13,7 @@ public:
void func(U v1 = 0) {}
};
main()
int main()
{
A<float> a;
a.func(3);
......
......@@ -13,7 +13,7 @@ public:
void func(V v1 = 0) {}
};
main()
int main()
{
A<float, int> a;
a.func("abc");
......
......@@ -6,7 +6,7 @@ A<int> a;
template <class T> template <class U> void A<T>::f (U u) { }
main()
int main()
{
a.f (24);
}
......
......@@ -5,7 +5,7 @@ struct A
operator A<T2>() const { return A<T2>(); }
};
main()
int main()
{
A<int> a1;
A<long> a2;
......
......@@ -24,7 +24,7 @@ struct X
void f(const T1&) {}
};
main(int ac, char* av[]) {
int main(int ac, char* av[]) {
S s;
s.g();
int i[] = {1,2,3,4,5};
......
......@@ -6,7 +6,7 @@ struct A {
template <class T>
T A<T>::arr[5] = { 0, 1, 2, 3, 4 };
main ()
int main ()
{
return A<int>::arr[0];
}
......@@ -16,7 +16,7 @@ template<class R> void f(R)
accumulate(0, static_cast<int (*)(int, R&)>(p) );
}
main()
int main()
{
f(0);
}
......@@ -17,7 +17,7 @@ class complex
void print () { }
};
main ()
int main ()
{
complex c1 (1, 0);
complex c2 (2, 0);
......
......@@ -19,7 +19,7 @@ int operator >(const complex& x, const complex &y)
return c1 > c2;
}
main ()
int main ()
{
complex c1 (1, 0);
complex c2 (2, 0);
......
......@@ -3,7 +3,7 @@
int f1 () {
struct A {
A() : b (2) { }
fred () { return b.hi_mom; }
int fred () { return b.hi_mom; }
struct B {
int hi_mom;
B (int a) { hi_mom = a; }
......@@ -15,7 +15,12 @@ int f1 () {
}
int f2 () {
struct A { ~A() { a = 3; } int a; fred () { return a + 1; } };
struct A {
~A() { a = 3; }
int a;
int fred () { return a + 1; }
};
A ab;
ab.a = 12;
return ab.fred();
......
......@@ -27,7 +27,7 @@ ostream& operator<< (ostream& out, const Vector<char>&)
return out;
}
main()
int main()
{
Vector<char> vc;
ostream out;
......
......@@ -21,7 +21,7 @@ template<class R> void f( vector<R>& v )
#endif
}
main()
int main()
{
vector<int> r;
f( r );
......
......@@ -6,7 +6,7 @@ int bar ()
throw 100;
}
main ()
int main ()
{
int i = 0;
try
......
......@@ -6,4 +6,4 @@
typedef int an_int;
bar() : bar::an_int(3) {}; // will call foo::foo(3)
};
main() { bar b; }
int main() { bar b; }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment