Bring over test cases

From-SVN: r15897
This commit is contained in:
Benjamin Kosnik 1997-10-14 18:41:30 +00:00
parent dae1d6f685
commit 378ec56d93
3 changed files with 146 additions and 0 deletions

View File

@ -0,0 +1,37 @@
# .Sanitize for g++ tests.
# Each directory to survive it's way into a release will need a file
# like this one called "./.Sanitize". All keyword lines must exist,
# and must exist in the order specified by this file. Each directory
# in the tree will be processed, top down, in the following order.
# Hash started lines like this one are comments and will be deleted
# before anything else is done. Blank lines will also be squashed
# out.
# The lines between the "Do-first:" line and the "Things-to-keep:"
# line are executed as a /bin/sh shell script before anything else is
# done in this directory.
Do-first:
# All files listed between the "Things-to-keep:" line and the
# "Do-last:" line will be kept. All other files will be removed.
# Directories listed in this section will have their own Sanitize
# called. Directories not listed will be removed in their entirety
# with rm -rf.
Things-to-keep:
.cvsignore
p12475.C
p13417.C
warn01.C
Things-to-lose:
# The lines between the "Do-last:" line and the end of the file
# are executed as a /bin/sh shell script after everything else is
# done.
Do-last:

View File

@ -0,0 +1,11 @@
// Build don't link:
// Special g++ Options:
// prms-id: 13417
class Foo {
public:
explicit Foo (int){}
};
Foo f(10);
Foo blat() return f(4){}; //this should not give an error

View File

@ -0,0 +1,98 @@
// Build don't link:
// Special g++ Options: -Wall -Weffc++
//1 g++/12952 un-named variables in a catch block
//Wall or Wunused should not give warnings here
template <class T>
void f (void) {
try
{
}
catch( int)
{
}
};
//
//2 g++/12923 __attribute__((__unused__)) not working for objects
//Weffc++ or Wunused should not report the object as an error
class C {
public:
C();
};
void f (void){
C x __attribute__ ((__unused__));
int y __attribute__ ((__unused__));
}
//
//3 g++/12982 lock should not give error here, as above
void setLock ();
void clearLock ();
template <class T>
class test {
public:
class lock
{
public:
lock () { setLock(); }
~lock () { clearLock(); }
};
static void f (void)
{
lock local __attribute__ ((__unused__));
}
};
//
//4 g++/12988 neither Mutex nor AutoMutex varibles should give warnings here
//compile with -Weffc++ or -Wunused depending on post or pre 97r1
class Mutex {
private:
long counter;
public:
virtual long retcntr() {return counter;};
Mutex(int i = 0): counter(i) {};
virtual ~Mutex() {};
} __attribute__ ((__unused__));
class AutoMutex: public Mutex{
private:
long counter2;
public:
long retcntr() {return counter2;};
AutoMutex(int i = 0): counter2(i) {};
virtual ~AutoMutex() {};
} __attribute__ ((__unused__));
template <class T>
int foofunc(T x){
Mutex sm(2);
AutoMutex m(&sm);
return 0;
};
//5 sanity check to make sure other attributes cannot be used
class Mutex2 {
private:
long counter;
public:
virtual long retcntr() {return counter;};
Mutex2(int i = 0): counter(i) {};
virtual ~Mutex2() {};
} __attribute__ ((warn)); // WARNING -