* lib/g++-dg.exp (g++-dg-test): Add "repo" option.
(dg-gpp-additional-sources): New function.
(dg-gpp-additional-files): Likewise.
* lib/g++.exp (additional_sources): New variable.
(additional_files): Likewise.
(g++_target_compile): Deal with them.
* lib/old-dejagnu.exp: Remove.
* g++.old-deja/old-deja.exp: Use dg.exp, not old-dejagnu.exp.
* g++.old-deja: Revise all tests to use dg commands.
From-SVN: r66317
+2003-04-30 Mark Mitchell <mark@codesourcery.com>
+
+ * lib/g++-dg.exp (g++-dg-test): Add "repo" option.
+ (dg-gpp-additional-sources): New function.
+ (dg-gpp-additional-files): Likewise.
+ * lib/g++.exp (additional_sources): New variable.
+ (additional_files): Likewise.
+ (g++_target_compile): Deal with them.
+ * lib/old-dejagnu.exp: Remove.
+ * g++.old-deja/old-deja.exp: Use dg.exp, not old-dejagnu.exp.
+ * g++.old-deja: Revise all tests to use dg commands.
+
2003-04-30 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/9432, c++/9528
-// Skip if not target: i?86-*-linux* i?86-*-freebsd*
-// Special g++ Options: -malign-double
+// { dg-do run { target i?86-*-linux* i?86-*-freebsd* } }
+// { dg-options "-malign-double" }
// Origin: Alex Samuel <samuel@codesourcery.com>
/* Test the data layout of C aggregates by checking aggregate size and
-// Skip if not target: i?86-*-linux* i?86-*-freebsd*
-// Special g++ Options: -malign-double
+// { dg-do run { target i?86-*-linux* i?86-*-freebsd* } }
+// { dg-options "-malign-double" }
// Origin: Alex Samuel <samuel@codesourcery.com>
/* Test the size and alignment of fundamental C types for compliance
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
-// Skip if not target: i?86-*-linux* i?86-*-freebsd*
-// Special g++ Options: -malign-double
+// { dg-do run { target i?86-*-linux* i?86-*-freebsd* } }
+// { dg-options "-malign-double" }
// Origin: Alex Samuel <samuel@codesourcery.com>
/* Test the layout of bitfields in C aggretagtes for compliance with
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 11 Apr 2001 <nathan@codesourcery.com>
+// { dg-do run }
// Test __cxa_vec routines
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 7 Apr 2000 <nathan@nathan@codesourcery.com>
-// Special g++ Options: -w
+// { dg-do run }
+// { dg-options "-w" }
// Origin: Mark Mitchell <mark@codesourcery.com>
#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 12 Apr 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 12 Apr 2001 <nathan@codesourcery.com>
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S {};
+// { dg-do run }
// Test to see that primary bases are selected correctly.
// Origin: Mark Mitchell <mark@codesourcery.com>
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
+// { dg-do run }
// Test rtti pointer flags
// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 15 Apr 2000 <nathan@nathan@codesourcery.com>
-// Special g++ Options: -fno-strict-aliasing
+// { dg-do run }
+// { dg-options "-fno-strict-aliasing" }
// Origin: Mark Mitchell <mark@codesourcery.com>
/* Generally, the lowest bit of the ptr is used to indicate whether a
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 16 Jan 2001 <nathan@codesourcery.com>
+// { dg-do run }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 5 Jun 2001 <nathan@codesourcery.com>
+// { dg-do run }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 5 Jun 2001 <nathan@codesourcery.com>
+// { dg-do run }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 9 Jun 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 12 Jun 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 12 Jun 2001 <nathan@codesourcery.com>
+// { dg-do run }
// Build don't run
//
// Copyright (C) 2001 Free Software Foundation, Inc.
-// Special g++ Options: -w
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 Jul 2001 <nathan@codesourcery.com>
-// Special g++ Options: -ansi -pedantic-errors -w
+// { dg-do run }
+// { dg-options "-ansi -pedantic-errors -w" }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Jun 2001 <nathan@codesourcery.com>
+// { dg-do run }
// Test rtti hint flags
// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 3 Apr 2000 <nathan@nathan@codesourcery.com>
+// { dg-do run }
+// { dg-options "-fno-strict-aliasing" }
// Test various aspects of vtable layout.
-// Special g++ Options: -fno-strict-aliasing
// Origin: Mark Mitchell <mark@codesourcery.com>
#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
+// { dg-do run }
+// { dg-options "-fno-strict-aliasing" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options: -fno-strict-aliasing
#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// { dg-do run }
+// { dg-gpp-additional-files "vtable3.h" }
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
// Check constructor vtables work.
-// Additional files: vtable3.h
#define A_EMPTY
#define B1_EMPTY
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// { dg-do run }
+// { dg-gpp-additional-files "vtable3.h" }
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
// Check constructor vtables work.
-// Additional files: vtable3.h
#define B1_EMPTY
#define B2_EMPTY
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// { dg-do run }
+// { dg-gpp-additional-files "vtable3.h" }
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
// Check constructor vtables work.
-// Additional files: vtable3.h
#define A_EMPTY
#define B2_EMPTY
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// { dg-do run }
+// { dg-gpp-additional-files "vtable3.h" }
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
// Check constructor vtables work.
-// Additional files: vtable3.h
#define A_EMPTY
#define B1_EMPTY
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// { dg-do run }
+// { dg-gpp-additional-files "vtable3.h" }
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
// Check constructor vtables work.
-// Additional files: vtable3.h
#define A_EMPTY
#define B1_EMPTY
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// { dg-do run }
+// { dg-gpp-additional-files "vtable3.h" }
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
// Check constructor vtables work.
-// Additional files: vtable3.h
#define A_EMPTY
#define B1_EMPTY
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// { dg-do run }
+// { dg-gpp-additional-files "vtable3.h" }
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
// Check constructor vtables work.
-// Additional files: vtable3.h
#define A_EMPTY
#define B1_EMPTY
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// { dg-do run }
+// { dg-gpp-additional-files "vtable3.h" }
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
// Check constructor vtables work.
-// Additional files: vtable3.h
#define A_EMPTY
#define B1_EMPTY
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// { dg-do run }
+// { dg-gpp-additional-files "vtable3.h" }
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
// Check constructor vtables work.
-// Additional files: vtable3.h
#define B1_EMPTY
#define B2_EMPTY
-// Copyright (C) 2000 Free Software Foundation, Inc.
+// { dg-do run }
+// { dg-gpp-additional-files "vtable3.h" }
+
+// Copyright (C) 2000, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 February 2001 <nathan@codesourcery.com>
// Check constructor vtables work.
-// Additional files: vtable3.h
#define B1_EMPTY
#define B2_EMPTY
+// { dg-do assemble }
// 981203 bkoz
// g++/13478
-// Build don't link:
class A {};
class AData {};
{
{0, &Agent::table_2},
{first, &Agent::foo},
- {last, &(hand)Agent::foo} // ERROR - no match
-}; // ERROR - cannot convert
+ {last, &(hand)Agent::foo} // { dg-error "" } no match
+}; // { dg-error "" } cannot convert
+// { dg-do assemble }
// 981203 bkoz
// g++/13523
-// Build don't link:
template<typename T> class latin_america;
+// { dg-do assemble }
// 981203 bkoz
// g++/13908
-// Build don't link:
class chile
{
{
//-edg: expected member name
//-g++: taking address of bound pointer-to-member expression
- foo = (void*) &(pobj->*pmethod); // ERROR -
+ foo = (void*) &(pobj->*pmethod); // { dg-error "" }
}
+// { dg-do assemble }
// 981203 bkoz
// g++/14309
// test for global functions, mf's, and templatized mf's.
-// Build don't link:
static int fooe_1(void) { return 5; }
static int fooe_2(int x = fooe_1()) { return x; }
+// { dg-do assemble }
// 981203 bkoz
// g++/14664 - test
-// Build don't link:
char foo[26];
{
//-g++: incompatible types in assignment of 'const char[]' to 'char[]'
//-edg: expression must be a modifiable lvalue
- foo = "0123456789012345678901234"; // ERROR - // ERROR -
+ foo = "0123456789012345678901234"; // { dg-error "" } // ERROR -
}
+// { dg-do assemble }
+// { dg-options "-fpermissive -w" }
// 981203 bkoz
// g++/14664 + test
-// Build don't link:
-// Special g++ Options: -fpermissive -w
char foo[26];
+// { dg-do run }
// 981203 bkoz
// g++/14687
+// { dg-do assemble }
+// { dg-options "-Wno-pointer-arith" }
// 981203 bkoz
// g++/15054
-// Build don't link:
-// Special g++ Options: -Wno-pointer-arith
// note that -pedantic also turns on this warning
void cuba(void) {
+// { dg-do run }
// 981203 bkoz
// g++/15071
// gcc invocation fails to link in libstdc++
+// { dg-do assemble }
+// { dg-options "-Wnon-virtual-dtor -Weffc++" }
// 981203 bkoz
// g++/15309
-// Build don't link:
-// Special g++ Options: -Wnon-virtual-dtor -Weffc++
class bahamian {
public:
};
class miami : public bahamian
-{ // WARNING - // WARNING -
+{ // { dg-warning "" } // WARNING -
public:
miami ();
~miami ();
+// { dg-do assemble }
+// { dg-options "-Wnon-virtual-dtor -Weffc++" }
// 981203 bkoz
// g++/15309
-// Build don't link:
-// Special g++ Options: -Wnon-virtual-dtor -Weffc++
-class bermuda { // WARNING - // WARNING -
+class bermuda { // { dg-warning "" } // WARNING -
public:
virtual int func1(int);
~bermuda();
+// { dg-do run }
+// { dg-options "-fno-const-strings" }
// 981203 bkoz
// g++/15351 - test
-// Special g++ Options: -fno-const-strings
#include <assert.h>
+// { dg-do run }
+// { dg-options "-fconst-strings" }
// 981203 bkoz
// g++/15351 + test
-// Special g++ Options: -fconst-strings
#include <assert.h>
+// { dg-do assemble }
+// { dg-options "-Wsign-promo" }
// 981203 bkoz
// g++/15756 test1
-// Build don't link:
-// Special g++ Options: -Wsign-promo
enum e_value { first = 0, next = 30 };
+// { dg-do assemble }
+// { dg-options "-Wsign-promo" }
// 981203 bkoz
// g++/15756 test2
-// Build don't link:
-// Special g++ Options: -Wsign-promo
// this test may only be valid for 32bit targets at present
#include <limits.h>
int main ()
{
- caracas obj_ei ( enum_int ); // WARNING -
- caracas obj_eui ( enum_uint ); // WARNING -
+ caracas obj_ei ( enum_int ); // { dg-warning "" }
+ caracas obj_eui ( enum_uint ); // { dg-warning "" }
caracas obj_i ( i );
caracas obj_ui ( ui );
+// { dg-do assemble }
// 981203 bkoz
// g++/15799 test1
-// Build don't link:
/*
15799.cpp: In function `void foo()':
class sanjose {
public:
sanjose();
- sanjose(const sanjose&); // ERROR - candidate
- sanjose(int_8 value); // ERROR - // ERROR -
- sanjose(uint_32 value); // ERROR - // ERROR -
+ sanjose(const sanjose&); // { dg-error "" } candidate
+ sanjose(int_8 value); // { dg-error "" } // ERROR -
+ sanjose(uint_32 value); // { dg-error "" } // ERROR -
};
enum { first, last};
void foo(void) {
- sanjose obj(first); // ERROR - // ERROR -
+ sanjose obj(first); // { dg-error "" } // ERROR -
}
+// { dg-do assemble }
// 981203 bkoz
// g++/15800 - test
-// Build don't link:
struct panama {
panama();
panama(panama &);
- panama& operator=(panama&); // ERROR - // ERROR -
+ panama& operator=(panama&); // { dg-error "" } // ERROR -
};
extern panama dig();
void foo() {
panama obj;
- obj = dig(); // ERROR - // ERROR -
+ obj = dig(); // { dg-error "" } // ERROR -
}
+// { dg-do assemble }
// 981203 bkoz
// g++/15800 + test
-// Build don't link:
struct panama {
panama();
+// { dg-do run }
// 981203 bkoz
// g++/15822
+// { dg-do assemble }
// 981203 bkoz
// g++/16077
-// Build don't link:
class nicaragua;
struct colombia {
void peace(const colombia&);
void foo(nicaragua& b) {
- peace(b); // WARNING - // WARNING -
+ peace(b); // { dg-warning "" } // WARNING -
}
+// { dg-do assemble }
// 981203 bkoz
// g++/16567
-// Build don't link:
typedef bool Bool;
typedef unsigned char Uint8;
control *fp = &obj;
e_ms result;
- result = (e_ms) fp->foo_1; // ERROR - // ERROR -
+ result = (e_ms) fp->foo_1; // { dg-error "" } // ERROR -
}
+// { dg-do assemble }
// 981204 bkoz
// g++/17922
-// Build don't link:
class base { };
+// { dg-do assemble }
// 981204 bkoz
// g++/17930
-// Build don't link:
char const one[] = "test";
-char const two[] = one; // ERROR - // ERROR -
+char const two[] = one; // { dg-error "" } // ERROR -
+// { dg-do assemble }
// 981204 bkoz
// g++/18208
-// Build don't link:
typedef unsigned int uint_32;
puertorico obj;
// Bug using static_cast<>
- ui = static_cast<uint_32>(obj); // ERROR - // ERROR -
+ ui = static_cast<uint_32>(obj); // { dg-error "" } // ERROR -
// Bug when missing the pair of braces
- ui = (uint_32) obj.f; // ERROR - // ERROR -
+ ui = (uint_32) obj.f; // { dg-error "" } // ERROR -
}
+// { dg-do run }
//980323 bkoz
//test for bools with inclusive ors
+// { dg-do run }
//980324 bkoz
//test for bool and bitwise ands
-// Build don't link:
+// { dg-do assemble }
//980610 bkoz
// example 1: buggy
-// Build don't link:
+// { dg-do assemble }
//980610 bkoz
// example 2: ok
-// Build don't link:
+// { dg-do assemble }
// prms-id: 12475
#include <limits.h>
#error "Unsupported test -- add new constants."
#endif
-enum huh { start =-TEST, next }; // WARNING -
+enum huh { start =-TEST, next }; // { dg-warning "" }
-// Build don't link:
-// Special g++ Options: -Wno-deprecated
+// { dg-do assemble }
+// { dg-options "-Wno-deprecated" }
// prms-id: 13417
class Foo {
explicit Foo (int){}
};
Foo f(10);
-Foo blat() return f(4){} // ERROR - named return value
+Foo blat() return f(4){} // { dg-error "" } named return value
-// Build don't link:
+// { dg-do assemble }
// prms-id: 13721
class A
-// Build don't link:
+// { dg-do assemble }
// 980604 bkoz
// 3.4.5 Class member access p 4
// nested and non-nested calls, no dtors
-// Build don't link:
+// { dg-do assemble }
//980529 bkoz
//3.4.5 Class member access via pointer and non-pointer
// non-nested dtor calls
-// Build don't link:
+// { dg-do assemble }
// prms-id: 13911
template<unsigned int N>
-// Build don't link:
+// { dg-do assemble }
//980519 bad error from nathan
//$ egcs -fhonor-std -nostdinc -c redef.C
//redef.C:56: redefinition of default argument for `class _Traits'
-// Build don't link:
+// { dg-do assemble }
// 980808-980824 bkoz
// template parameter redeclaration bugs
// 01
// declared friend template
-template <class T4>// ERROR - .*
+template <class T4>// { dg-error "" } .*
class Xone {
protected:
T4* next;
// can also do template-decl and then can ditch the foward-declaration
// template <class T5> friend bool isequal (Xone<T5>& lhs, Xone<T5>& rhs);
// this is not ok:
- template <class T4> friend bool isequal (Xone<T4>& lhs, Xone<T4>& rhs);// ERROR - .*
+ template <class T4> friend bool isequal (Xone<T4>& lhs, Xone<T4>& rhs);// { dg-error "" } .*
};
// 02
// nested template class
-template <class T6>// ERROR - .*
+template <class T6>// { dg-error "" } .*
class Xtwo {
protected:
T6* next;
Xtwo(): next(0), prev(0), value(1999){}
Xtwo(T6 init): value(init) {}
- template <class T6> class nested {// ERROR - .*
+ template <class T6> class nested {// { dg-error "" } .*
T6 value;
public:
nested(): value( T6(0)) {}
// 03
// member templates
-template <class T8>// ERROR - .*
+template <class T8>// { dg-error "" } .*
class Xthree {
protected:
T8* next;
Xthree(): next(0), prev(0), value(1999){}
Xthree(T8 init): value(init) {}
- template <class T8> T8 comp_ge(T8 test) {// ERROR - .*
+ template <class T8> T8 comp_ge(T8 test) {// { dg-error "" } .*
T8 local_value;
if (local_value > value)
return local_value;
// 04
// local names (14.6.1 p 4)
-template <class T10, int i> struct Xfour {// ERROR - .*
- int T10; // ERROR - .*
+template <class T10, int i> struct Xfour {// { dg-error "" } .*
+ int T10; // { dg-error "" } .*
void f(){
char T10;
}
void f();
};
-template <class T13, int i> void Xfive<T13,i>::f() {// ERROR - .*
- int T13; // ERROR - .*
+template <class T13, int i> void Xfive<T13,i>::f() {// { dg-error "" } .*
+ int T13; // { dg-error "" } .*
int T12; //should be ok
}
// 06
// multiple names at the same level
-template <class T14, class T14> class Xsix { // ERROR - .*
+template <class T14, class T14> class Xsix { // { dg-error "" } .*
private:
public:
void f();
// 07
// multiple names, one in template parameter one in class-name
-template <class T12> class T12; // ERROR - .*
+template <class T12> class T12; // { dg-error "" } .*
// 08
// with multiple template params, and second (third) one is redeclared
-template <class T16, int i, class T161> class Xseven { // ERROR - .*
+template <class T16, int i, class T161> class Xseven { // { dg-error "" } .*
private:
- char T161; // ERROR - .*
+ char T161; // { dg-error "" } .*
public:
template <class U>
friend bool fooy(U u);
template <class T161>
friend bool foo(T161 u)
{
- Xseven<T161, 5, int> obj; // ERROR - .*
- return (obj.inst == u.inst); // ERROR - .*
+ Xseven<T161, 5, int> obj; // { dg-error "" } .*
+ return (obj.inst == u.inst); // { dg-error "" } .*
}
};
// 10
// check for non-type parameters, should still be able to redeclare?
// local names (14.6.1 p 4)
-template <class T18, int i> class Xten {// ERROR - .*
- float i; // ERROR - .*
+template <class T18, int i> class Xten {// { dg-error "" } .*
+ float i; // { dg-error "" } .*
};
// 11
// declared friend template, non-type parameters
-template <long l>// ERROR - .*
+template <long l>// { dg-error "" } .*
class Xeleven {
public:
- template <long l> friend bool isequal (Xeleven<5> lhs, Xeleven<5> rhs); // ERROR - .*
+ template <long l> friend bool isequal (Xeleven<5> lhs, Xeleven<5> rhs); // { dg-error "" } .*
};
// 12
// nested template class, non-type parameters
-template <long l>// ERROR - .*
+template <long l>// { dg-error "" } .*
class Xtwelve {
public:
- template <long l> class nested {// ERROR - .
+ template <long l> class nested {// { dg-error "" } .
long value;
public:
nested(): value(0) {}
// 13
// member templates, non-type parameters
-template <long l>// ERROR - .*
+template <long l>// { dg-error "" } .*
struct Xthirteen {
- template <long l> long comp_ge(long test) {// ERROR - .
+ template <long l> long comp_ge(long test) {// { dg-error "" } .
long local_value;
- if (local_value > value) // ERROR - .*
+ if (local_value > value) // { dg-error "" } .*
return local_value;
else
- return value; // ERROR - .*
+ return value; // { dg-error "" } .*
}
};
-// Build don't link:
+// { dg-do assemble }
// 980827 bkoz
// template parameter redeclaration bugs, part two:
// template template params and expanded template non-type parms
// 14
// declared friend template (v3, template type parameters)
-template <class T4>// ERROR - .*
+template <class T4>// { dg-error "" } .*
class Xfourteen {
protected:
T4 value;
public:
Xfourteen(T4 init): value(init) {}
- template <template <typename T4> class T5> // ERROR - .*
+ template <template <typename T4> class T5> // { dg-error "" } .*
friend bool isequal (Xfourteen<int>& lhs, Xfourteen<int>& rhs);
};
// 15
// nested template class (v3, template type parameters)
-template <class T6>// ERROR - .*
+template <class T6>// { dg-error "" } .*
class Xfifteen {
protected:
T6 value;
public:
Xfifteen(T6 init): value(init) {}
- template <template <typename T6> class T7> class nested {// ERROR - .*
+ template <template <typename T6> class T7> class nested {// { dg-error "" } .*
int value;
public:
nested(): value( int(0)) {}
// 16
// member templates (v3, template type parameters)
-template <class T8>// ERROR - .*
+template <class T8>// { dg-error "" } .*
class Xsixteen {
protected:
T8 value;
public:
Xsixteen(T8 init): value(init) {}
- template <template <typename T8> class T9> int comp_ge(int test) {// ERROR - .*
+ template <template <typename T8> class T9> int comp_ge(int test) {// { dg-error "" } .*
int local_value;
if (local_value > value)
return local_value;
// 18
// more template template redecl tests
-template <typename T14, template <typename T15> class C12>// ERROR - .*
+template <typename T14, template <typename T15> class C12>// { dg-error "" } .*
class Xeighteen {
protected:
C12<T14> value;
- int C12; // ERROR - .*
+ int C12; // { dg-error "" } .*
};
// 19
// more template template redecl tests
-template <typename T16, template <typename T17> class C14>// ERROR - .*
+template <typename T16, template <typename T17> class C14>// { dg-error "" } .*
class Xnineteen{
protected:
C14<T16> value;
- template <class C14> class nested {// ERROR - .*
+ template <class C14> class nested {// { dg-error "" } .*
T16 value;
public:
nested(): value( T16(0)) {}
// non-type template parameters v1: enum
enum my_enum {my_A = 45, my_B, my_C};
-template <my_enum T18> class Xtwentyone {// ERROR - .*
- float T18; // ERROR - .*
+template <my_enum T18> class Xtwentyone {// { dg-error "" } .*
+ float T18; // { dg-error "" } .*
};
int ret_gcount() {return gcount;}
};
-template <class T20, base* b> class Xtwentytwo {// ERROR - .*
- float b; // ERROR - .*
+template <class T20, base* b> class Xtwentytwo {// { dg-error "" } .*
+ float b; // { dg-error "" } .*
};
// 23
// non-type template parameters v2: reference to object
-template <class T20, base& b2> class Xtwentythree {// ERROR - .*
- float b2; // ERROR - .*
+template <class T20, base& b2> class Xtwentythree {// { dg-error "" } .*
+ float b2; // { dg-error "" } .*
};
// 24
// non-type template parameters v3: pointer to member
-template <class T20, int base::* b3> class Xtwentyfour {// ERROR - .*
- float b3; // ERROR - .*
+template <class T20, int base::* b3> class Xtwentyfour {// { dg-error "" } .*
+ float b3; // { dg-error "" } .*
};
// 25
// non-type template parms that use push_class_level
-template <class T22> void f1() {// ERROR - .*
+template <class T22> void f1() {// { dg-error "" } .*
struct foo {
- enum T22 { un, du, toi }; // ERROR - .*
+ enum T22 { un, du, toi }; // { dg-error "" } .*
};
}
+// { dg-do assemble }
// 980924 bkoz
// just a quick test for export, to make sure we are warning for it.
// CHANGE ME when it's supported
-// Build don't link:
// 14 Templates
// 1
// template definition
-export template <class T> // WARNING -
+export template <class T> // { dg-warning "" }
bool templ_one(T a) {
if (a > 0)
return true;
template <class T2> bool compare_ge(T2 test);
};
-export template <class T> // WARNING -
+export template <class T> // { dg-warning "" }
const bool X_one<T>::is_specialized = false;
-export template <class T> // WARNING -
+export template <class T> // { dg-warning "" }
unsigned short X_one<T>::ret_id() {
return id;
}
-export template <class T2> // WARNING -
+export template <class T2> // { dg-warning "" }
bool compare_ge(T2 test) {
- if (test > type) // ERROR - .*
+ if (test > type) // { dg-error "" } .*
return true;
return false;
}
+// { dg-do run }
// 980945 bkoz
// test for correct operators at link time
+// { dg-do run }
template <class T>
class Foo
-// Build don't link:
+// { dg-do assemble }
//980205 bkoz
//7.1.3 the typedef specifier
typedef I I;
//p3--cannot redefine to a different type in a given scope
-class complex2 { /* ... */ };// ERROR - .*
-typedef int complex2;// ERROR - .*
-typedef int complex3;// ERROR - .*
-class complex3 { /* ... */ };// ERROR - .*
+class complex2 { /* ... */ };// { dg-error "" } .*
+typedef int complex2;// { dg-error "" } .*
+typedef int complex3;// { dg-error "" } .*
+class complex3 { /* ... */ };// { dg-error "" } .*
//p4
typedef struct S T;
S a = T(); // OK
-struct T * p; // ERROR - using typedef after struct
+struct T * p; // { dg-error "" } using typedef after struct
//case01
-typedef bool short;// ERROR - .*
+typedef bool short;// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
//980526 bkoz
// reduced testcase for 980511 brendan qt bug
+// { dg-do run }
// 980617 bkoz
// typeid for local types
// typeid bool vs int and enum vs int
-// Build don't link:
-// Special g++ Options: -Wall -Weffc++
+// { dg-do assemble }
+// { dg-options "-Wall -Weffc++" }
//1 g++/12952 un-named variables in a catch block
//Wall or Wunused should not give warnings here
virtual long retcntr() {return counter;};
Mutex2(int i = 0): counter(i) {};
virtual ~Mutex2() {};
-} __attribute__ ((warn)); // WARNING -
+} __attribute__ ((warn)); // { dg-warning "" }
+// { dg-do assemble }
+// { dg-options "-Wredundant-decls" }
// 980413 bkoz
// from g++/15307, tests for -Wredundant-decls
// for friend functions and functions
-// Build don't link:
-//Special g++ Options: -Wredundant-decls
extern int foo(const char *);
class C
{
friend int foo(const char *);
- friend int foo(const char *); // WARNING -
+ friend int foo(const char *); // { dg-warning "" }
int foo2() {return b;}
int b;
};
{
public:
int foo2() {return b;}
- int foo2() {return b;} // ERROR -
+ int foo2() {return b;} // { dg-error "" }
int b;
};
{
public:
int foo2();
- int foo2(); // ERROR -
+ int foo2(); // { dg-error "" }
int b;
};
-extern int foo3(const char *); // WARNING -
-extern int foo3(const char *); // WARNING -
+extern int foo3(const char *); // { dg-warning "" }
+extern int foo3(const char *); // { dg-warning "" }
+// { dg-do assemble }
+// { dg-options "-Wredundant-decls" }
// 980420 bkoz
// from g++/15307, tests for -Wredundant-decls for decls
-// Build don't link:
-// Special g++ Options: -Wredundant-decls
//shouldn't crash
extern unsigned char *foo5[];
+// { dg-do assemble }
+// { dg-options "-Wno-non-template-friend" }
// 980903 bkoz
// make sure this option works
-// Build don't link:
-// Special g++ Options: -Wno-non-template-friend
template<class T> class task {
-// Build don't link:
+// { dg-do assemble }
char *stuff() {
- char array[10]; // WARNING -
+ char array[10]; // { dg-warning "" }
return array;
}
-// Build don't link:
+// { dg-do assemble }
extern const int a[];
extern const int a[];
extern const int a[];
+// { dg-do assemble }
// prms-id: 9028
class Foo;
int i=0;
switch (i)
{
- case ((Foo *)0): // ERROR -
- case ((Foo *)1): // ERROR -
+ case ((Foo *)0): // { dg-error "" }
+ case ((Foo *)1): // { dg-error "" }
break;
}
}
-// Build don't link:
+// { dg-do assemble }
// prms-id: 9866
class TChar
{
+// { dg-do run }
// prms-id: 7330
#include <stddef.h>
int size = 0;
-// Build don't link:
+// { dg-do assemble }
extern "C" {
class A {
public:
+// { dg-do assemble }
class C {
public:
- static friend int f(); // ERROR -
+ static friend int f(); // { dg-error "" }
};
+// { dg-do assemble }
// prms-id: 5274
class VHDLIdentifier;
int
VHDLPackageProtoRep::thing()
{
- form("package `%s'", (char *)actual_name()); // ERROR - can't convert from incomplete type
+ form("package `%s'", (char *)actual_name()); // { dg-error "" } can't convert from incomplete type
return 0;
}
-// Build don't link:
+// { dg-do assemble }
class A {
char str[10];
public:
class B : public A {
public:
- char* m1 () { C::m1(); return ""; } // ERROR -
+ char* m1 () { C::m1(); return ""; } // { dg-error "" }
};
int main () {
-// Build don't link:
+// { dg-do assemble }
#include <stdlib.h>
class A {
void z();
A(void) {}
private:
- A(const A &) { abort(); } // ERROR -
+ A(const A &) { abort(); } // { dg-error "" }
const A& operator =(const A &) { abort(); }
};
void g() {
B h;
- f(h); // ERROR -
+ f(h); // { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
struct A {
struct B {
+// { dg-do run }
int
main() {
struct s
-// Build don't link:
+// { dg-do assemble }
class A {
public:
int i;
B b(3);
int
main() {
- A *z = &b; // ERROR -
+ A *z = &b; // { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
class A {
public:
static int a;
static int b;
};
-int B::a; // ERROR -
+int B::a; // { dg-error "" }
-// Build don't link:
+// { dg-do assemble }
// prms-id: 10038
template < class Referencee >
class Referencer
-// Build don't link:
+// { dg-do assemble }
// prms-id: 10046
template <class T>
class Array
-// Build don't link:
+// { dg-do assemble }
// prms-id: 9979
template < class Referencee >
+// { dg-do run }
// prms-id: 10166
template <class A>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed abstract-functions
class O
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed access-control
class Base
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed extensions
struct bar { int bit : 1; };
void foo (int *r, bar t)
{
// doing alignof on a bit-field should be illegal
- __alignof__ (t.bit);// ERROR - .*
+ __alignof__ (t.bit);// { dg-error "" } .*
// both of these (a regular ref and an INDIRECT_REF) should work
__alignof__ (r);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed ambiguity
struct A {
A (int);
B (int);
};
-void myfunc (const A& t0); // ERROR -
-void myfunc (const B& t0); // ERROR -
+void myfunc (const A& t0); // { dg-error "" }
+void myfunc (const B& t0); // { dg-error "" }
int main ()
{
- myfunc(1); // ERROR - ambiguous call
+ myfunc(1); // { dg-error "" } ambiguous call
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed anonymous-unions
static union {
char* uC;
private:
- int uI;// ERROR - .*private member.*
+ int uI;// { dg-error "" } .*private member.*
};
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// GROUPS passed ARM-compliance
// ARM $5.7, it's illegal to do math on a `void*'.
main()
{
void *p;
- ++p;// ERROR - .*
+ ++p;// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed ARM-compliance
// ARM 9.4 ``There cannot be a static and a nonstatic member function
// with the same name and the same argument types.''
class X {
public:
int foo();
- static int foo(); // error: redeclaration// ERROR - .*
+ static int foo(); // error: redeclaration// { dg-error "" } .*
};
class Y {
public:
static int foo();
- int foo(); // error: redeclaration// ERROR - .*
+ int foo(); // error: redeclaration// { dg-error "" } .*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
// ARM $11.4: A function first declared in a friend decl is equivalent
// to an extern decl, so the below is illegal.
class X {
- friend g(); // ERROR - previous declaration
+ friend g(); // { dg-error "" } previous declaration
};
-static g() { return 1; }// ERROR - previously declared
+static g() { return 1; }// { dg-error "" } previously declared
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed arm
int a, b;
// declaring an array of references should be illegal
-int & v[ 2] = { a, b};// ERROR - .*
+int & v[ 2] = { a, b};// { dg-error "" } .*
-// Build don't link:
-// Special g++ Options: -fconserve-space -fcommon
+// { dg-do assemble }
+// { dg-options "-fconserve-space -fcommon" }
// GROUPS passed array-bindings
extern "C" int printf (const char *, ...);
-char array[~(~0ul>>1)|~(0ul>>3)]; // ERROR - overflow in array dimension.*
+char array[~(~0ul>>1)|~(0ul>>3)]; // { dg-error "" } overflow in array dimension.*
int main () { printf ("PASS\n"); return 0; }
-// Build don't link:
-// Special g++ Options: -S
+// { dg-do assemble { target sparc-sun-* } }
+// { dg-options "-S" }
// GROUPS passed asm-extension
-// Skip if not target: sparc-sun-*
// This used to crash because c_expand_asm_keyword didn't know what to
// do with this. The parser rules were changed to accept an expr, instead
// of a stmt.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed bit-fields
struct bar {
- int : 2 = 1;// ERROR - .*
+ int : 2 = 1;// { dg-error "" } .*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed bit-fields
struct {
char c;
int main()
{
- int &ir = s.i; // ERROR - address of bitfield
- int *ip = &s.i; // ERROR - address of bitfield
+ int &ir = s.i; // { dg-error "" } address of bitfield
+ int *ip = &s.i; // { dg-error "" } address of bitfield
ir = 10;
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed boolean
int
main()
+// { dg-do run }
// GROUPS passed code-generation
// Check that sub-word sized structs/classes are passed correctly
// if the struct/class has a constructor (i.e. ANY constructor).
+// { dg-do run }
// GROUPS passed code-generation
// Check that declarations with initializations are executed
// correctly.
+// { dg-do run }
// GROUPS passed code-generation
// Check that passing things which are not a multiple of
// 4 bytes in size doesn't mess up other subsequent parameters.
-// Special g++ Options: -O
+// { dg-do run }
+// { dg-options "-O" }
// GROUPS passed code-generation
// Options: -O
//
+// { dg-do run }
// GROUPS passed code-generation
// Check that type float parameters can be correctly passed to
// methods.
-// Special g++ Options:
+// { dg-do run }
+// { dg-options "" }
// This test makes sure that the stuff in lex.c (real_yylex) is
// set up to handle real and imag numbers correctly. This test is against
+// { dg-do run }
// GROUPS passed copy-ctors
extern "C" int printf (const char *, ...);
int count = 0;
+// { dg-do run }
// GROUPS passed copy-ctors
/*
The old g++ output is
+// { dg-do run }
// GROUPS passed copy-ctors
/*
+// { dg-do run }
// GROUPS passed copy-ctors
// Using Cfront 3.0.1 the programm below prints
//
+// { dg-do run }
// GROUPS passed copy-ctors
/*
bad:
+// { dg-do run }
// GROUPS passed copy-ctors
/*
g++ 2.3.3 will prefer using type conversions over the
+// { dg-do run }
// GROUPS passed copy-ctors
extern "C" int printf (const char *, ...);
extern "C" void exit (int);
+// { dg-do run }
// GROUPS passed copy-ctors
/*
This report is for GCC 2.3.3 running on a Sun/4. The bug is that when
+// { dg-do run }
// GROUPS passed copy-ctors
#include <iostream>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class D_Interval;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class word
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
extern "C" int printf (const char *, ...);
class A {
- int i; // ERROR - private
- int j; // ERROR - private
+ int i; // { dg-error "" } private
+ int j; // { dg-error "" } private
public:
int h;
A() { i=10; j=20; }
virtual void f1() { printf("i=%d j=%d\n",i,j); }
- friend virtual void f2() { printf("i=%d j=%d\n",i,j); }// ERROR - virtual.*
+ friend virtual void f2() { printf("i=%d j=%d\n",i,j); }// { dg-error "" } virtual.*
};
class B : public A {
public:
- virtual void f1() { printf("i=%d j=%d\n",i,j); }// ERROR - member.*// ERROR - member.*
- friend virtual void f2() { printf("i=%d j=%d\n",i,j); }// ERROR - virtual.*// ERROR - member.*// ERROR - member.*
+ virtual void f1() { printf("i=%d j=%d\n",i,j); }// { dg-error "" } member.*// ERROR - member.*
+ friend virtual void f2() { printf("i=%d j=%d\n",i,j); }// { dg-error "" } virtual.*// ERROR - member.*// ERROR - member.*
};
int
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class X
{
X(int j);
}
-X *x = new X[10]();// ERROR - .*
+X *x = new X[10]();// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-Wreturn-type" }
// GROUPS passed old-abort
-// Special g++ Options: -Wreturn-type
class gen_op
{
public:
{
gen_op U1;
U1 = Fe();
-} // ERROR - reaches end of non-void function
+} // { dg-error "" } reaches end of non-void function
int
main () {}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
extern "C" int printf (const char *, ...);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
#include <iostream>
main() {
std::cout << "starting\n";
B b;
- b.~A();// ERROR - destructor
+ b.~A();// { dg-error "" } destructor
std::cout << "done\n";
}
-// Build don't link:
+// { dg-do assemble { xfail *-*-* } }
// GROUPS passed old-abort
-// crash test - XFAIL *-*-*
class Graph {
public:
unsigned char N;
- Graph(void) {}; // ERROR - previously defined here
+ Graph(void) {}; // { dg-error "" } previously defined here
}
Graph::Graph(void)
-{ N = 10;// ERROR - return type.*
+{ N = 10;// { dg-error "" } return type.*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
//
// This one creates
virtual ~GnWidget();
};
-class GnOptionGroup : public GnObject, public GnWidget {// ERROR - warning
+class GnOptionGroup : public GnObject, public GnWidget {// { dg-error "" } warning
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
typedef int element;
class Pix {
// Friend functions so that v == x works as does x == v works
friend int operator==(void *v, const Pix& x)
- { return v == index; }// ERROR - .*
+ { return v == index; }// { dg-error "" } .*
friend int operator==(void *v, const Pix& x)
- { return v != index; }// ERROR - .*
+ { return v != index; }// { dg-error "" } .*
private:
// friend class List<T>;
- element *index; // ERROR - invalid use of member
+ element *index; // { dg-error "" } invalid use of member
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
// The compiler used to crash on this example.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
#include <complex>
typedef std::complex<double> Complex;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
struct A {
void a1();
};
struct B {
- void A::a1(); // this used to die in chainon(), now grokdeclarator should// ERROR - cannot declare.*
- void A::a2(); // should be fixed by the 930629 change.// ERROR - cannot declare.*
+ void A::a1(); // this used to die in chainon(), now grokdeclarator should// { dg-error "" } cannot declare.*
+ void A::a2(); // should be fixed by the 930629 change.// { dg-error "" } cannot declare.*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
// This used to die in chainon; it shouldn't any more.
void f ();
void g (int);
};
- void B::f () {}// ERROR - .*
- void B::g (int val) {}// ERROR - .*
+ void B::f () {}// { dg-error "" } .*
+ void B::g (int val) {}// { dg-error "" } .*
};
-// Build don't link:
-// Special g++ Options: -O
+// { dg-do assemble }
+// { dg-options "-O" }
// GROUPS passed old-abort
// gcc puts the array into a register, and then the store_bit_field () code
// in expmed.c gets confused when it tries to store zero past the end of the
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class memo{
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
struct B {
B();
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class First {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class abc
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
union Value
};
struct GlobalAddress
-{// ERROR - candidates .*
- GlobalAddress(Value *nvar){}// ERROR - .*
+{// { dg-error "" } candidates .*
+ GlobalAddress(Value *nvar){}// { dg-error "" } .*
};
int
main()
{
- new GlobalAddress(Value()); // internal error occured here// ERROR - no matching function .*
+ new GlobalAddress(Value()); // internal error occured here// { dg-error "" } no matching function .*
//new GlobalAddress(new Value()); // This line is correct code
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
int strcmp();
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
#include <string>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
struct mbuf {
struct mbuf *next;
-// Build don't link:
-// Special g++ Options: -fshort-enums
+// { dg-do assemble }
+// { dg-options "-fshort-enums" }
// GROUPS passed old-abort
enum Bool { FALSE, TRUE };
Bool foo () { return TRUE; }
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
extern void foo(void *);
int
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
-operator int () {}// ERROR - .*// ERROR - .*
+operator int () {}// { dg-error "" } .*// ERROR - .*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
const unsigned int ENET_INTERRUPT_MID = 5;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
struct wait { int w_status; };
int wait();
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
typedef int _sigset_t;
extern "C" {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
/*
I received the following message when using g++ (version 2.3.3):
-// Build don't link:
-// Special g++ Options: -w
+// { dg-do assemble }
+// { dg-options "-w" }
// GROUPS passed old-abort
//#include <GetOpt.h>
#include <stdio.h>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
typedef struct Thing {
Thing();
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class foo {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
typedef void (**ppfn)(void);
+// { dg-do assemble }
// GROUPS passed old-abort
-// Build don't link:
-int fn();// ERROR - ambiguates.*
+int fn();// { dg-error "" } ambiguates.*
int x;
-int& fn() {// ERROR - new decl.*
+int& fn() {// { dg-error "" } new decl.*
return x;}
-// Build don't link:
-// Special g++ Options: -g
+// { dg-do assemble { xfail sparc64-*-elf } }
+// { dg-options "-g" }
// GROUPS passed old-abort
-// excess errors test - XFAIL sparc64-*-elf
extern "C" { typedef int jmp_buf[12]; }
enum Error { NO_ERROR };
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
template <class T> class bug {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
void foo() { static const char *const v[] = { 0 }; }
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class Rational {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
const int TRUE = 1;
const int FALSE = 0;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
-class internal { // ERROR - candidates are
+class internal { // { dg-error "" } candidates are
int field;
int anotherfield;
};
-class bug { // ERROR - several errors
+class bug { // { dg-error "" } several errors
internal* numbers;
bug(int size);
};
bug::bug(int size)
-{ // ERROR - candidates
- numbers = new internal(size * size);// ERROR - no match.*
+{ // { dg-error "" } candidates
+ numbers = new internal(size * size);// { dg-error "" } no match.*
}
int
main()
{
- bug test;// ERROR - no match
+ bug test;// { dg-error "" } no match
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
#include<iostream>
const int key[keys] = {6, key[1], 2, keys, 1, 7, 6, key[2], key[8]};
void main()
-{ // ERROR - return type for main
+{ // { dg-error "" } return type for main
for(int i = 0; i < keys;) std::cout << key[i++] << " ";
std::endl(std::cout);
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
// Should have been fixed by:
//
int i, j;
Dummy foo;
- bs1+=&foo;// ERROR - no .*
+ bs1+=&foo;// { dg-error "" } no .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class B
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class obj;
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-Wreturn-type" }
// GROUPS passed old-abort
-// Special g++ Options: -Wreturn-type
#include <iostream>
class A {
public:
- friend A f(A &a);// ERROR - ambiguates.*
+ friend A f(A &a);// { dg-error "" } ambiguates.*
};
-A &f(A &a) {// ERROR - new decl.*
+A &f(A &a) {// { dg-error "" } new decl.*
std::cout << "Blah\n";
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class A
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
int main()
{
int a[100], **p;
- p = &a[50];// ERROR - assignment to.*
+ p = &a[50];// { dg-error "" } assignment to.*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
- extern f(int);// ERROR - ambiguates.*
+ extern f(int);// { dg-error "" } ambiguates.*
int& f(int x)
- {// ERROR - new declaration.*
- int local;// ERROR - warning
+ {// { dg-error "" } new declaration.*
+ int local;// { dg-error "" } warning
local = x+2;
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// GROUPS passed old-abort
-// Special g++ Options:
const bool FALSE = 0;
const bool TRUE = 1;
public:
Vix();
friend int operator==(void *v, const Vix& x)
- { return v == x.item; }// ERROR - list of candidates
+ { return v == x.item; }// { dg-error "" } list of candidates
friend int operator==(const Vix& x, void *v)
- { return v == x.item; }// ERROR - candidate for call
+ { return v == x.item; }// { dg-error "" } candidate for call
friend int operator!=(void *v, const Vix& x)
{ return v != x.item; }
friend int operator!=(const Vix& x, void *v)
{ return v != x.item; }
friend int operator==(const Vix& x1, const Vix& x2)
- { return x1.owner == x2.owner && x1.item == x2.item; }// ERROR - candidate for call
+ { return x1.owner == x2.owner && x1.item == x2.item; }// { dg-error "" } candidate for call
friend int operator!=(const Vix& x1, const Vix& x2)
{ return x1.owner != x2.owner || x1.item != x2.item; }
bool first;
void first(Vix& x) const
{ ListDProto::first(x); };
void next(Vix& x, ListDProto::Action a = NORMAL) const
- { ListDProto::next(x, a); }// ERROR - .*// ERROR - .*
+ { ListDProto::next(x, a); }// { dg-error "" } .*// ERROR - .*
Vix last() const
{ return ListDProto::last(); }
void last(Vix& x) const
typename ListD<T>::Action a = this->NORMAL;
Vix x;
for (first(x); 0 != x && this->REMOVE_CURRENT != a; next(x, a))
- a = operator()(x) == item ? this->REMOVE_CURRENT: this->NORMAL; // ERROR - .*
+ a = operator()(x) == item ? this->REMOVE_CURRENT: this->NORMAL; // { dg-error "" } .*
}
template<class T>
bool
{
Vix x;
for (first(x); 0 != x; next(x)) {
- if (operator()(x) == item)// ERROR - .*
+ if (operator()(x) == item)// { dg-error "" } .*
return TRUE;
}
return FALSE;
class IcaseString: public String { };
template <> class SetLD< IcaseString >: public SetLD< String > { public: SetLD (): SetLD< String >() { }; SetLD (const ListD< IcaseString >& other): SetLD< String >() { ListD< IcaseString >::Vix x; for (other.first(x); 0 != x; other.next(x)) add(other(x)); }; SetLD (const SetLD & other): SetLD< String >(other) { }; const IcaseString & operator()(const Vix& x) const { return ( IcaseString &) SetLD< String >::operator()(x); } }; typedef SetLD< String > SetLD_String_IcaseString_old_tmp99; typedef SetLD< IcaseString > SetLD_String_IcaseString_new_tmp99;
inline int operator== (const SetLD_String_IcaseString_new_tmp99& a, const SetLD_String_IcaseString_new_tmp99& b)
-{// ERROR - candidate for call
+{// { dg-error "" } candidate for call
const SetLD_String_IcaseString_old_tmp99& oa = a;
const SetLD_String_IcaseString_old_tmp99& ob = b;
return operator== (oa, ob); }
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class foo {
private:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class X {
public:
void doit();
};
-X::::doit()// ERROR - (syntax|parse) error.*
+X::::doit()// { dg-error "" } (syntax|parse) error.*
{
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
// Should be fixed by:
// Sun Jun 13 12:55:22 1993 Brendan Kehoe (brendan@lisa.cygnus.com)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class X
{
// Note that we mistakenly initialize the array data member as if it
// was scalar
-X::X () : f (0) {}// ERROR - .*
+X::X () : f (0) {}// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
template <class TP> class sapp { };
class foo {};
- extern foo& __iomanip_setw (foo&, TP);// ERROR - type spec.*
+ extern foo& __iomanip_setw (foo&, TP);// { dg-error "" } type spec.*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
#include <iostream>
// Call to this function results in a bus error in fubar when the 1st
// arg is dereferenced.
//
- fubar(die, "Second line.");// ERROR - cannot convert .die.*
+ fubar(die, "Second line.");// { dg-error "" } cannot convert .die.*
return 1;
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class String
{
UnitList (...);
};
-UnitList unit_list (String("keV")); // WARNING - cannot pass non-pod
+UnitList unit_list (String("keV")); // { dg-warning "" } cannot pass non-pod
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
typedef long unsigned int size_t;
typedef void (*RF_Ptr)(void *);
static _type_desc _type_metatype("metatype", sizeof(metatype),
(RF_Ptr)0, 0, 1, 1,
- _im_pers_mem_spec( ((size_t)&((( metatype *)0)-> base_list )) , 1)); // WARNING - cannot pass non-pod
+ _im_pers_mem_spec( ((size_t)&((( metatype *)0)-> base_list )) , 1)); // { dg-warning "" } cannot pass non-pod
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class X {
public:
class Y : public X {
public:
- using X::xy;// ERROR - no memb.*
+ using X::xy;// { dg-error "" } no memb.*
- using X::z;// ERROR - no memb.*
+ using X::z;// { dg-error "" } no memb.*
};
-// Build don't link:
-// Special g++ Options: -O
+// { dg-do assemble }
+// { dg-options "-O" }
// GROUPS passed old-abort
typedef unsigned char uchar;
typedef unsigned short ushort;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
#pragma comment(exestr, "@(#) errno.h 10.2 92/03/26 ")
-// Build don't link:
-// Special g++ Options: -w -O
+// { dg-do assemble }
+// { dg-options "-w -O" }
// GROUPS passed old-abort
class RWDlist
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template<class T>
int size () { return sz; }
};
-template<class T>// ERROR - previous definition of T
+template<class T>// { dg-error "" } previous definition of T
struct Comparator
{
- typedef T T;// ERROR - use of template type T in typedef to T
+ typedef T T;// { dg-error "" } use of template type T in typedef to T
static int lessthan (T &a, T &b) { return a < b; }
};
template<class Comp>
struct Sort
{
- static void sort (Vector<Comp::T> &);// ERROR - use of bad T
+ static void sort (Vector<Comp::T> &);// { dg-error "" } use of bad T
};
template<class Comp>
-void Sort<Comp>::sort (Vector<Comp::T> &v)// ERROR - use of bad T
+void Sort<Comp>::sort (Vector<Comp::T> &v)// { dg-error "" } use of bad T
{
int n = v.size ();
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
template<int a, int b>
class Elvis
-{ // ERROR - in template.*
+{ // { dg-error "" } in template.*
} ;
template<int a>
class Elvis<0>
-{ // ERROR - incorrect number of parameters
+{ // { dg-error "" } incorrect number of parameters
int geta() { return a ; }
} ;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
class A {};
A* mesh;
};
-SimQuery::SimQuery():scaling(A) {}// ERROR - .*
+SimQuery::SimQuery():scaling(A) {}// { dg-error "" } .*
SimQuery::~SimQuery() {}
int SimQuery::SetMeshFile(char name[])
{
- mesh = new C;// ERROR - .*
+ mesh = new C;// { dg-error "" } .*
return 0; // needed to avoid warning of reaching end of non-void fn
}
+// { dg-do run }
// GROUPS passed constructors
// Check that global level object constructors get called.
+// { dg-do run }
// GROUPS passed constructors
// Check that sub-words sized class members are correctly set
// by constructors.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
class A;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
#include <iostream>
class Thing
{
public:
- typedef enum { GOOD_THING, BAD_THING, } ThingType ; // ERROR - comma
+ typedef enum { GOOD_THING, BAD_THING, } ThingType ; // { dg-error "" } comma
Thing (ThingType type) : thingType (type) { }
~Thing () { }
private:
class Group
{
public:
- typedef enum { THIS_GROUP, THAT_GROUP, } GroupType ; // ERROR - comma
+ typedef enum { THIS_GROUP, THAT_GROUP, } GroupType ; // { dg-error "" } comma
Group (GroupType type) : groupType (type), groupCount (0) { }
~Group () { }
void append (Thing* const &entry) { groupCount ++ ; }
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
void f(const short & s) { }
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
class GttObject {};
class GctObject: virtual public GttObject {};
class nnyacc
{
public:
- static void assign(void*& lval, void*& rval); // ERROR - candidates
+ static void assign(void*& lval, void*& rval); // { dg-error "" } candidates
};
void
foo (bar yylval, bar *yyvsp)
{
- nnyacc::assign(yylval.valueList, yyvsp[0].valueList);// ERROR -
+ nnyacc::assign(yylval.valueList, yyvsp[0].valueList);// { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
class A {};
+// { dg-do assemble }
// GROUPS passed conversions
-// Build don't link:
typedef unsigned long Array[3];
void sample(const unsigned long (&an_array)[3]);
-// Build don't link:
+// { dg-do assemble }
// PRMS Id: 10860
class Beige
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed default-functions
class dictionary {
public:
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// GROUPS passed operator-delete
/* ARM $5.3.4 */
void f(char *p, char *q[], const char *r, const char *s[])
{
- delete 0; /* illegal: non-pointer */// ERROR - .*expected pointer.*
+ delete 0; /* illegal: non-pointer */// { dg-error "" } .*expected pointer.*
delete (char*)0; /* no effect */
delete p;
delete[] q;
- delete[4] q; /* ANSI forbids size arg */// ERROR - anachronistic .*
+ delete[4] q; /* ANSI forbids size arg */// { dg-error "" } anachronistic .*
delete r; /* no longer illegal: const */
delete[] s;
- delete[4] s; /* ANSI forbids size arg */// ERROR - anachronistic.*
+ delete[4] s; /* ANSI forbids size arg */// { dg-error "" } anachronistic.*
}
+// { dg-do run }
// GROUPS passed operator-delete
// Check that using the delete operator with a null pointer
// is allowed (as called for by The Book, pg. 259)
+// { dg-do run }
// GROUPS passed destructors
// Check that when an object of a derived class is (implicitly)
// destructed (on exit from the block in which it is declared)
+// { dg-do run }
// GROUPS passed destructors
// Check that virtual destructors work correctly. Specifically,
// check that when you destruct an object of a derived class for
+// { dg-do run }
// GROUPS passed destructors
// Check that member and base classes get properly destructed
// when an object of a derived class is destructed via a pointer
-// Special g++ Options: -O
+// { dg-do run }
+// { dg-options "-O" }
// PRMS Id: 10776
extern "C" int printf (const char *, ...);
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// GROUPS passed arm
enum color {red, yellow, green=20, blue};
-color c = 1; // this should be an error// ERROR - .*
+color c = 1; // this should be an error// { dg-error "" } .*
int i = yellow;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
class foo {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
class Type
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
class X
{
oneMask = 0x0000FFFF,
twoMask = 0x000F0000,
thiMask = 0xFFF00000,
- }; // ERROR - comma
+ }; // { dg-error "" } comma
unsigned int foo;
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
enum Bool { False, True };
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
enum COLOR { red, green, blue };
-// Build don't link:
-// Special g++ Options: -fshort-enums
+// { dg-do assemble }
+// { dg-options "-fshort-enums" }
// GROUPS passed enums
enum E { A = 0x80000000 };
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
class foo {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
enum foo
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
class X {
public:
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// GROUPS passed enums
enum Thing { FIRST, SECOND } ;
int main()
{
Thing x = FIRST ;
- x = 27 ; // this line should be a type error.// ERROR - .*
+ x = 27 ; // this line should be a type error.// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
class X {
private:
- enum E1 {a1, b1}; // ERROR - private
+ enum E1 {a1, b1}; // { dg-error "" } private
public:
enum E2 {a2, b2};
};
X::E2 e2;
int x2 = X::a2;
- X::E1 e1; // ERROR - within this context
- int x1 = X::a1; // ERROR - within this context
+ X::E1 e1; // { dg-error "" } within this context
+ int x1 = X::a1; // { dg-error "" } within this context
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
enum color { red, green, blue, orange, brown };
struct s {
- enum color field:2; // ERROR - too small
+ enum color field:2; // { dg-error "" } too small
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
class foo1
{
{
ENUM1,
ENUM2,
- }; // ERROR - comma
+ }; // { dg-error "" } comma
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
enum fig {
figgy,
pudding,
-}; // ERROR - comma
+}; // { dg-error "" } comma
class X {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed error-messages
class A { };
-int i = A::_ter;// ERROR - ._ter.*
-int j = A::term;// ERROR - .term.*
+int i = A::_ter;// { dg-error "" } ._ter.*
+int j = A::term;// { dg-error "" } .term.*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed error-messages
class foo {
public:
- virtual static int f () = 0;// ERROR - member `f' cannot be declared both virtual and static.*
+ virtual static int f () = 0;// { dg-error "" } member `f' cannot be declared both virtual and static.*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed error-messages
-void foo (mutable int x);// ERROR - non-member `x' cannot be declared `mutable'.*
+void foo (mutable int x);// { dg-error "" } non-member `x' cannot be declared `mutable'.*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed error-messages
class foo {
public:
- friend mutable int x ();// ERROR - non-object member `x' cannot be declared `mutable'
+ friend mutable int x ();// { dg-error "" } non-object member `x' cannot be declared `mutable'
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed error-messages
typedef void (*pfv)(double, double);
extern "C" {
- typedef void (*pfv)(double, double); // ERROR - conflicting linkage - XFAIL
+ typedef void (*pfv)(double, double); // { dg-error "" "" { xfail *-*-* } } conflicting linkage
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed error-messages
#include <fstream>
#include <iomanip>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed error-messages
class X {
public:
- static int x;// ERROR - previous.*
- static int y;// ERROR - previous.*
+ static int x;// { dg-error "" } previous.*
+ static int y;// { dg-error "" } previous.*
};
-unsigned X::x;// ERROR - conflict.*
-unsigned X::y;// ERROR - conflict.*
+unsigned X::x;// { dg-error "" } conflict.*
+unsigned X::y;// { dg-error "" } conflict.*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed error-messages
class foo {};
-~foo () {}// ERROR - destructors must be member functions.*
+~foo () {}// { dg-error "" } destructors must be member functions.*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed error-messages
class foo {
public:
- ~bar () {}// ERROR - destructor `bar' must match class name `foo'.*
+ ~bar () {}// { dg-error "" } destructor `bar' must match class name `foo'.*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed error-messages
class foo {
public:
- volatile int () {}// ERROR -
+ volatile int () {}// { dg-error "" }
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed error-messages
-operator int ; int j; // ERROR - declaration of `operator int' as non-function.*
+operator int ; int j; // { dg-error "" } declaration of `operator int' as non-function.*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed error-messages
class foo {
public:
- int ~foo ();// ERROR - return type specification for destructor invalid.*
+ int ~foo ();// { dg-error "" } return type specification for destructor invalid.*
};
+// { dg-do assemble }
// $7.1.2 disallows explicit on anything but declarations of
// constructors ... including friends.
class foo { public: foo(); };
-class bar { public: friend explicit foo::foo(); }; // ERROR - explicit friend
+class bar { public: friend explicit foo::foo(); }; // { dg-error "" } explicit friend
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed friends
class A
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed friends
class X {
int a;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed friends
class B {
enum {
bEnum = 1,
- }; // ERROR - comma
+ }; // { dg-error "" } comma
int bArray[ bEnum ];
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed friends
// do_friend should complain that foo was declared as a friend of
// A before A was defined
struct A;
-struct B { friend A::foo (); };// ERROR - .*
+struct B { friend A::foo (); };// { dg-error "" } .*
+// { dg-do run }
// GROUPS passed groff
/* This should compile properly with the new overloading scheme. */
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
class Thing{
private:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
struct { int :0; } a;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
struct String {
char * string;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed array-bindings
char * bob();
int main()
{
char a[1][2];
- a[0] = bob();// ERROR - .*
+ a[0] = bob();// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
struct A {
operator int ();
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
// this should give an error in require_instantiated_type about not
// being allowed to have an initializer list in an argument list.
-int f(int a = {1});// ERROR - .*
+int f(int a = {1});// { dg-error "" } .*
+// { dg-do run }
// GROUPS passed initialization
// p2766: Make sure that members are initialized in order of declaration
// in the class, not in order of specification in the mem-initializer list.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
struct CharList { int i; };
-const CharList& terminals = { 1 };// ERROR - .*
+const CharList& terminals = { 1 };// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
int main( int argc, char**argv, char** envp ){
char* domain = argv[1];
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
class Tag {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
struct myChoiceList
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
class A
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
int FALSE = 0;
class X {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed labels
// it should only give 1 error, about using an undefined label
-int main(void) { goto dummy; }// ERROR - .*
+int main(void) { goto dummy; }// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed labels
extern "C" void abort();
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed error-messages
-typedef struct s S;// ERROR - previous.*
-struct S { int member:1; }; // the lineno for this should be 2, not 0// ERROR - conflicting types.*
+typedef struct s S;// { dg-error "" } previous.*
+struct S { int member:1; }; // the lineno for this should be 2, not 0// { dg-error "" } conflicting types.*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed miscellaneous-bugs
int main( int argc, char**argv, char** envp ){
char* domain = argv[1];
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed miscellaneous
// The compiler shouldn't give a `invalid operands to binary +' for this
// case.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed miscellaneous
// This should not complain about A::f being abstract.
struct A
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed miscellaneous-bugs
class X {
public:
enum e {
- New,// ERROR - conflicts with other.*
- }; // ERROR - comma
+ New,// { dg-error "" } conflicts with other.*
+ }; // { dg-error "" } comma
- static int New(int);// ERROR - declaration.*
+ static int New(int);// { dg-error "" } declaration.*
};
int main() {}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed miscellaneous-bugs
struct A {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed miscellaneous-bugs
// Using a typedef causes a compiler error
typedef unsigned int Uint32;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed miscellaneous-bugs
typedef int va_list;
class ostream;
{
FwtStdProgram& thisp = *this;
thisp.form("%s: error, there were unrecognized options",
- (char *) FwtErrorManager::_program);// ERROR - .*
+ (char *) FwtErrorManager::_program);// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed miscellaneous-bugs
// Should be fixed by:
// Sun Jun 13 12:55:22 1993 Brendan Kehoe (brendan@lisa.cygnus.com)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed miscellaneous-bugs
// The compiler should not error about taking the addr of main in this example.
class fred {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed miscellaneous
// This should not emit an error about A::~A() being redefined; we
// should check that it is a pure virtual.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed miscellaneous
class A {
static A aa[2];
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed miscellaneous
// test that use of `inline' is forbidden when it should be
-inline int i;// ERROR - .*
-struct c { inline int i; };// ERROR - .*
-int foo (inline int i);// ERROR - .*
-inline class c; // ERROR - inline
-inline typedef int t; // ERROR - inline
-class d { inline friend class c; }; // ERROR - inline
+inline int i;// { dg-error "" } .*
+struct c { inline int i; };// { dg-error "" } .*
+int foo (inline int i);// { dg-error "" } .*
+inline class c; // { dg-error "" } inline
+inline typedef int t; // { dg-error "" } inline
+class d { inline friend class c; }; // { dg-error "" } inline
+// { dg-do run }
// GROUPS passed miscellaneous
extern "C" int printf (const char *, ...);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed miscellaneous
// used to say invalid lvalue in `&\'
class foo {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed miscellaneous
//The program listed below produces the following error during compilation:
// % g++ bug17.cc
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed mutable
class foo;
class bar {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
int x;
class enclose {
class inner {
public:
void f (int i) {
- x = i;// ERROR - .*
+ x = i;// { dg-error "" } .*
}
};
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
class A
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
class A {
int x;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
struct enclose {
class nested;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
// The bug here is that wer'e getting a message about inner not
// being a basetype itself. I think it's because it's being
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
class BDDHeap {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
class BDDHeap {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
class T {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
// This is the first line of file ||t2.C||.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
// This is the first line of file ||t3.C||.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
class A {
protected:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
// This is the first line of file ||t5.C||.
+// { dg-do run }
// GROUPS passed nested-classes
#include <iostream>
#include <cstdio>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
class foo {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
class CS {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
struct A {
A (){}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nested-classes
class X {
public:
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// GROUPS passed nested-classes
class vec {
class blah { };
- ::vec::blah satan( 0);// ERROR - .*
- blah herman( 0);// ERROR - .*
+ ::vec::blah satan( 0);// { dg-error "" } .*
+ blah herman( 0);// { dg-error "" } .*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operator-new
typedef struct {
int a;
AStruct *job;
// This used to crash, it should now give error(s).
- job = new AStruct[];// ERROR - .*
+ job = new AStruct[];// { dg-error "" } .*
job = new AStruct;
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operator-new
typedef __SIZE_TYPE__ size_t;
struct x { int a; void * operator new (size_t, void *); };
+// { dg-do run }
// GROUPS passed operator-new
// Check that if there is a user defined class-specific operator
// new for a given class, that operator is invoked when a new
+// { dg-do run }
// GROUPS passed operator-new
#include <stdio.h>
#include <stdlib.h>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-abort
struct B
{
};
class C
-{ // ERROR - warning
+{ // { dg-error "" } warning
int g();
};
class D2 : public B
-{ // ERROR - type C is not a base type for type D2
+{ // { dg-error "" } type C is not a base type for type D2
using B::f; // ok: B is a base of D
using C::g; // error: C isn't a base of D2
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
struct A {
int x;
};
-int operator()(A x,float y) { // MUST be a member function// ERROR - .*
+int operator()(A x,float y) { // MUST be a member function// { dg-error "" } .*
return 1;
}
int main() {
A x;
- x(1.0); // ERROR - no match for call
+ x(1.0); // { dg-error "" } no match for call
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
class X { };
-void operator[](X& a, X& b) {} // MUST be a member function// ERROR - .*
+void operator[](X& a, X& b) {} // MUST be a member function// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
class X { };
-void operator->(X& a, X& b) {} // MUST be a member function// ERROR - .*
+void operator->(X& a, X& b) {} // MUST be a member function// { dg-error "" } .*
+// { dg-do assemble }
// GROUPS passed operators
// Check that the & operator, when applied to a global function
// or member function returns a proper value as long as the context
if (test3 (vp))
return fail ();
ptr_to_method_of_char p2 = &base::method;
- vp = (void*) p2; // ERROR -
+ vp = (void*) p2; // { dg-error "" }
if (test4 (vp))
return fail ();
ptr_to_method_of_float p3 = &base::method;
- vp = (void*) p3; // ERROR -
+ vp = (void*) p3; // { dg-error "" }
if (test5 (vp))
return fail ();
int test4 (void* vp)
{
char ch = 'x';
- ptr_to_method_of_char p = (ptr_to_method_of_char) vp; // ERROR - bad type conversion
+ ptr_to_method_of_char p = (ptr_to_method_of_char) vp; // { dg-error "" } bad type conversion
return ((base_ptr->*p)(ch) != 9904);
}
int test5 (void* vp)
{
float flt = 9.9;
- ptr_to_method_of_float p = (ptr_to_method_of_float) vp; // ERROR - bad type conversion
+ ptr_to_method_of_float p = (ptr_to_method_of_float) vp; // { dg-error "" } bad type conversion
if ((base_ptr->*p)(flt) != 9905) {
return 1;
+// { dg-do run }
// GROUPS passed operators
// Check that operators may be (directly) recursive.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
class a {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
class A {
char *p;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
struct A {
char *p;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed overloading
class Foo
{
class Bar : public Foo
{
public:
- int f (int); // ERROR - candidates are
+ int f (int); // { dg-error "" } candidates are
};
int main ()
{
Bar b;
- b.f ();// ERROR -
+ b.f ();// { dg-error "" }
b.f (10);
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed overloading
class Bed {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed overloading
class foo_int
{
+// { dg-do run }
// GROUPS passed overloading
// Check that calls to the correct overloaded virtual
// functions are generated even where the type of the formal
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed overloading
typedef int rutBoolean;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed overloading
typedef void * (*NewObject) (void);
class B
{
public:
- static void WantsNew (NewObject creator); // ERROR - candidates are
+ static void WantsNew (NewObject creator); // { dg-error "" } candidates are
};
class A
B::WantsNew ( (NewObject) A::NewOne );
// This used to die in convert_harshness_{ansi,old} cuz it
// didn't know what to do about a void type.
- B::WantsNew ( A::NewOne );// ERROR -
+ B::WantsNew ( A::NewOne );// { dg-error "" }
}
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed overloading
class Foo
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed overloading
struct temp_string {
temp_string (const unsigned char);
+// { dg-do run }
// GROUPS passed overloading
extern "C" int printf (const char *, ...);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed overloading
typedef struct{double re,im;} complex;
class Complex{public:double re,im;
void zxcvbnm(int n,...){n=1;}
int main(){complex c; Complex C;
zxcvbnm(1,c);
-zxcvbnm(1,C);} // WARNING - cannot pass non pod
+zxcvbnm(1,C);} // { dg-warning "" } cannot pass non pod
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed overloading
class CLogger
{
public:
- void operator() (int,const char *) {}; // ERROR - candidates
- void operator() (int,const char *, ...) {}; // ERROR - candidates
+ void operator() (int,const char *) {}; // { dg-error "" } candidates
+ void operator() (int,const char *, ...) {}; // { dg-error "" } candidates
} Log;
class CGLogger : public CLogger
int main()
{
- Log(1,"Test");// ERROR - call of.*
+ Log(1,"Test");// { dg-error "" } call of.*
Log(1,"Test %d",3);
- GLog(1,"Test");// ERROR - call of.*
+ GLog(1,"Test");// { dg-error "" } call of.*
GLog(1,"Test %d",3);
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed parsing
class Try {
private:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed parsing
class BitString {
public:
-// Build don't link:
-// crash test
+// { dg-do assemble }
// these are marked as expected errors because they evidence an
// ambiguity in the grammar between expressions and declarations.
-// Build don't link:
+// { dg-do assemble }
class B
{
-// Build don't link:
+// { dg-do assemble }
class ptr8
-// Build don't link:
+// { dg-do assemble }
class A { };
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed prefix-postfix
class foo {
public:
- operator ++ (); // ERROR - no type or storage class
+ operator ++ (); // { dg-error "" } no type or storage class
};
int main()
// This should fall back to calling operator++(), and be an error with
// the -pedantic flag.
- x++;// ERROR -
+ x++;// { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
class foo {
public:
- operator ++ (); // ERROR - no type or storage class
- operator ++ (int); // ERROR - no type or storage class
- operator ++ (char); // illegal// ERROR - .*
- operator ++ (short); // illegal// ERROR - .*
- operator ++ (long); // illegal// ERROR - .*
+ operator ++ (); // { dg-error "" } no type or storage class
+ operator ++ (int); // { dg-error "" } no type or storage class
+ operator ++ (char); // illegal// { dg-error "" } .*
+ operator ++ (short); // illegal// { dg-error "" } .*
+ operator ++ (long); // illegal// { dg-error "" } .*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed prefix-postfix
class Y {
public:
friend Y operator++ (Y&);
- friend Y operator++ (Y&, char); // illegal// ERROR - .*
+ friend Y operator++ (Y&, char); // illegal// { dg-error "" } .*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed prefix-postfix
class Y {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed ptolemy-bugs
class Tcl_Interp;
+// { dg-do run }
// GROUPS passed ptolemy-bugs
#include <iostream>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed pointers-to-members
class my_class
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed pointers-to-members
struct C {
struct N {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed pointers-to-members
template<class T> class TemplA {
T t;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed pointers-to-members
class X {
private:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed recursive-aborts
// types
typedef unsigned int DBflag; // for storing user flag value
{
DBpathrec a(), b();
- a = b;// ERROR - non-lvalue in assignment.*
+ a = b;// { dg-error "" } non-lvalue in assignment.*
}
-// Build don't link:
+// { dg-do assemble { xfail *-*-* } }
// GROUPS passed redeclaration
-// crash test - XFAIL *-*-*
-inline int min(int x, int y) {return x < y ? x : y;} /* 235 */// ERROR - .*
+inline int min(int x, int y) {return x < y ? x : y;} /* 235 */// { dg-error "" } .*
int min(int a, int b);
-inline int min(int a, int b) {return (a < b)?a:b;}// ERROR - .*
+inline int min(int a, int b) {return (a < b)?a:b;}// { dg-error "" } .*
+// { dg-do run }
// GROUPS passed redeclaration
// Check that if multiple declarations of the same single
// function are present in different places in the same file,
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed redeclaration
class foo
{
void bar(int &a);
int foo::bar(int a) {
- int a = 0; // Should this be an error ?// ERROR - declaration.*
+ int a = 0; // Should this be an error ?// { dg-error "" } declaration.*
bar(a);
return 0;
-// Special g++ Options: -w
+// { dg-do run }
+// { dg-options "-w" }
// GROUPS passed references
// Check that if a reference is initialized to refer to a value
// which is returned from a function call, the actual call to
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed RTTI
#include <typeinfo>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed scoping
int f (int i) {
if (i)
for (int j = i; j; j--)
;
- return j; // error: j should only be in scope inside the body of `for'// ERROR - .*
+ return j; // error: j should only be in scope inside the body of `for'// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed scoping
class A
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed scoping
// This is fixed when NEW_CLASS_SCOPING is on.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed scoping
class BitString {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed scoping
class Integer {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed errors
void f( int a) {
- int a; // this should be an error now// ERROR - .*
+ int a; // this should be an error now// { dg-error "" } .*
{
int a;
}
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// GROUPS passed sizeof
// ARM $5.3.2
main()
{
// sizeof may not be applied to a function
- int i = sizeof( f);// ERROR - .*
+ int i = sizeof( f);// { dg-error "" } .*
return 0;
}
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// GROUPS passed sizeof
// ARM $5.3.2
{
// sizeof may not be applied to a bit-field
foo f;
- int i = sizeof (f.bit);// ERROR - .*
+ int i = sizeof (f.bit);// { dg-error "" } .*
return 0;
}
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// GROUPS passed sizeof
// ARM $5.3.2
main()
{
// sizeof may not be applied to an undefined class
- int k = sizeof (bar);// ERROR - .*
+ int k = sizeof (bar);// { dg-error "" } .*
return 0;
}
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// GROUPS passed sizeof
// ARM $5.3.2
main()
{
// sizeof may not be applied to the type void
- int l = sizeof (void);// ERROR - .*
+ int l = sizeof (void);// { dg-error "" } .*
return 0;
}
+// { dg-do run }
// GROUPS passed sizeof
// ARM $5.3.2
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed old-sorry
class a {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed static
-class A { public: int a; };// ERROR - .*
-void foo7 () { A::a = 3; }// ERROR - .*
+class A { public: int a; };// { dg-error "" } .*
+void foo7 () { A::a = 3; }// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed static
class A
{
static void staticMember()
{
- member (); // illegal, no object for calling non-static method// ERROR - .*
+ member (); // illegal, no object for calling non-static method// { dg-error "" } .*
}
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed static
class foo{
public:
static void bar( int i ){ value = i; }
- static int value;// ERROR - .*
+ static int value;// { dg-error "" } .*
};
-const int foo::value = 0; // should be an error.// ERROR - .*
+const int foo::value = 0; // should be an error.// { dg-error "" } .*
int main(){
foo::bar( 1 );
-// Build don't link:
-// Special g++ Options: -pedantic-errors -g -Wall
+// { dg-do assemble { xfail sparc64-*-elf } }
+// { dg-options "-pedantic-errors -g -Wall" }
// GROUPS passed synthetics
-// excess errors test - XFAIL sparc64-*-elf
// Check to make sure that g++ doesn't get freaked out about the use
// of generated methods that it supposedly "can't see".
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
// g++-2.2.1: member functions returning a template type
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class Called>
class aCallback
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
inline void foo (const int &x) {}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template<class T>
class ListS {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template<class T> class Stack {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template<class T> class TList {
typedef void (T::*TVOIDFUNT)();
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
struct Regex { int i; Regex(char *, int); };
template<class KEY>
static unsigned sequence_number;
};
-const Regex NDAMName<'L'>::pattern("^[Ll](.*)$", 1);// ERROR - type/value.*
-unsigned NDAMName<'L'>::sequence_number = 0;// ERROR - type/value
+const Regex NDAMName<'L'>::pattern("^[Ll](.*)$", 1);// { dg-error "" } type/value.*
+unsigned NDAMName<'L'>::sequence_number = 0;// { dg-error "" } type/value
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template<class T> class X;
typedef X<int> IX;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
class Base
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class Q>
class Conc {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class A, class B> class Map;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template<class T>
class L {
+// { dg-do run }
// GROUPS passed templates
extern "C" int printf (const char *, ...);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
class T_Base
+// { dg-do run }
// GROUPS passed templates
extern "C" int printf (const char *, ...);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
class Temp_Base
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
class V {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template<class K, class V> class MapLS { };
class String {};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
class X {
const char *fptr;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class ElementType> class A
{ public:
+// { dg-do run }
// GROUPS passed templates
extern "C" int printf (const char *, ...);
extern "C" void exit (int);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template<class K, class V> class MapLS { };
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
// PRMS Id: 13218
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
// This used to be a circularity in chainon.
template <class ARG> struct TMPL {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template<class T>
class Vector
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
struct B {
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class ET>
class ChainElem {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
#include <stdio.h>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed temporaries
#include <stdio.h>
-// Build don't link:
+// { dg-do assemble }
class baseClassA
{
+// { dg-do run }
// GROUPS passed unions
// This is fixed by finish_anon_union doing a string_cst_equal check on
// the DECL_SIZE of the decls, instead of comparing the DECL_SIZE nodes.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed unions
class B;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed unions
union alan {
int a;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
class foo {
protected:
- int i; // ERROR - protected
+ int i; // { dg-error "" } protected
};
class bar : public foo {
void baz (foo *f)
{
- f->i = 1; // error: i is protected// ERROR - .*
+ f->i = 1; // error: i is protected// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
struct base
{
protected:
- void base_func() {}// ERROR - .*is protected.*
+ void base_func() {}// { dg-error "" } .*is protected.*
};
struct derived : public base
{
protected:
- void derived_func(base *ptr) { ptr->base_func(); }// ERROR - within this context
+ void derived_func(base *ptr) { ptr->base_func(); }// { dg-error "" } within this context
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
class X {
- void g (int); // ERROR - private
+ void g (int); // { dg-error "" } private
public:
void g (double);
};
-class Y : public X { void f() { g (1); } }; // ERROR - private
+class Y : public X { void f() { g (1); } }; // { dg-error "" } private
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// Used to say:
// manip.cc:17: member `_f' is a private member of class `B<int>'
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
template <class T>
class Feld {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
template<int K> class B;
template<int K> class A {int n; friend class B<K>;};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
class bottom
{
public:
- int b; // ERROR - private
+ int b; // { dg-error "" } private
};
class middle : private bottom
{
class top : public middle
{
public:
- void bar () { b; }// ERROR - .*
+ void bar () { b; }// { dg-error "" } .*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
class X
{
public:
- void fn ();// ERROR - .*
+ void fn ();// { dg-error "" } .*
};
class Y : private X
{};
class Unrelated
{
public:
- void foo () { Y y; y.fn (); }// ERROR - .*
+ void foo () { Y y; y.fn (); }// { dg-error "" } .*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// Make sure private inheritance affects the visibility of
// static members used in an inherited context.
class foo
{
public:
- static int y; // ERROR - private
+ static int y; // { dg-error "" } private
};
class foo1 : private foo
{ };
class foo2 : public foo1
{ public:
- void bar () { y; }// ERROR - .*
+ void bar () { y; }// { dg-error "" } .*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
class A {
public:
- void aMethod(void) {};// ERROR - .*
+ void aMethod(void) {};// { dg-error "" } .*
};
class AA : A { };
public:
void thisMethod() {
AA ana;
- ana.aMethod();// ERROR - .*
+ ana.aMethod();// { dg-error "" } .*
}
};
+// { dg-do run }
// GROUPS passed virtual-tables
// Check that virtual function tables are generated and used
// even for struct's/classes which have no explicit constructors.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed warnings
// there should be a warning about foo only defining private methods
-class foo { // ERROR - .*
+class foo { // { dg-error "" } .*
int bar();
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed warnings
void foo()
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed warnings
class K {
public:
-// Build don't link:
-// Special g++ Options: -O2 -Wall
+// { dg-do assemble }
+// { dg-options "-O2 -Wall" }
// GROUPS passed warnings
class A {
int i;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed warnings
int
main ()
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed warnings
enum TypeKind { ATK, BTK } ;
-// Build don't link:
-// Special g++ Options: -O2 -Wall -ansi -pedantic
+// { dg-do assemble }
+// { dg-options "-O2 -Wall -ansi -pedantic" }
// GROUPS passed warnings
// should not emit this warning about func:
// x.C:2: warning: invalid storage class for function `func'
-// Build don't link:
-// Special g++ Options: -O2 -Wall
+// { dg-do assemble }
+// { dg-options "-O2 -Wall" }
// GROUPS passed warnings
template<class T>
class X {
-// Build don't link:
-// Special g++ Options: -Wall
+// { dg-do assemble }
+// { dg-options "-Wall" }
// GROUPS passed warnings
bool foo(unsigned char c)
{
-// Build don't link:
-// Special g++ Options: -Wall
+// { dg-do assemble }
+// { dg-options "-Wall" }
// GROUPS passed warnings
inline int foo()
{
+// { dg-do assemble }
// g++ 1.36.1 bug 891229_02
// g++ limits the scope of names which are declared as typedef names within
typedef void (*function_p) (void);
};
-function_p fp; // ERROR - no such type in scope
+function_p fp; // { dg-error "" } no such type in scope
foo::foo () {}
+// { dg-do run }
// g++ 1.36.1 bug 891230_01
// g++ gives typedefs which are nested within class declarations a scope
void member (foo_p);
};
-void foo::member (foo_p p) { // gets bogus errors
+void foo::member (foo_p p) { // { dg-bogus "" } s
}
int main () { return 0; }
+// { dg-do run }
// g++ 1.36.1 bug 900107_01
// Unlike GCC and Cfront 2.0, the g++ 1.36.1 compiler gives struct, union,
void foo ()
{
- class c1 { // gets bogus error
+ class c1 { // { dg-bogus "" }
int c1_member1;
} c1_local_object_0;
- struct s1 { // gets bogus error
+ struct s1 { // { dg-bogus "" }
int s1_member1;
} s1_local_object_0;
- union u1 { // gets bogus error
+ union u1 { // { dg-bogus "" }
int u1_member1;
} u1_local_object_0;
+// { dg-do assemble }
// g++ 1.36.1 bug 900119_01
// g++ allows initializers to be included in the declaration of members
class class0 {
public:
- int class0_member_0 = 99; /* ERROR - */
- static int class0_member_1 = 99; /* ERROR - */
- int &class0_member_2 = global_int; /* ERROR - */
+ int class0_member_0 = 99; /* { dg-error "" } */
+ static int class0_member_1 = 99; /* { dg-error "" } */
+ int &class0_member_2 = global_int; /* { dg-error "" } */
- class0 () : class0_member_2 (global_int) { } /* ERROR - */
+ class0 () : class0_member_2 (global_int) { } /* { dg-error "" } */
};
struct struct0 {
- int struct0_member_0 = 99; /* ERROR - */
- static int struct0_member_1 = 99; /* ERROR - */
- int &struct0_member_2 = global_int; /* ERROR - */
+ int struct0_member_0 = 99; /* { dg-error "" } */
+ static int struct0_member_1 = 99; /* { dg-error "" } */
+ int &struct0_member_2 = global_int; /* { dg-error "" } */
- struct0 () : struct0_member_2 (global_int) { } /* ERROR - */
+ struct0 () : struct0_member_2 (global_int) { } /* { dg-error "" } */
};
// g++ does not allow unions to have more than one member with an initializer
union union0 {
- int union0_member_0 = 99; /* ERROR - */
+ int union0_member_0 = 99; /* { dg-error "" } */
};
union union1 {
};
union union2 {
- int &union2_member_0 = global_int; /* ERROR - */
+ int &union2_member_0 = global_int; /* { dg-error "" } */
- union2 () : union2_member_0 (global_int) { } /* ERROR - */
+ union2 () : union2_member_0 (global_int) { } /* { dg-error "" } */
};
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900121_01
// The following file causes g++ 1.36.1 (and 1.36.2) to abort.
// keywords: abort, incomplete types, reference types, formal parameters
-struct s0; // ERROR - forward declaration
+struct s0; // { dg-error "" } forward declaration
void function (struct s0 &arg1, struct s0 &arg2)
{
- arg1 = arg2; // ERROR - causes abort
+ arg1 = arg2; // { dg-error "" } causes abort
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900121_02
// Assignment of structs is defined as memberwise assignment,
};
union u0 {
- s0 u0_member_0; // ERROR -
- s1 u0_member_1; // ERROR -
+ s0 u0_member_0; // { dg-error "" }
+ s1 u0_member_1; // { dg-error "" }
};
void function ()
+// { dg-do assemble }
// g++ 1.36.1 bug 900121_05
// g++ allows unions to have base types (i.e. to be "derived") and it allows
int s0_member;
};
-union u0 : public s0 { /* ERROR - union has base class */
+union u0 : public s0 { /* { dg-error "" } union has base class */
int u0_member_0;
int u0_member_1;
};
int u1_member_1;
};
-struct s1 : public u1 { /* ERROR - base class is a union */
+struct s1 : public u1 { /* { dg-error "" } base class is a union */
int s1_member_0;
};
+// { dg-do assemble }
// g++ 1.36.1 bug 900127_01
// g++ often fails to detect (and issue errors for) ambiguous overload
typedef int (*f_ptr_t1) (void);
typedef void (*f_ptr_t2) (int);
-void bar (f_ptr_t1); // ERROR -
-void bar (f_ptr_t2); // ERROR -
+void bar (f_ptr_t1); // { dg-error "" }
+void bar (f_ptr_t2); // { dg-error "" }
void function ()
{
- bar (foo); // ERROR - ambiguous
+ bar (foo); // { dg-error "" } ambiguous
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900127_02
// g++ (mostly) keeps separate name spaces for the declarations of data
// keywords: name spaces, overloading
-int global0; // ERROR -
-int global0 (); // ERROR -
+int global0; // { dg-error "" }
+int global0 (); // { dg-error "" }
-int global1 (); // ERROR - xref for below
-int global1; // ERROR - caught
+int global1 (); // { dg-error "" } xref for below
+int global1; // { dg-error "" } caught
struct struct_0 {
- int class_local (); // ERROR -
- int class_local; // ERROR -
+ int class_local (); // { dg-error "" }
+ int class_local; // { dg-error "" }
};
struct struct_1 {
- int class_local; // ERROR -
- int class_local (); // ERROR -
+ int class_local; // { dg-error "" }
+ int class_local (); // { dg-error "" }
};
void function_0 ()
{
- int function_0_local; // ERROR -
- extern int function_0_local (); // ERROR -
+ int function_0_local; // { dg-error "" }
+ extern int function_0_local (); // { dg-error "" }
}
void function_1 ()
{
- int function_1_local (); // ERROR -
- extern int function_1_local; // ERROR -
+ int function_1_local (); // { dg-error "" }
+ extern int function_1_local; // { dg-error "" }
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900205_02
// g++ allows constructors to be defined which do not include
class c0 {
int &int_ref;
public:
- c0 () /* : int_ref(i) */ { // ERROR - reference needs initializer
+ c0 () /* : int_ref(i) */ { // { dg-error "" } reference needs initializer
}
};
c1 ();
};
-c1::c1() /* : int_ref(i) */ { // ERROR - reference needs initializer
+c1::c1() /* : int_ref(i) */ { // { dg-error "" } reference needs initializer
}
int main () { return 0; }
+// { dg-do assemble }
+// { dg-options "-Wreturn-type -pedantic-errors" }
// g++ 1.36.1 bug 900205_03
// Section 6.6.3 of the cfront 2.0 Reference Manual says "A return statement
// keywords: return statements, return type, void return, implicit return
-// Special g++ Options: -Wreturn-type -pedantic-errors
struct struct00 { };
int global_function_0 () {
-} // ERROR -
+} // { dg-error "" }
struct00 global_function_1 () {
-} // ERROR -
+} // { dg-error "" }
struct struct0 {
int struct0_member_function_0 () {
- } // ERROR -
+ } // { dg-error "" }
struct0 struct0_member_function_1 () {
- } // ERROR -
+ } // { dg-error "" }
};
struct struct1 {
};
int struct1_member_function_0 () {
-} // ERROR -
+} // { dg-error "" }
struct1 struct1::struct1_member_function_1 () {
-} // ERROR -
+} // { dg-error "" }
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900205_04
// g++ allows a class for which an implicit default X::X() constructor must
{
}
-struct struct0_derived_struct_0 : public struct0 { // ERROR -
+struct struct0_derived_struct_0 : public struct0 { // { dg-error "" }
};
// struct0_derived_struct_0 object; // would give g++ error if compiled
+// { dg-do run }
// g++ 1.36.1 bug 900207_03
// g++ fails to allow objects of class or struct types to be initialized
};
struct0 struct0_gbl_object0;
-struct0 struct0_gbl_object1 (struct0_gbl_object0); // gets bogus error
+struct0 struct0_gbl_object1 (struct0_gbl_object0); // { dg-bogus "" }
void struct0_test ()
{
- struct0 struct0_lcl_object1 (struct0_gbl_object0); // gets bogus error
+ struct0 struct0_lcl_object1 (struct0_gbl_object0); // { dg-bogus "" }
}
// Check construction for a type with virtual function members.
void struct1::function_member () { }
struct1 struct1_gbl_object0;
-struct1 struct1_gbl_object1 (struct1_gbl_object0); // gets bogus error
+struct1 struct1_gbl_object1 (struct1_gbl_object0); // { dg-bogus "" }
void struct1_test ()
{
- struct1 struct1_lcl_object1 (struct1_gbl_object0); // gets bogus error
+ struct1 struct1_lcl_object1 (struct1_gbl_object0); // { dg-bogus "" }
}
int main () { return 0; }
+// { dg-do run }
// g++ 1.36.1 bug 900208_02
// g++ does not allow a static member of a class/struct/union to be
class class0 {
public:
- static int class0_data_member_0[]; // gets bogus error
+ static int class0_data_member_0[]; // { dg-bogus "" }
};
-int class0::class0_data_member_0[3] = { 1, 2, 3 }; // gets bogus error
+int class0::class0_data_member_0[3] = { 1, 2, 3 }; // { dg-bogus "" }
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900208_03
// The Cfront 2.0 reference manual (5.3.3) says "This type must be an
void global_function_0 ()
{
- new func_type; // ERROR - missed by both cfront 2.0 and g++ 1.36.1
+ new func_type; // { dg-error "" } missed by both cfront 2.0 and g++ 1.36.1
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900208_04
// The Cfront 2.0 reference manual (5.3.3) says "This type must be an
void global_function_1 (func_type *p)
{
- delete p; // ERROR - caught by Cfront 2.0 but not by g++ 1.36.1
+ delete p; // { dg-error "" } caught by Cfront 2.0 but not by g++ 1.36.1
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900209_01
// g++ implicitly casts values whose types are "void*" to other pointer
void global_function_0 ()
{
- char_pointer_object = void_pointer_object; // ERROR -
+ char_pointer_object = void_pointer_object; // { dg-error "" }
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900210_01
// g++ allows pointer type values to be assigned to variables of integal
void global_function ()
{
- i = vp; /* ERROR - */
- i = cp; /* ERROR - */
- i = ip; /* ERROR - */
- i = ep; /* ERROR - */
- i = sp; /* ERROR - */
- i = fp; /* ERROR - */
- l = vp; /* ERROR - */
- l = cp; /* ERROR - */
- l = ip; /* ERROR - */
- l = ep; /* ERROR - */
- l = sp; /* ERROR - */
- l = fp; /* ERROR - */
- s = vp; /* ERROR - */
- s = cp; /* ERROR - */
- s = ip; /* ERROR - */
- s = ep; /* ERROR - */
- s = sp; /* ERROR - */
- s = fp; /* ERROR - */
- c = vp; /* ERROR - */
- c = cp; /* ERROR - */
- c = ip; /* ERROR - */
- c = ep; /* ERROR - */
- c = sp; /* ERROR - */
- c = fp; /* ERROR - */
- si = vp; /* ERROR - */
- si = cp; /* ERROR - */
- si = ip; /* ERROR - */
- si = ep; /* ERROR - */
- si = sp; /* ERROR - */
- si = fp; /* ERROR - */
- sl = vp; /* ERROR - */
- sl = cp; /* ERROR - */
- sl = ip; /* ERROR - */
- sl = ep; /* ERROR - */
- sl = sp; /* ERROR - */
- sl = fp; /* ERROR - */
- ss = vp; /* ERROR - */
- ss = cp; /* ERROR - */
- ss = ip; /* ERROR - */
- ss = ep; /* ERROR - */
- ss = sp; /* ERROR - */
- ss = fp; /* ERROR - */
- sc = vp; /* ERROR - */
- sc = cp; /* ERROR - */
- sc = ip; /* ERROR - */
- sc = ep; /* ERROR - */
- sc = sp; /* ERROR - */
- sc = fp; /* ERROR - */
- ui = vp; /* ERROR - */
- ui = cp; /* ERROR - */
- ui = ip; /* ERROR - */
- ui = ep; /* ERROR - */
- ui = sp; /* ERROR - */
- ui = fp; /* ERROR - */
- ul = vp; /* ERROR - */
- ul = cp; /* ERROR - */
- ul = ip; /* ERROR - */
- ul = ep; /* ERROR - */
- ul = sp; /* ERROR - */
- ul = fp; /* ERROR - */
- us = vp; /* ERROR - */
- us = cp; /* ERROR - */
- us = ip; /* ERROR - */
- us = ep; /* ERROR - */
- us = sp; /* ERROR - */
- us = fp; /* ERROR - */
- uc = vp; /* ERROR - */
- uc = cp; /* ERROR - */
- uc = ip; /* ERROR - */
- uc = ep; /* ERROR - */
- uc = sp; /* ERROR - */
- uc = fp; /* ERROR - */
+ i = vp; /* { dg-error "" } */
+ i = cp; /* { dg-error "" } */
+ i = ip; /* { dg-error "" } */
+ i = ep; /* { dg-error "" } */
+ i = sp; /* { dg-error "" } */
+ i = fp; /* { dg-error "" } */
+ l = vp; /* { dg-error "" } */
+ l = cp; /* { dg-error "" } */
+ l = ip; /* { dg-error "" } */
+ l = ep; /* { dg-error "" } */
+ l = sp; /* { dg-error "" } */
+ l = fp; /* { dg-error "" } */
+ s = vp; /* { dg-error "" } */
+ s = cp; /* { dg-error "" } */
+ s = ip; /* { dg-error "" } */
+ s = ep; /* { dg-error "" } */
+ s = sp; /* { dg-error "" } */
+ s = fp; /* { dg-error "" } */
+ c = vp; /* { dg-error "" } */
+ c = cp; /* { dg-error "" } */
+ c = ip; /* { dg-error "" } */
+ c = ep; /* { dg-error "" } */
+ c = sp; /* { dg-error "" } */
+ c = fp; /* { dg-error "" } */
+ si = vp; /* { dg-error "" } */
+ si = cp; /* { dg-error "" } */
+ si = ip; /* { dg-error "" } */
+ si = ep; /* { dg-error "" } */
+ si = sp; /* { dg-error "" } */
+ si = fp; /* { dg-error "" } */
+ sl = vp; /* { dg-error "" } */
+ sl = cp; /* { dg-error "" } */
+ sl = ip; /* { dg-error "" } */
+ sl = ep; /* { dg-error "" } */
+ sl = sp; /* { dg-error "" } */
+ sl = fp; /* { dg-error "" } */
+ ss = vp; /* { dg-error "" } */
+ ss = cp; /* { dg-error "" } */
+ ss = ip; /* { dg-error "" } */
+ ss = ep; /* { dg-error "" } */
+ ss = sp; /* { dg-error "" } */
+ ss = fp; /* { dg-error "" } */
+ sc = vp; /* { dg-error "" } */
+ sc = cp; /* { dg-error "" } */
+ sc = ip; /* { dg-error "" } */
+ sc = ep; /* { dg-error "" } */
+ sc = sp; /* { dg-error "" } */
+ sc = fp; /* { dg-error "" } */
+ ui = vp; /* { dg-error "" } */
+ ui = cp; /* { dg-error "" } */
+ ui = ip; /* { dg-error "" } */
+ ui = ep; /* { dg-error "" } */
+ ui = sp; /* { dg-error "" } */
+ ui = fp; /* { dg-error "" } */
+ ul = vp; /* { dg-error "" } */
+ ul = cp; /* { dg-error "" } */
+ ul = ip; /* { dg-error "" } */
+ ul = ep; /* { dg-error "" } */
+ ul = sp; /* { dg-error "" } */
+ ul = fp; /* { dg-error "" } */
+ us = vp; /* { dg-error "" } */
+ us = cp; /* { dg-error "" } */
+ us = ip; /* { dg-error "" } */
+ us = ep; /* { dg-error "" } */
+ us = sp; /* { dg-error "" } */
+ us = fp; /* { dg-error "" } */
+ uc = vp; /* { dg-error "" } */
+ uc = cp; /* { dg-error "" } */
+ uc = ip; /* { dg-error "" } */
+ uc = ep; /* { dg-error "" } */
+ uc = sp; /* { dg-error "" } */
+ uc = fp; /* { dg-error "" } */
}
int main () { return 0; }
+// { dg-do assemble }
+// { dg-options "" }
// g++ 1.36.1 bug 900210_02
// g++ allows integral type values to be assigned to variables of pointer
void global_function ()
{
- vp = i; /* ERROR - */
- vp = l; /* ERROR - */
- vp = s; /* ERROR - */
- vp = c; /* ERROR - */
- vp = si; /* ERROR - */
- vp = sl; /* ERROR - */
- vp = ss; /* ERROR - */
- vp = sc; /* ERROR - */
- vp = ui; /* ERROR - */
- vp = ul; /* ERROR - */
- vp = us; /* ERROR - */
- vp = uc; /* ERROR - */
- cp = i; /* ERROR - */
- cp = l; /* ERROR - */
- cp = s; /* ERROR - */
- cp = c; /* ERROR - */
- cp = si; /* ERROR - */
- cp = sl; /* ERROR - */
- cp = ss; /* ERROR - */
- cp = sc; /* ERROR - */
- cp = ui; /* ERROR - */
- cp = ul; /* ERROR - */
- cp = us; /* ERROR - */
- cp = uc; /* ERROR - */
- ip = i; /* ERROR - */
- ip = l; /* ERROR - */
- ip = s; /* ERROR - */
- ip = c; /* ERROR - */
- ip = si; /* ERROR - */
- ip = sl; /* ERROR - */
- ip = ss; /* ERROR - */
- ip = sc; /* ERROR - */
- ip = ui; /* ERROR - */
- ip = ul; /* ERROR - */
- ip = us; /* ERROR - */
- ip = uc; /* ERROR - */
- ep = i; /* ERROR - */
- ep = l; /* ERROR - */
- ep = s; /* ERROR - */
- ep = c; /* ERROR - */
- ep = si; /* ERROR - */
- ep = sl; /* ERROR - */
- ep = ss; /* ERROR - */
- ep = sc; /* ERROR - */
- ep = ui; /* ERROR - */
- ep = ul; /* ERROR - */
- ep = us; /* ERROR - */
- ep = uc; /* ERROR - */
- sp = i; /* ERROR - */
- sp = l; /* ERROR - */
- sp = s; /* ERROR - */
- sp = c; /* ERROR - */
- sp = si; /* ERROR - */
- sp = sl; /* ERROR - */
- sp = ss; /* ERROR - */
- sp = sc; /* ERROR - */
- sp = ui; /* ERROR - */
- sp = ul; /* ERROR - */
- sp = us; /* ERROR - */
- sp = uc; /* ERROR - */
- fp = i; /* ERROR - */
- fp = l; /* ERROR - */
- fp = s; /* ERROR - */
- fp = c; /* ERROR - */
- fp = si; /* ERROR - */
- fp = sl; /* ERROR - */
- fp = ss; /* ERROR - */
- fp = sc; /* ERROR - */
- fp = ui; /* ERROR - */
- fp = ul; /* ERROR - */
- fp = us; /* ERROR - */
- fp = uc; /* ERROR - */
+ vp = i; /* { dg-error "" } */
+ vp = l; /* { dg-error "" } */
+ vp = s; /* { dg-error "" } */
+ vp = c; /* { dg-error "" } */
+ vp = si; /* { dg-error "" } */
+ vp = sl; /* { dg-error "" } */
+ vp = ss; /* { dg-error "" } */
+ vp = sc; /* { dg-error "" } */
+ vp = ui; /* { dg-error "" } */
+ vp = ul; /* { dg-error "" } */
+ vp = us; /* { dg-error "" } */
+ vp = uc; /* { dg-error "" } */
+ cp = i; /* { dg-error "" } */
+ cp = l; /* { dg-error "" } */
+ cp = s; /* { dg-error "" } */
+ cp = c; /* { dg-error "" } */
+ cp = si; /* { dg-error "" } */
+ cp = sl; /* { dg-error "" } */
+ cp = ss; /* { dg-error "" } */
+ cp = sc; /* { dg-error "" } */
+ cp = ui; /* { dg-error "" } */
+ cp = ul; /* { dg-error "" } */
+ cp = us; /* { dg-error "" } */
+ cp = uc; /* { dg-error "" } */
+ ip = i; /* { dg-error "" } */
+ ip = l; /* { dg-error "" } */
+ ip = s; /* { dg-error "" } */
+ ip = c; /* { dg-error "" } */
+ ip = si; /* { dg-error "" } */
+ ip = sl; /* { dg-error "" } */
+ ip = ss; /* { dg-error "" } */
+ ip = sc; /* { dg-error "" } */
+ ip = ui; /* { dg-error "" } */
+ ip = ul; /* { dg-error "" } */
+ ip = us; /* { dg-error "" } */
+ ip = uc; /* { dg-error "" } */
+ ep = i; /* { dg-error "" } */
+ ep = l; /* { dg-error "" } */
+ ep = s; /* { dg-error "" } */
+ ep = c; /* { dg-error "" } */
+ ep = si; /* { dg-error "" } */
+ ep = sl; /* { dg-error "" } */
+ ep = ss; /* { dg-error "" } */
+ ep = sc; /* { dg-error "" } */
+ ep = ui; /* { dg-error "" } */
+ ep = ul; /* { dg-error "" } */
+ ep = us; /* { dg-error "" } */
+ ep = uc; /* { dg-error "" } */
+ sp = i; /* { dg-error "" } */
+ sp = l; /* { dg-error "" } */
+ sp = s; /* { dg-error "" } */
+ sp = c; /* { dg-error "" } */
+ sp = si; /* { dg-error "" } */
+ sp = sl; /* { dg-error "" } */
+ sp = ss; /* { dg-error "" } */
+ sp = sc; /* { dg-error "" } */
+ sp = ui; /* { dg-error "" } */
+ sp = ul; /* { dg-error "" } */
+ sp = us; /* { dg-error "" } */
+ sp = uc; /* { dg-error "" } */
+ fp = i; /* { dg-error "" } */
+ fp = l; /* { dg-error "" } */
+ fp = s; /* { dg-error "" } */
+ fp = c; /* { dg-error "" } */
+ fp = si; /* { dg-error "" } */
+ fp = sl; /* { dg-error "" } */
+ fp = ss; /* { dg-error "" } */
+ fp = sc; /* { dg-error "" } */
+ fp = ui; /* { dg-error "" } */
+ fp = ul; /* { dg-error "" } */
+ fp = us; /* { dg-error "" } */
+ fp = uc; /* { dg-error "" } */
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900210_03
// g++ allows void* type values to be assigned to variables of other
void global_function ()
{
- cp = vp; /* ERROR - */
- ip = vp; /* ERROR - */
- ep = vp; /* ERROR - */
- sp = vp; /* ERROR - */
- fp = vp; /* ERROR - */
+ cp = vp; /* { dg-error "" } */
+ ip = vp; /* { dg-error "" } */
+ ep = vp; /* { dg-error "" } */
+ sp = vp; /* { dg-error "" } */
+ fp = vp; /* { dg-error "" } */
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900210_05
// Section 18.3 of the 2.0 Reference Manual says "An implementation
void function ()
{
- enum0_object = int0_object; /* ERROR - */
+ enum0_object = int0_object; /* { dg-error "" } */
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900210_06
// g++ allows values of pointer-to-const types to be assigned to variables
void function ()
{
- cp = ccp; /* ERROR - */
- cp = vcp; /* ERROR - */
+ cp = ccp; /* { dg-error "" } */
+ cp = vcp; /* { dg-error "" } */
}
int main () { return 0; }
+// { dg-do assemble }
+// { dg-options "" }
// g++ 1.36.1 bug 900210_07
// g++ allows values of pointer-to-signed types to be assigned to variables
void function ()
{
- sip = uip; // ERROR -
- uip = sip; // ERROR -
+ sip = uip; // { dg-error "" }
+ uip = sip; // { dg-error "" }
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900210_08
// g++ allows pointer-to-const values to be implicitly converted to
void function ()
{
- vp = ccp; /* ERROR - */
+ vp = ccp; /* { dg-error "" } */
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900210_09
// g++ allows pointer to members (both data members and function members)
void global_function_0 ()
{
- vp = class0_data_member_pointer; // ERROR -
- vp = class0_function_member_pointer; // ERROR -
+ vp = class0_data_member_pointer; // { dg-error "" }
+ vp = class0_function_member_pointer; // { dg-error "" }
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900210_10
// g++ allows operator[] to be declared as a static member function.
// keywords: operator[], static function members
struct struct0 {
- static int operator[] (); /* ERROR - */
+ static int operator[] (); /* { dg-error "" } */
};
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900211_01
// g++ issues only warnings for calls to previously undeclared functions,
// Cfront 2.0 passes this test.
// keywords: undeclared, functions
-// Build don't link:
void global_function_0 ()
{
- global_function_1 (); /* ERROR - */
+ global_function_1 (); /* { dg-error "" } */
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900211_02
// g++ allows you to explicitly specify the return type for a type conversion
struct0 struct0_object_0;
struct struct1 {
- struct0 operator struct0 (); /* ERROR - */
+ struct0 operator struct0 (); /* { dg-error "" } */
};
-struct0 struct1::operator struct0 () { // ERROR -
+struct0 struct1::operator struct0 () { // { dg-error "" }
return struct0_object_0;
}
+// { dg-do assemble }
// g++ 1.36.1 bug 900211_03
// The following erroneous code causes g++ to segfault.
void function ()
{
- char* new_base = new char[x]; // ERROR -
+ char* new_base = new char[x]; // { dg-error "" }
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900211_04
// g++ fails to flag as errors attempts to compare pointer values against
void function ()
{
- result = i == p; /* ERROR - caught by g++ */
- result = i != p; /* ERROR - caught by g++ */
- result = i > p; /* ERROR - missed */
- result = i < p; /* ERROR - missed */
- result = i >= p; /* ERROR - missed */
- result = i <= p; /* ERROR - missed */
+ result = i == p; /* { dg-error "" } caught by g++ */
+ result = i != p; /* { dg-error "" } caught by g++ */
+ result = i > p; /* { dg-error "" } missed */
+ result = i < p; /* { dg-error "" } missed */
+ result = i >= p; /* { dg-error "" } missed */
+ result = i <= p; /* { dg-error "" } missed */
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900212_01
// g++ fails to flag as errors all attempts to add or subtract integer values
void global_function_0 ()
{
- p0 = p1 + 3; // ERROR -
- p0 = p1 - 3; // ERROR -
- p1++; /* ERROR - caught by g++ */
- ++p1; /* ERROR - caught by g++ */
- p1--; /* ERROR - caught by g++ */
- --p1; /* ERROR - caught by g++ */
-
- fp0 = fp1 + 3; // ERROR -
- fp0 = fp1 - 3; // ERROR -
- fp1++; /* ERROR - */
- ++fp1; /* ERROR - */
- fp1--; /* ERROR - */
- --fp1; /* ERROR - */
+ p0 = p1 + 3; // { dg-error "" }
+ p0 = p1 - 3; // { dg-error "" }
+ p1++; /* { dg-error "" } caught by g++ */
+ ++p1; /* { dg-error "" } caught by g++ */
+ p1--; /* { dg-error "" } caught by g++ */
+ --p1; /* { dg-error "" } caught by g++ */
+
+ fp0 = fp1 + 3; // { dg-error "" }
+ fp0 = fp1 - 3; // { dg-error "" }
+ fp1++; /* { dg-error "" } */
+ ++fp1; /* { dg-error "" } */
+ fp1--; /* { dg-error "" } */
+ --fp1; /* { dg-error "" } */
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900212_02
// g++ fails to flag as errors attempts to take the difference of two values
void global_function_0 ()
{
- result = (p0 - p1); // ERROR -
- result = (fp0 - fp1); // ERROR -
+ result = (p0 - p1); // { dg-error "" }
+ result = (fp0 - fp1); // { dg-error "" }
}
int main () { return 0; }
+// { dg-do run }
// g++ 1.36.1 bug 900212_03
// g++ segfaults on any attempt to use the ->* operator.
+// { dg-do assemble }
// g++ 1.36.1 bug 900213_01
// g++ incorrectly diagnoses the error when an attempt is made to reference
// keywords: non-static members, member pointers, scope resolution
struct struct0 {
- int struct0_data_member_0; /* ERROR - gets error from below */
+ int struct0_data_member_0; /* { dg-error "" } gets error from below */
int struct0_function_member_0 ();
};
void global_function_0 ()
{
- i = struct0::struct0_data_member_0; /* ERROR - mishandled by g++ */
+ i = struct0::struct0_data_member_0; /* { dg-error "" } mishandled by g++ */
//i = struct0::struct0_function_member_0 (); /* gets caught by g++ */
}
+// { dg-do assemble }
// g++ 1.36.1 bug 900213_02
// The following erroneous code causes g++ to abort.
void global_function_0 ()
{
- i = *dmp; // ERROR - causes abort
+ i = *dmp; // { dg-error "" } causes abort
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.36.1 bug 900213_03
// g++ fails to detect an error when the address of a "bound" function is
// It does however correctly detect a similar errors for data-members.
// keywords: bound function, operator&, member pointers
-// Build don't link:
struct struct0 {
int data_member;
void global_function_0 ()
{
- fmp = &ptr->function_member; // ERROR -
+ fmp = &ptr->function_member; // { dg-error "" }
//dmp = &ptr->data_member; // caught by g++, missed by cfront
}
+// { dg-do assemble }
// g++ 1.36.1 bug 900214_01
// g++ allows function members of incomplete types to be declared to be
// keywords: friends, incomplete types, function members
-struct A; // ERROR - forward declaration
+struct A; // { dg-error "" } forward declaration
struct B {
- friend void A::foo(); // ERROR - type A is incomplete
+ friend void A::foo(); // { dg-error "" } type A is incomplete
};
-void A::foo(); /* ERROR - also illegal */
+void A::foo(); /* { dg-error "" } also illegal */
struct A {
void foo() {}
+// { dg-do assemble }
// g++ 1.36.1 bug 900215_01
// g++ allows the definition of a type conversion operator `operator void'
struct struct0 {
- operator void (); // WARNING - operator void
+ operator void (); // { dg-warning "" } operator void
};
int exit_status = 1;
+// { dg-do assemble }
// g++ 1.36.1 bug 900215_02
// g++ allows global objects (which happen to be pointers to members of some
i = (this->*fmp) (); // perfectly legal - for both cfront and g++
i = this->*dmp; // perfectly legal - for both cfront and g++
- i = (*fmp) (); // ERROR -
- i = *dmp; // ERROR -
+ i = (*fmp) (); // { dg-error "" }
+ i = *dmp; // { dg-error "" }
}
int main () { return 0; }
+// { dg-do run }
// g++ 1.36.1 bug 900220_01
// Ref: 12.8
member_func_t member_func;
void global_function_0 (member_func_t member_f)
-{ // gets bogus error - ref from below
+{ // { dg-bogus "" } ref from below
}
void global_function_1 ()
{
- member_func = &struct0::operator=; // gets bogus error
+ member_func = &struct0::operator=; // { dg-bogus "" }
- global_function_0 (&struct0::operator=); // gets bogus error
+ global_function_0 (&struct0::operator=); // { dg-bogus "" }
}
int main () { return 0; }
+// { dg-do run }
// g++ 1.36.1 bug 900220_02
// g++ treats plain `char' and `unsigned char' as different types, however
void overloaded (char) {
}
-void overloaded (signed char) { // gets bogus error
+void overloaded (signed char) { // { dg-bogus "" }
}
void overloaded (unsigned char) {
+// { dg-do run }
// g++ 1.36.1 bug 900220_03
// g++ does not properly disambiguate calls to overloaded functions
//volatile char& vcr = vc;
overloaded (c); // OK
- overloaded (cc); // gets bogus error
+ overloaded (cc); // { dg-bogus "" }
//overloaded (vc); // OK
return (c_call_count != 1 || cc_call_count != 1 /* || vc_call_count != 1 */);
+// { dg-do assemble }
// g++ 1.36.1 bug 900221_01
// Ref: 3.2
void function (int arg1)
{
- int arg1; // ERROR - redeclaration of arg1
+ int arg1; // { dg-error "" } redeclaration of arg1
}
int main () { return 0; }
+// { dg-do assemble }
+// { dg-options "" }
// g++ 1.37.1 bug 900227_01
// g++ allows pointer type values to be converted to integral types which are
// Update 2/10/95: The compiler will now compute these expressions at
// runtime. I think this is in the spirit of the GNU compilers (jason).
-// Special g++ Options:
int main ();
-short s = (short) &main; // WARNING - small integer XFAIL h8*-*-* xstormy16-*-*
-char c = (char) &main; // WARNING - small integer
+short s = (short) &main; // { dg-warning "" "" { xfail h8*-*-* xstormy16-*-* } } small integer
+char c = (char) &main; // { dg-warning "" } small integer
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900321_01
// cfront flags ERRORs on each of the lines indicated below. g++ does not
{
// we miss the first two because typeck.c (comp_array_types) deems
// it okay if one of the sizes is null
- ptr_to_array_of_ints = ptr_to_array_of_3_ints; // ERROR -
- ptr_to_array_of_3_ints = ptr_to_array_of_ints; // ERROR -
+ ptr_to_array_of_ints = ptr_to_array_of_3_ints; // { dg-error "" }
+ ptr_to_array_of_3_ints = ptr_to_array_of_ints; // { dg-error "" }
- ptr_to_array_of_3_ints = ptr_to_array_of_5_ints; // ERROR -
- ptr_to_array_of_5_ints = ptr_to_array_of_3_ints; // ERROR -
+ ptr_to_array_of_3_ints = ptr_to_array_of_5_ints; // { dg-error "" }
+ ptr_to_array_of_5_ints = ptr_to_array_of_3_ints; // { dg-error "" }
}
int main () { return 0; }
+// { dg-do run }
// g++ 1.37.1 bug 900321_02
// The following program exits with a nonzero status because the constructor
+// { dg-do run }
// g++ 1.37.1 bug 900321_04
// The following code causes g++ to segfault.
+// { dg-do run }
// g++ 1.37.1 bug 900321_05
// The following code is legal as far as the ANSI C standard, GCC, and
void function ()
{
- c = 3["abcdef"]; // gets bogus error
- c = i[cp]; // gets bogus error
+ c = 3["abcdef"]; // { dg-bogus "" }
+ c = i[cp]; // { dg-bogus "" }
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900322_01
// ** Old, obsolete commentary:
// keywords: incomplete types, arrays, element types
-extern int extern_two_d [] []; // ERROR - invalid declaration
-int tenative_two_d [] []; // ERROR - caught by g++
-static int static_two_d [] []; // ERROR - caught by g++
+extern int extern_two_d [] []; // { dg-error "" } invalid declaration
+int tenative_two_d [] []; // { dg-error "" } caught by g++
+static int static_two_d [] []; // { dg-error "" } caught by g++
-int (*pointer_to_two_d)[][]; // ERROR - invalid declaration
+int (*pointer_to_two_d)[][]; // { dg-error "" } invalid declaration
-void function_0 (int arg [] []) { // ERROR - invalid declaration
+void function_0 (int arg [] []) { // { dg-error "" } invalid declaration
}
typedef int int_one_d_type [];
-typedef int_one_d_type int_two_d_type[];// ERROR - invalid declaration
+typedef int_one_d_type int_two_d_type[];// { dg-error "" } invalid declaration
struct s;
extern struct s extern_s_array [10]; // OK
-struct s tenative_s_array [10]; // ERROR - object with incomplete type
-static struct s static_s_array [10]; // ERROR - object with incomplete type
+struct s tenative_s_array [10]; // { dg-error "" } object with incomplete type
+static struct s static_s_array [10]; // { dg-error "" } object with incomplete type
struct s (*pointer_to_s_array) []; // OK
+// { dg-do assemble }
// g++ 1.37.1 bug 900324_02
// The following erroreous code causes g++ to segfault.
void function_1 ()
{
- fp = 1 ? function_0 : fp; // ERROR -
+ fp = 1 ? function_0 : fp; // { dg-error "" }
}
int main () { return 0; }
+// { dg-do run }
// g++ 1.37.1 bug 900324_03
// g++ is unable to correctly parse declarations of non-global function-pointer
void function_0 ()
{
- void (*p1)(); // gets bogus errors
+ void (*p1)(); // { dg-bogus "" } s
}
-void function_1 (void (*p2)()); // gets bogus errors
+void function_1 (void (*p2)()); // { dg-bogus "" } s
void (*function_2 ()) (); // OK
+// { dg-do assemble }
// g++ 1.37.1 bug 900324_04
// g++ implements an extension which supports the copying of array objects.
void function_0 ()
{
- ia1 = ia2; // ERROR - gnu extension
+ ia1 = ia2; // { dg-error "" } gnu extension
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900324_05
// The following erroneous code causes g++ to segfault.
void function ()
{
- left = right; // ERROR - causes segfault
+ left = right; // { dg-error "" } causes segfault
}
int main () { return 0; }
+// { dg-do run }
// g++ 1.37.1 bug 900324_06
// g++ is unable to use context information (i.e. the required type of the
void function_1 ()
{
- p = i ? function_0 : 0; // gets bogus error
- p = i ? 0 : function_0; // gets bogus error
- p = i ? function_1 : function_0; // gets bogus error
+ p = i ? function_0 : 0; // { dg-bogus "" }
+ p = i ? 0 : function_0; // { dg-bogus "" }
+ p = i ? function_1 : function_0; // { dg-bogus "" }
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900325_01
// g++ fails to generate errors for attempts to declare a formal argument to
typedef void __void;
typedef __void Void;
-void function0 (void arg1) { // ERROR - missed
+void function0 (void arg1) { // { dg-error "" } missed
}
-void function1 (Void arg1) { // ERROR - missed
+void function1 (Void arg1) { // { dg-error "" } missed
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900330_01
//
// As indicated by the example at the end of the section 3.5.3 of the ANSI
void function_1 ()
{
- pi = a[0]; // ERROR - a[0] has type "const int *"
+ pi = a[0]; // { dg-error "" } a[0] has type "const int *"
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900330_02
// The C++ Reference Manual says in section 13.1:
};
struct D : public B {
- int f(struct B); // ERROR - referred to below
+ int f(struct B); // { dg-error "" } referred to below
};
void h(D* pd)
{
- pd->f(1); // ERROR - D::f(struct B) hides B::f(int)
+ pd->f(1); // { dg-error "" } D::f(struct B) hides B::f(int)
}
int main () { return 0; }
+// { dg-do run }
// g++ 1.37.1 bug 900331_02
// g++ fails to treat conditional expressions which yield composite type
void function0 ()
{
- (i ? object0 : object1).data_member = 99; // gets bogus error
- (i ? object0 : object1) = object2; // gets bogus error
+ (i ? object0 : object1).data_member = 99; // { dg-bogus "" }
+ (i ? object0 : object1) = object2; // { dg-bogus "" }
}
int main () { return 0; }
+// { dg-do run }
+// { dg-options "" }
// g++ 1.37.1 bug 900331_03
// Special Options: -ansi
+// { dg-do run }
// g++ 1.37.1 bug 900331_04
// g++ is unable to correctly parse declarations of formal parameters and
int (*global_array_ptr)[10] = &array;
int (&global_array_ref)[10] = array;
-void function0 (int (*formal_array_ptr)[10]) { // gets bogus errors
+void function0 (int (*formal_array_ptr)[10]) { // { dg-bogus "" } s
}
-void function1 (int (&formal_array_ref)[10]) { // gets bogus errors
+void function1 (int (&formal_array_ref)[10]) { // { dg-bogus "" } s
}
void function2 ()
{
- int (*local_array_ptr)[10] = &array; // gets bogus errors
+ int (*local_array_ptr)[10] = &array; // { dg-bogus "" } s
}
void function3 ()
{
- int (&local_array_ref)[10] = array; // gets bogus error
+ int (&local_array_ref)[10] = array; // { dg-bogus "" }
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900401_01
// The following erroneous code causes g++ to abort.
typedef unsigned nibble_array[4];
struct whole {
- nibble_array nibbles:16; // ERROR -
+ nibble_array nibbles:16; // { dg-error "" }
};
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900402_01
// The following erroneous code causes g++ to abort.
typedef void (func_type) ();
struct s {
- func_type f:32; // ERROR - bitified with function type
+ func_type f:32; // { dg-error "" } bitified with function type
};
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900402_02
// g++ fails to correctly flag all attempts to construct an array type
// keywords: arrays, array bound, zero length
-typedef int array_type[0]; // ERROR - gets warning only
+typedef int array_type[0]; // { dg-error "" } gets warning only
-int array_object_1[0]; // ERROR - gets warning only
+int array_object_1[0]; // { dg-error "" } gets warning only
void function_0 (int formal_array[0])
-{ // ERROR - gets warning only
+{ // { dg-error "" } gets warning only
}
void function_2 ()
{
- int local_object_array_0[0]; // ERROR - gets warning only
+ int local_object_array_0[0]; // { dg-error "" } gets warning only
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900403_01
// g++ allows casts to be treated as lvalues (even when the -pedantic
void f ()
{
- (int) i = j; // ERROR -
- ((int) i) = j; // ERROR -
+ (int) i = j; // { dg-error "" }
+ ((int) i) = j; // { dg-error "" }
}
int main () { return 0; }
+// { dg-do assemble }
// 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; // ERROR - This is the real line
+ unsigned int foo:0; // { dg-error "" } This is the real line
unsigned int field;
};
+// { dg-do assemble }
// g++ 1.37.1 bug 900404_01
// g++ allows string initializers for known-length character arrays to be
// keywords: arrays, initialization, array bounds
-char cv[4] = "asdf"; // ERROR - missed
+char cv[4] = "asdf"; // { dg-error "" } missed
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900404_02
// g++ fails to treat multicharacter literals as type "int" as required by
exit_status++;
}
-int main () { function0 ('abcd'); return exit_status; } // WARNING -
+int main () { function0 ('abcd'); return exit_status; } // { dg-warning "" }
+// { dg-do assemble }
// g++ 1.37.1 bug 900404_03
// g++ fails to be able to properly flag errors for even simple cases of
// keywords: overloading, ambiguity, resolution
void function0 (int i, char c)
-{ // ERROR -
+{ // { dg-error "" }
i = c;
}
void function0 (char c, int i)
-{ // ERROR -
+{ // { dg-error "" }
i = c;
}
void test ()
{
- function0 (c,c); // ERROR - missed
+ function0 (c,c); // { dg-error "" } missed
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900404_04
// [dcl.dcl] explains that simple-declarations may omit the
int i;
-; // ERROR -
+; // { dg-error "" }
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900404_07
// It is illegal to use a cast to attempt to convert an object type
void foo ()
{
- int i = *((array_type) *ap); /* ERROR - missed */
+ int i = *((array_type) *ap); /* { dg-error "" } missed */
}
+// { dg-do assemble }
// g++ 1.37.1 bug 900405_01
// The C++ Reference Manual says (in section 5.4) "Types may not be defined
void f ()
{
- (enum e { red, green } *) 0; // ERROR - type defined in cast
- (struct s { int member; } *) 0; // ERROR - type defined in cast
- (union u { int member; } * ) 0; // ERROR - type defined in cast
- (class c { int member; } *) 0; // ERROR - type defined in cast
+ (enum e { red, green } *) 0; // { dg-error "" } type defined in cast
+ (struct s { int member; } *) 0; // { dg-error "" } type defined in cast
+ (union u { int member; } * ) 0; // { dg-error "" } type defined in cast
+ (class c { int member; } *) 0; // { dg-error "" } type defined in cast
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900406_01
// The following code causes g++ to segfault.
void function0 ()
{
- new int[]; // ERROR - causes segfault
+ new int[]; // { dg-error "" } causes segfault
}
void function1 ()
{
- new int (*)[]; // ERROR - no size specified
+ new int (*)[]; // { dg-error "" } no size specified
}
int main () { return 0; }
+// { dg-do run }
// g++ bug 900406_02
// g++ fails to correctly parse some type specifications within casts.
int function ()
{
ipp = (int (*)[]) 0; // OK
- ippp = (int (**)[]) 0; // gets bogus error (syntax)
+ ippp = (int (**)[]) 0; // { dg-bogus "" } (syntax)
return 0;
}
+// { dg-do assemble }
// g++ 1.37.1 bug 900407_01
// g++ fails to flag errors for uses of anachronistic features such as the
s1 ();
};
-s1::s1() : () { // ERROR - anachronism used
+s1::s1() : () { // { dg-error "" } anachronism used
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900428_01
// g++ fails to issue error messages for cases where an incomplete type
// dereference of pointer to volatile to be a read.
// keywords: incomplete types, evaluation, volatile qualifier
-// Build don't link:
int *ip_fn ();
int &ir_fn ();
(void)(i ? r : j); // ok, no warning
(void)((void)1, r); // ok, no warning
- vr; // WARNING - reference not accessed
- (void)vr; // WARNING - reference not accessed
- (void)(i ? vj : vr); // WARNING - reference not accessed
- (void)(i ? vr : vj); // WARNING - reference not accessed
- (void)((void)1, vr); // WARNING - reference not accessed
+ vr; // { dg-warning "" } reference not accessed
+ (void)vr; // { dg-warning "" } reference not accessed
+ (void)(i ? vj : vr); // { dg-warning "" } reference not accessed
+ (void)(i ? vr : vj); // { dg-warning "" } reference not accessed
+ (void)((void)1, vr); // { dg-warning "" } reference not accessed
*ip_fn (); // ok, no warning
*vip_fn (); // ok, no warning
ir_fn (); // ok, no warning
- vir_fn (); // WARNING - reference not accessed
+ vir_fn (); // { dg-warning "" } reference not accessed
}
struct S;
(void)(i ? *p : j); // ok, no warning
(void)((void)1, *p); // ok, no warning
- *vp; // WARNING - incomplete not accessed
- (void)*vp; // WARNING - incomplete not accessed
- (void)(i ? vj : *vp); // WARNING - incomplete not accessed
- (void)(i ? *vp : vj); // WARNING - incomplete not accessed
- (void)((void)1, *vp); // WARNING - incomplete not accessed
+ *vp; // { dg-warning "" } incomplete not accessed
+ (void)*vp; // { dg-warning "" } incomplete not accessed
+ (void)(i ? vj : *vp); // { dg-warning "" } incomplete not accessed
+ (void)(i ? *vp : vj); // { dg-warning "" } incomplete not accessed
+ (void)((void)1, *vp); // { dg-warning "" } incomplete not accessed
r; // ok, no warning
(void)r; // ok, no warning
(void)(i ? r : j); // ok, no warning
(void)((void)1, r); // ok, no warning
- vr; // WARNING - reference not accessed
- (void)vr; // WARNING - reference not accessed
- (void)(i ? vj : vr); // WARNING - reference not accessed
- (void)(i ? vr : vj); // WARNING - reference not accessed
- (void)((void)1, vr); // WARNING - reference not accessed
+ vr; // { dg-warning "" } reference not accessed
+ (void)vr; // { dg-warning "" } reference not accessed
+ (void)(i ? vj : vr); // { dg-warning "" } reference not accessed
+ (void)(i ? vr : vj); // { dg-warning "" } reference not accessed
+ (void)((void)1, vr); // { dg-warning "" } reference not accessed
*sp_fn (); // ok, no warning
- *vsp_fn (); // WARNING - incomplete not accessed
+ *vsp_fn (); // { dg-warning "" } incomplete not accessed
sr_fn (); // ok, no warning
- vsr_fn (); // WARNING - reference not accessed
+ vsr_fn (); // { dg-warning "" } reference not accessed
}
struct T {int m;};
(void)(i ? r : j); // ok, no warning
(void)((void)1, r); // ok, no warning
- vr; // WARNING - reference not accessed
- (void)vr; // WARNING - reference not accessed
- (void)(i ? vj : vr); // WARNING - reference not accessed
- (void)(i ? vr : vj); // WARNING - reference not accessed
- (void)((void)1, vr); // WARNING - reference not accessed
+ vr; // { dg-warning "" } reference not accessed
+ (void)vr; // { dg-warning "" } reference not accessed
+ (void)(i ? vj : vr); // { dg-warning "" } reference not accessed
+ (void)(i ? vr : vj); // { dg-warning "" } reference not accessed
+ (void)((void)1, vr); // { dg-warning "" } reference not accessed
*tp_fn (); // ok, no warning
*vtp_fn (); // ok, no warning
tr_fn (); // ok, no warning
- vtr_fn (); // ok, no warningWARNING - reference not accessed
+ vtr_fn (); // ok, no warning{ dg-warning "" } reference not accessed
}
void extern_test ()
extern volatile T &vetr;
es; // ok, no warning
- ves; // WARNING - incomplete not accessed
+ ves; // { dg-warning "" } incomplete not accessed
et; // ok, no warning
vet; // ok, no warning
esr; // ok, no warning
- vesr; // WARNING - incomplete not accessed
+ vesr; // { dg-warning "" } incomplete not accessed
etr; // ok, no warning
- vetr; // WARNING - reference not accessed
+ vetr; // { dg-warning "" } reference not accessed
}
+// { dg-do assemble }
// g++ 1.37.1 bug 900428_02
// g++ fails to issue either errors or warnings (even with -pedantic) for
// cfront 2.0 passes this test.
// keywords: pointer arithmetic, increment, decrement
-// Build don't link:
void *vp;
void (*fp) ();
void test ()
{
- vp++; /* ERROR - */
- ++vp; /* ERROR - */
- vp--; /* ERROR - */
- --vp; /* ERROR - */
+ vp++; /* { dg-error "" } */
+ ++vp; /* { dg-error "" } */
+ vp--; /* { dg-error "" } */
+ --vp; /* { dg-error "" } */
- fp++; /* ERROR - */
- ++fp; /* ERROR - */
- fp--; /* ERROR - */
- --fp; /* ERROR - */
+ fp++; /* { dg-error "" } */
+ ++fp; /* { dg-error "" } */
+ fp--; /* { dg-error "" } */
+ --fp; /* { dg-error "" } */
}
+// { dg-do assemble }
// g++ 1.37.1 bug 900428_03
// g++ fails to detect cases where a constructor for a derived class invokes
};
struct_0::struct_0 (int i) { }
-struct_0::struct_0 (int, int) { } // ERROR - xref from below
+struct_0::struct_0 (int, int) { } // { dg-error "" } xref from below
struct struct_1 : public struct_0 {
};
struct_1::struct_1 () : struct_0 (8,9)
-{ // ERROR -
+{ // { dg-error "" }
}
struct struct_2 {
// closing curly brace).
struct_2::struct_2 () : struct_2_data_member (8,9)
-{ // ERROR - should be up one line
+{ // { dg-error "" } should be up one line
}
int main () { return 0; }
+// { dg-do run }
// g++ 1.37.1 bug 900511_01
// g++ fails to properly apply user-defined type conversion operators
void test ()
{
d = struct_2_object + struct_1_object; // OK
- d = struct_1_object + struct_2_object; // gets bogus error
+ d = struct_1_object + struct_2_object; // { dg-bogus "" }
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900511_02
// g++ does not properly shadow names of types with names of data members
struct struct0 {
int enum0;
- void member_function (enum0 e); // ERROR - invalid use of struct-local member
+ void member_function (enum0 e); // { dg-error "" } invalid use of struct-local member
};
-void class0::member_function (enum0 e) { // ERROR - syntax error
+void class0::member_function (enum0 e) { // { dg-error "" } syntax error
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900511_03
// g++ does not properly shadow names of types with names of data members
struct struct1 {
int class0;
- void member_function (class0 *); // ERROR - invalid use of struct-local member
+ void member_function (class0 *); // { dg-error "" } invalid use of struct-local member
};
-void class1::member_function (class0 *p) { // ERROR -
+void class1::member_function (class0 *p) { // { dg-error "" }
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900514_03
// g++ fails to flag ERRORs on the following erroneous code.
struct t_0_st_1 {
int member;
- t_0_st_1 (t_0_st_0&);// ERROR -
+ t_0_st_1 (t_0_st_0&);// { dg-error "" }
t_0_st_1 ();
};
struct t_0_st_0 {
int member;
- operator t_0_st_1 ();// ERROR -
+ operator t_0_st_1 ();// { dg-error "" }
};
t_0_st_0 t_0_st_0_obj0;
t_0_st_1 t_0_st_1_obj1;
t_0_st_1 t_0_st_1_obj2;
- t_0_st_1_obj0 = t_0_st_0_obj0; // ERROR - caught
+ t_0_st_1_obj0 = t_0_st_0_obj0; // { dg-error "" } caught
t_0_st_1_obj1 = t_0_st_1 (t_0_st_0_obj0);
}
void t_0_local_init ()
{
- t_0_st_1 t_0_st_1_obj0 = t_0_st_0_obj0; // ERROR -
+ t_0_st_1 t_0_st_1_obj0 = t_0_st_0_obj0; // { dg-error "" }
t_0_st_1 t_0_st_1_obj1 = t_0_st_1 (t_0_st_0_obj0);
}
struct t_1_st_1 {
int member;
- t_1_st_1 (t_1_st_0&); // ERROR -
+ t_1_st_1 (t_1_st_0&); // { dg-error "" }
t_1_st_1 ();
- void operator= (t_1_st_1&); // ERROR -
+ void operator= (t_1_st_1&); // { dg-error "" }
};
struct t_1_st_0 {
int member;
- operator t_1_st_1 (); // ERROR -
+ operator t_1_st_1 (); // { dg-error "" }
};
t_1_st_0 t_1_st_0_obj0;
t_1_st_1 t_1_st_1_obj1;
t_1_st_1 t_1_st_1_obj2;
- t_1_st_1_obj0 = t_1_st_0_obj0; // ERROR -
- t_1_st_1_obj1 = t_1_st_1 (t_1_st_0_obj0); // ERROR -
+ t_1_st_1_obj0 = t_1_st_0_obj0; // { dg-error "" }
+ t_1_st_1_obj1 = t_1_st_1 (t_1_st_0_obj0); // { dg-error "" }
}
void t_1_local_init ()
{
- t_1_st_1 t_1_st_1_obj0 = t_1_st_0_obj0; // ERROR -
+ t_1_st_1 t_1_st_1_obj0 = t_1_st_0_obj0; // { dg-error "" }
t_1_st_1 t_1_st_1_obj1 = t_1_st_1 (t_1_st_0_obj0);
}
struct t_2_st_1 {
int member;
- t_2_st_1 (t_2_st_0); // ERROR - candidate
+ t_2_st_1 (t_2_st_0); // { dg-error "" } candidate
t_2_st_1 ();
};
struct t_2_st_0 {
int member;
- operator t_2_st_1 (); // ERROR - candidate
+ operator t_2_st_1 (); // { dg-error "" } candidate
};
t_2_st_0 t_2_st_0_obj0;
t_2_st_1 t_2_st_1_obj1;
t_2_st_1 t_2_st_1_obj2;
- t_2_st_1_obj0 = t_2_st_0_obj0; // ERROR - caught
+ t_2_st_1_obj0 = t_2_st_0_obj0; // { dg-error "" } caught
t_2_st_1_obj1 = t_2_st_1 (t_2_st_0_obj0);
}
void t_2_local_init ()
{
- t_2_st_1 t_2_st_1_obj0 = t_2_st_0_obj0; // ERROR -
+ t_2_st_1 t_2_st_1_obj0 = t_2_st_0_obj0; // { dg-error "" }
t_2_st_1 t_2_st_1_obj1 = t_2_st_1 (t_2_st_0_obj0);
}
+// { dg-do assemble }
// g++ 1.37.1 bug 900519_01
// g++ fails to flag errors for some attempts to declare or define non-member
// keywords: user-defined type conversion operator, non-member
-extern operator int (); // ERROR -
+extern operator int (); // { dg-error "" }
-extern operator int () { // ERROR -
+extern operator int () { // { dg-error "" }
return 0;
}
+// { dg-do assemble }
// g++ 1.37.1 bug 900519_02
// The C++ Reference Manual says (in section 8.4.3) "A reference to a plain
extern const int cint_obj = 9;
volatile int vint_obj = 9;
-void take_int_ref (int& arg) { } // ERROR - referenced by errors below
+void take_int_ref (int& arg) { } // { dg-error "" } referenced by errors below
-int& global_int_ref0 = cint_obj; // ERROR -
-int& global_int_ref1 = vint_obj; // ERROR -
+int& global_int_ref0 = cint_obj; // { dg-error "" }
+int& global_int_ref1 = vint_obj; // { dg-error "" }
extern const int& cint_ref;
extern volatile int& vint_ref;
void test_0 ()
{
- int& local_int_ref0 = cint_obj; // ERROR -
- int& local_int_ref1 = vint_obj; // ERROR -
+ int& local_int_ref0 = cint_obj; // { dg-error "" }
+ int& local_int_ref1 = vint_obj; // { dg-error "" }
- take_int_ref (cint_obj); // ERROR - caught
- take_int_ref (vint_obj); // ERROR -
+ take_int_ref (cint_obj); // { dg-error "" } caught
+ take_int_ref (vint_obj); // { dg-error "" }
- take_int_ref (cint_ref); // ERROR -
- take_int_ref (vint_ref); // ERROR -
+ take_int_ref (cint_ref); // { dg-error "" }
+ take_int_ref (vint_ref); // { dg-error "" }
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900519_03
// The C++ Reference Manual says (in section 8.4.3) "A reference to a
extern const int cint_obj;
extern volatile int vint_obj;
-void take_cint_ref (const int& arg) { } // ERROR -
-void take_vint_ref (volatile int& arg) { } // ERROR -
+void take_cint_ref (const int& arg) { } // { dg-error "" }
+void take_vint_ref (volatile int& arg) { } // { dg-error "" }
-const int& global_cint_ref2 = vint_obj; // ERROR -
+const int& global_cint_ref2 = vint_obj; // { dg-error "" }
-volatile int& global_vint_ref1 = cint_obj; // ERROR -
+volatile int& global_vint_ref1 = cint_obj; // { dg-error "" }
extern const int& extern_cint_ref;
extern volatile int& extern_vint_ref;
void test_0 ()
{
- const int& local_cint_ref2 = vint_obj; // ERROR -
+ const int& local_cint_ref2 = vint_obj; // { dg-error "" }
- volatile int& local_vint_ref1 = cint_obj; // ERROR -
+ volatile int& local_vint_ref1 = cint_obj; // { dg-error "" }
}
void test_1 ()
{
- take_cint_ref (vint_obj); // ERROR -
+ take_cint_ref (vint_obj); // { dg-error "" }
- take_vint_ref (cint_obj); // ERROR - caught
+ take_vint_ref (cint_obj); // { dg-error "" } caught
}
void test_2 ()
{
- take_cint_ref (extern_vint_ref); // ERROR -
+ take_cint_ref (extern_vint_ref); // { dg-error "" }
- take_vint_ref (extern_cint_ref); // ERROR -
+ take_vint_ref (extern_cint_ref); // { dg-error "" }
}
int main () { return 0; }
+// { dg-do run }
// g++ 1.37.1 bug 900519_04
// The following legal code causes g++ to segfault.
+// { dg-do run }
// g++ 1.37.1 bug 900519_05
// g++ fails to allow the use of function-reference types.
+// { dg-do assemble }
// g++ 1.37.1 bug 900519_06
// g++ allows the type given in an invocation of operator new to be a
void test (int n)
{
- new int&; // ERROR - missed
- new int_ref; // ERROR - missed
- new int&[n]; // ERROR - missed
- new int_ref[n]; // ERROR - missed
- new int&[3]; // ERROR - missed
- new int_ref[3]; // ERROR - missed
+ new int&; // { dg-error "" } missed
+ new int_ref; // { dg-error "" } missed
+ new int&[n]; // { dg-error "" } missed
+ new int_ref[n]; // { dg-error "" } missed
+ new int&[3]; // { dg-error "" } missed
+ new int_ref[3]; // { dg-error "" } missed
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900519_07
// It is illegal to specify or to use array-of-reference types, yet g++
int j;
typedef int& int_ref;
-typedef int_ref int_ref_array_type[2]; // ERROR - missed
+typedef int_ref int_ref_array_type[2]; // { dg-error "" } missed
-int& int_ref_array_obj0[2] = { i, j }; // ERROR - missed
-int_ref int_ref_array_obj1[2] = { i, j }; // ERROR - missed
+int& int_ref_array_obj0[2] = { i, j }; // { dg-error "" } missed
+int_ref int_ref_array_obj1[2] = { i, j }; // { dg-error "" } missed
+// { dg-do assemble }
// g++ 1.37.1 bug 900519_09
// g++ allows the allocation of const objects via operator new even when
void test ()
{
- new const int; // ERROR -
- new const_int; // ERROR -
- new const struct_0; // ERROR -
- new const_struct_0; // ERROR -
+ new const int; // { dg-error "" }
+ new const_int; // { dg-error "" }
+ new const struct_0; // { dg-error "" }
+ new const_struct_0; // { dg-error "" }
}
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900519_12
// The following erroneous code causes g++ to segfault.
// keywords: segfault, typedef, pointer type, function type
-typedef eek void (*)(); // ERROR -
+typedef eek void (*)(); // { dg-error "" }
int main () { return 0; }
+// { dg-do assemble }
// g++ 1.37.1 bug 900519_13
// If multiple inheritance creates a situation in which a given name is
// keywords: inheritance, ambiguity resolution, members
struct base_0 {
- enum { base_member }; // ERROR - candidate (26, 30)
+ enum { base_member }; // { dg-error "" } candidate (26, 30)
};
struct base_1 {
- int base_member; // ERROR - candidate (26, 34)
+ int base_member; // { dg-error "" } candidate (26, 34)
};
struct base_2 {
- int base_member (); // ERROR - candidate (30, 34)
+ int base_member (); // { dg-error "" } candidate (30, 34)
};
struct derived_0 : public base_0, public base_1 {
- void member () { base_member; } // ERROR -
+ void member () { base_member; } // { dg-error "" }
};
struct derived_1 : public base_0, public base_2 {
- void member () { base_member; } // ERROR - missed
+ void member () { base_member; } // { dg-error "" } missed
};
struct derived_2 : public base_1, public base_2 {
- void member () { base_member; } // ERROR - missed
+ void member () { base_member; } // { dg-error "" } missed
};
+// { dg-do assemble }
// g++ 1.37.1 bug 900520_02
// keywords: reference types, initialization, parameter passing
typedef b_array &b_array_ref;
typedef u_array &u_array_ref;
-void take_b_array_ref (b_array_ref arg) { } // ERROR - passed to here
+void take_b_array_ref (b_array_ref arg) { } // { dg-error "" } passed to here
extern u_array u_array_gbl_obj;
u_array_ref u_array_ref_gbl_obj0 = u_array_gbl_obj;
-b_array_ref b_array_ref_gbl_obj0 = u_array_ref_gbl_obj0; // ERROR - invalid declaration
+b_array_ref b_array_ref_gbl_obj0 = u_array_ref_gbl_obj0; // { dg-error "" } invalid declaration
void test_passing ()
{
- take_b_array_ref (u_array_ref_gbl_obj0); // ERROR - invalid call
+ take_b_array_ref (u_array_ref_gbl_obj0); // { dg-error "" } invalid call
}
b_array u_array_gbl_obj;
+// { dg-do assemble }
// g++ 1.37.1 bug 900520_03
// The C++ Reference Manual says (in section 8.2.4):
typedef int u_array[];
typedef u_array &u_array_ref;
-void take_u_array_ref (u_array_ref arg) { } // ERROR - reference to array of unknown bound in parmtype
+void take_u_array_ref (u_array_ref arg) { } // { dg-error "" } reference to array of unknown bound in parmtype
extern u_array u_array_gbl_obj;
u_array_ref u_array_ref_gbl_obj0 = u_array_gbl_obj; // OK
+// { dg-do run }
// g++ 1.37.1 bug 900520_04
// g++ does not yet support the initialization of scalar type objects
charp cp;
-int global_i (1); // gets bogus error
-double global_d (9.9); // gets bogus error
-charp global_cp0 (cp); // gets bogus error
-charp global_cp1 (0); // gets bogus error
-enum e_type global_e (e_value); // gets bogus error
+int global_i (1); // { dg-bogus "" }
+double global_d (9.9); // { dg-bogus "" }
+charp global_cp0 (cp); // { dg-bogus "" }
+charp global_cp1 (0); // { dg-bogus "" }
+enum e_type global_e (e_value); // { dg-bogus "" }
void func0 ()
{
- int local_i (1); // gets bogus error
- double local_d (9.9); // gets bogus error
- charp local_cp0 (cp); // gets bogus error
- charp local_cp1 (0); // gets bogus error
- enum e_type local_e (e_value); // gets bogus error
+ int local_i (1); // { dg-bogus "" }
+ double local_d (9.9); // { dg-bogus "" }
+ charp local_cp0 (cp); // { dg-bogus "" }
+ charp local_cp1 (0); // { dg-bogus "" }
+ enum e_type local_e (e_value); // { dg-bogus "" }
}
void func1 ()
{
- int* ip = new int (1); // gets bogus error
- double* dp = new double (9.9); // gets bogus error
- charp* cpp0 = new charp (cp); // gets bogus error
- charp* cpp1 = new charp (0); // gets bogus error
- enum e_type* ep = new e_type (e_value); // gets bogus error
+ int* ip = new int (1); // { dg-bogus "" }
+ double* dp = new double (9.9); // { dg-bogus "" }
+ charp* cpp0 = new charp (cp); // { dg-bogus "" }
+ charp* cpp1 = new charp (0); // { dg-bogus "" }
+ enum e_type* ep = new e_type (e_value); // { dg-bogus "" }
}
int main () { return 0; }
+// { dg-do run }
// g++ 1.37.1 bug 900520_05
// The following legal code gets syntax errors from g++.
void test0 ()
{
- new char * (cp); // gets bogus error
+ new char * (cp); // { dg-bogus "" }
}
void test1 ()
{
- new struct_0 * (sp); // gets bogus error
+ new struct_0 * (sp); // { dg-bogus "" }
}
int main () { return 0; }
+// { dg-do run }
// g++ 1.37.1 bug 900520_06
// When an object of a class type is passed into a formal parameter of the
-// excess errors test - XFAIL xstormy16-*-* *-*-darwin*
+// { dg-do run { xfail xstormy16-*-* *-*-darwin* } }
// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 June 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 Jun 1999 <nathan@acm.org>
// We cannot catch an incomplete type, or ptr to one
-struct A; // ERROR - forward decl
+struct A; // { dg-error "" } forward decl
void fn()
{
try {}
- catch (A *p) {} // ERROR - undefined type
+ catch (A *p) {} // { dg-error "" } undefined type
try {}
- catch (A p) {} // ERROR - undefined type
+ catch (A p) {} // { dg-error "" } undefined type
try {}
catch (void const *p) {} // ok
}
+// { dg-do assemble }
// Test that we notice unfortunate handler ordering.
struct A { };
void g()
{
try { f(); }
- catch (...) { } // ERROR - ... followed by others
+ catch (...) { } // { dg-error "" } ... followed by others
catch (A*) { }
try { f(); }
- catch (A*) { } // WARNING - A* before B*
- catch (B*) { } // WARNING - A* before B*
+ catch (A*) { } // { dg-warning "" } A* before B*
+ catch (B*) { } // { dg-warning "" } A* before B*
try { f(); }
catch (A*) { }
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 May 2000 <nathan@codesourcery.com>
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 May 2000 <nathan@codesourcery.com>
+// { dg-do assemble }
+// { dg-options "-O2" }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Jakub Jelinek 2 May 2001 <jakub@redhat.com>
-// Build don't link:
-// Special g++ Options: -O2
struct A;
+// { dg-do assemble }
+// { dg-options "-O1" }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Jakub Jelinek 2 May 2001 <jakub@redhat.com>
-// Build don't link:
-// Special g++ Options: -O1
void foo();
-// Build don't link:
+// { dg-do assemble }
// Origin: Mike Danylchuk <miked@mpath.com>
typedef char TCHAR;
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
// D--B--A
// +--C--A
-// Special g++ Options: -w
struct A { int m; };
struct B : A { int m; };
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
// D--B--A
// +--C--A
-// Special g++ Options: -w
struct A { int m; virtual ~A(){}};
struct B : A { int m; };
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
// D--B==A
// +--C==A
-// Special g++ Options: -w
struct A { int m; };
struct B : virtual A { int m; };
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
// D--B==A
// +--C==A
-// Special g++ Options: -w
struct A { int m; virtual ~A(){}};
struct B : virtual A { int m; };
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
// +--C==A
// +--AA-A
-// Special g++ Options: -w
struct A { int m; };
struct B : virtual A { int m; };
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
// +--C==A
// +--AA-A
-// Special g++ Options: -w
struct A { int m; virtual ~A(){}};
struct B : virtual A { int m; };
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
// +--C==A
// +--AA-A
-// Special g++ Options: -w
struct A { int m; };
struct B : virtual A { int m; };
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
// +--C==A
// +--AA-A
-// Special g++ Options: -w
struct A { int m; virtual ~A(){}};
struct B : virtual A { int m; };
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
// +--C--A
// +--E--A
-// Special g++ Options: -w
struct A { int m; };
struct B : A { int m; };
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
// +--C--A
// +--E--A
-// Special g++ Options: -w
struct A { int m; virtual ~A(){}};
struct B : A { int m; };
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 Jun 1999 <nathan@acm.org>
// D--B--A
// +--C<<A
-// Special g++ Options: -w
struct A { int m; };
struct B : A { int m; };
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 Jun 1999 <nathan@acm.org>
// D--B--A
// +--C<<A
-// Special g++ Options: -w
struct A { int m; virtual ~A(){}};
struct B : A { int m; };
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
// D==B--A
// +==C--A
-// Special g++ Options: -w
struct A { int m; };
struct B : A { int m; };
+// { dg-do run }
+// { dg-options "-w" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
// D==B--A
// +==C--A
-// Special g++ Options: -w
struct A { int m; virtual ~A(){}};
struct B : A { int m; };
+// { dg-do run }
// Test pointer chain catching
// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 9 Apr 2000 <nathan@nathan@codesourcery.com>
+// { dg-do run }
// Bug: obj gets destroyed twice because the fixups for the return are
// inside its cleanup region.
+// { dg-do run }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 11 Apr 1999 <nathan@acm.org>
(i ? throw X() : throw X()); // ok, void
(i ? i : j) = 1; // ok, int &
- (i ? throw X() : j) = 1; // ERROR - non-lvalue
- (i ? j : throw X()) = 1; // ERROR - non-lvalue
- (i ? throw X() : throw X()) = 1; // ERROR - void
+ (i ? throw X() : j) = 1; // { dg-error "" } non-lvalue
+ (i ? j : throw X()) = 1; // { dg-error "" } non-lvalue
+ (i ? throw X() : throw X()) = 1; // { dg-error "" } void
- (i ? (void)1 : i++); // ERROR - ANSI forbids
- (i ? i++ : (void)1); // ERROR - ANSI forbids
+ (i ? (void)1 : i++); // { dg-error "" } ANSI forbids
+ (i ? i++ : (void)1); // { dg-error "" } ANSI forbids
}
-// Build don't link:
-// Special g++ Options: -O1 -fno-inline-functions
+// { dg-do assemble }
+// { dg-options "-O1 -fno-inline-functions" }
struct A
{
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O" }
// Origin: Thomas Kunert <kunert@physik.tu-dresden.de>
-// Special g++ Options: -O
struct C {
~C();
-// Build don't link:
+// { dg-do assemble }
// Origin: Marc Espie <Marc.Espie@liafa.jussieu.fr>
// Used to use -fsjlj-exceptions, but that isn't an option anymore.
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O2" }
// Origin: Nathan Sidwell <nathan@codesourcery.com>
-// Special g++ Options: -O2
struct A
{
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
int i;
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 26 April 2001 <nathan@codesourcery.com>
+// { dg-do assemble }
struct A
{
A();
- A(A&); // ERROR - referenced below
+ A(A&); // { dg-error "" } referenced below
};
int
{
try
{
- throw A(); // ERROR - can't copy
+ throw A(); // { dg-error "" } can't copy
}
catch (...) { }
}
+// { dg-do run }
#include <stdio.h>
int bar ()
+// { dg-do run }
// Bug: g++ fails to treat function-try-blocks in ctors specially.
// Submitted by Jason Merrill <jason@cygnus.com>
-// Special g++ Options: -O2
+// { dg-do run }
+// { dg-options "-O2" }
#include <exception>
+// { dg-do assemble { xfail *-*-* } }
+// { dg-options "-ansi -pedantic-errors -O2" }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Nov 1999 <nathan@acm.org>
-// Build don't link:
-// Special g++ Options: -ansi -pedantic-errors -O2
-// crash test - XFAIL *-*-*
struct Foo
{
+// { dg-do run }
+// { dg-options "-O" }
// Test that inlining a destructor with a catch block doesn't confuse the
// enclosing try block.
-// Special g++ Options: -O
struct A {
~A()
+// { dg-do run }
// Test that a throw in foo destroys the A, but does not free the memory.
#include <cstddef>
+// { dg-do run }
// Test that a throw in B's constructor destroys the A and frees the memory.
#include <cstddef>
+// { dg-do run }
// Test for calling placement delete.
#include <new>
+// { dg-do run }
// Test for not calling mismatched placement delete.
#include <new>
+// { dg-do run }
// Bug: catching pointers by reference doesn't work right.
extern "C" int printf (const char *, ...);
+// { dg-do run }
extern "C" void exit (int);
extern "C" void abort (void);
struct A { int i; };
+// { dg-do run }
// Testcase for proper handling of rethrow.
#include <stdio.h>
+// { dg-do run }
// Testcase for proper handling of rethrow.
#include <stdio.h>
+// { dg-do run }
#include <stdio.h>
#include <stdlib.h>
#include <exception>
+// { dg-do run }
// Testcase for proper handling of rethrow.
#include <stdio.h>
+// { dg-do run }
// Testcase for proper handling of rethrow.
#include <stdio.h>
+// { dg-do run }
// Testcase for proper handling of rethrow.
#include <stdio.h>
+// { dg-do run }
// Testing exception specifications.
// Test 1: the original exception succeeds.
+// { dg-do run }
// Testing exception specifications.
// Test 2: the second throw succeeds.
+// { dg-do run }
// Testing exception specifications.
// Test 3: the bad_exception throw succeeds.
+// { dg-do run }
// Testing exception specifications.
// Test 4: all throws fail, call terminate.
-// Build don't link:
+// { dg-do assemble }
extern void *f(unsigned int k) throw();
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 19 Jan 1999 <nathan@acm.org>
// [except.spec] 1, a type in an exception specifier shall not be incomplete,
// or pointer or ref to incomplete
-struct X; // ERROR - forward declaration.*
-void fn1() throw(X); // ERROR - invalid use of undefined type
-void fn2() throw(X *); // ERROR - invalid use of undefined type
-void fn3() throw(X &); // ERROR - invalid use of undefined tyoe
-void fn4() throw(void); // ERROR - invalid use of void expression
-void fn5() throw(void &); // ERROR - invalid type // ERROR - invalid use of void
+struct X; // { dg-error "" } forward declaration.*
+void fn1() throw(X); // { dg-error "" } invalid use of undefined type
+void fn2() throw(X *); // { dg-error "" } invalid use of undefined type
+void fn3() throw(X &); // { dg-error "" } invalid use of undefined tyoe
+void fn4() throw(void); // { dg-error "" } invalid use of void expression
+void fn5() throw(void &); // { dg-error "" } invalid type // ERROR - invalid use of void
// except for cv pointer to void
void fn6() throw(void *); // ok -- pointer to void
void fn7() throw(void const *); // ok -- pointer to cv void
template<class T> void fny() throw(T); // ok (so far)
template<> void fny<int>() throw(int); // ok
-template<> void fny<void>() throw(void); // ERROR - invalid use of void
+template<> void fny<void>() throw(void); // { dg-error "" } invalid use of void
-template<class T> void fnx(T *) throw(T){} // ERROR - invalid use of void expression
+template<class T> void fnx(T *) throw(T){} // { dg-error "" } invalid use of void expression
void fx()
{
fnx((int *)0);
- fnx((void *)0); // ERROR - instantiated from here
+ fnx((void *)0); // { dg-error "" } instantiated from here
}
// [except.spec] 2, exception specifiers must be the same set of types (but
void baz4() throw(int, Int, char); // ... so this is a duplicate
void baz4() throw(Int, char){}
-void fna() throw(int, char); // ERROR - to previous declaration
-void fna() throw(int const, char); // ERROR - declaration different exceptions // ERROR - to previous declaration
-void fna() throw(int){} // ERROR - declaration different exceptions
+void fna() throw(int, char); // { dg-error "" } to previous declaration
+void fna() throw(int const, char); // { dg-error "" } declaration different exceptions // ERROR - to previous declaration
+void fna() throw(int){} // { dg-error "" } declaration different exceptions
-void fnb() throw(int, char); // ERROR - to previous declaration
-void fnb() throw(char){} // ERROR - declaration different exceptions
+void fnb() throw(int, char); // { dg-error "" } to previous declaration
+void fnb() throw(char){} // { dg-error "" } declaration different exceptions
-void fnc() throw(int, char); // ERROR - to previous declaration
-void fnc() throw(char, int, float){} // ERROR - declaration different exceptions
+void fnc() throw(int, char); // { dg-error "" } to previous declaration
+void fnc() throw(char, int, float){} // { dg-error "" } declaration different exceptions
-void fnd() throw(); // ERROR - to previous declaration
-void fnd() throw(char){} // ERROR - declaration different exceptions
+void fnd() throw(); // { dg-error "" } to previous declaration
+void fnd() throw(char){} // { dg-error "" } declaration different exceptions
-void fne() throw(char); // ERROR - to previous declaration
-void fne() throw(){} // ERROR - declaration different exceptions
+void fne() throw(char); // { dg-error "" } to previous declaration
+void fne() throw(){} // { dg-error "" } declaration different exceptions
-void fnf(); // ERROR - to previous declaration
-void fnf() throw(char){} // ERROR - declaration different exceptions
+void fnf(); // { dg-error "" } to previous declaration
+void fnf() throw(char){} // { dg-error "" } declaration different exceptions
-void fng() throw(char); // ERROR - to previous declaration
-void fng(){} // ERROR - declaration different exceptions
+void fng() throw(char); // { dg-error "" } to previous declaration
+void fng(){} // { dg-error "" } declaration different exceptions
-void fnh() throw(int, char); // ERROR - to previous declaration
-void fnh() throw(int, float){} // ERROR - declaration different exceptions
+void fnh() throw(int, char); // { dg-error "" } to previous declaration
+void fnh() throw(int, float){} // { dg-error "" } declaration different exceptions
-void fni() throw(int, char); // ERROR - to previous declaration
-void fni() throw(float, char){} // ERROR - declaration different exceptions
+void fni() throw(int, char); // { dg-error "" } to previous declaration
+void fni() throw(float, char){} // { dg-error "" } declaration different exceptions
// [except.spec] 3, virtual function overriders shall throw a subset of the
// overridden function
struct H : private E {};
struct A
{
- virtual void foo() throw(); // ERROR - overriding
+ virtual void foo() throw(); // { dg-error "" } overriding
virtual void baz() throw(double, int);
virtual void bar();
virtual void qux() throw(E);
- virtual void qux(int) throw(E const *); // ERROR - overriding (pedantically)
- virtual void quux() throw(F); // ERROR - overriding
- virtual void quux(int) throw(F *); // ERROR - overriding
- virtual void wibble() throw(E); // ERROR - overriding
- virtual void wobble() throw(E *); // ERROR - overriding
- virtual void wobble(int) throw(E *); // ERROR - overriding
+ virtual void qux(int) throw(E const *); // { dg-error "" } overriding (pedantically)
+ virtual void quux() throw(F); // { dg-error "" } overriding
+ virtual void quux(int) throw(F *); // { dg-error "" } overriding
+ virtual void wibble() throw(E); // { dg-error "" } overriding
+ virtual void wobble() throw(E *); // { dg-error "" } overriding
+ virtual void wobble(int) throw(E *); // { dg-error "" } overriding
virtual void wabble(int) throw(E *);
virtual void wubble(int) throw(E *, H *);
- virtual ~A() throw(); // ERROR - overriding
+ virtual ~A() throw(); // { dg-error "" } overriding
};
struct B : A
{
- virtual void foo() throw(int); // ERROR - looser throw - A::foo
+ virtual void foo() throw(int); // { dg-error "" } looser throw - A::foo
virtual void baz() throw(double); // ok subset
virtual void bar(int) throw(int); // ok not overriding
virtual void qux() throw(F); // ok subset
- virtual void qux(int) throw(F *); // ERROR - looser (pedantically)
- virtual void quux() throw(E); // ERROR - looser throw - A::quux()
- virtual void quux(int) throw(E *); // ERROR - looser throw - A::quux(int)
- virtual void wibble() throw(E *); // ERROR - looser throw - A::wibble
- virtual void wobble() throw(G *); // ERROR - looser throw - A::wobble()
- virtual void wobble(int) throw(H *); // ERROR - looser throw - A::wobble(int)
+ virtual void qux(int) throw(F *); // { dg-error "" } looser (pedantically)
+ virtual void quux() throw(E); // { dg-error "" } looser throw - A::quux()
+ virtual void quux(int) throw(E *); // { dg-error "" } looser throw - A::quux(int)
+ virtual void wibble() throw(E *); // { dg-error "" } looser throw - A::wibble
+ virtual void wobble() throw(G *); // { dg-error "" } looser throw - A::wobble()
+ virtual void wobble(int) throw(H *); // { dg-error "" } looser throw - A::wobble(int)
virtual void wubble(int) throw(H *); // ok
virtual void wabble(int) throw(F1 *, F *); // ok
};
struct A1
{
virtual void foo() throw(int);
- virtual void bar() throw(); // ERROR - overriding
+ virtual void bar() throw(); // { dg-error "" } overriding
virtual ~A1() throw(int);
};
};
struct C : A, A1
-{ // ERROR - looser throw - A::~A()
- virtual void foo() throw(int); // ERROR - looser throw - A::foo
- virtual void bar() throw(int); // ERROR - looser throw - A1::bar
+{ // { dg-error "" } looser throw - A::~A()
+ virtual void foo() throw(int); // { dg-error "" } looser throw - A::foo
+ virtual void bar() throw(int); // { dg-error "" } looser throw - A1::bar
};
struct D : A, A1
{
- virtual ~D() throw(int); // ERROR - looser throw - A::~A()
+ virtual ~D() throw(int); // { dg-error "" } looser throw - A::~A()
};
// [except.spec] 5, types shall not be defined in exception specifiers
-void fn8() throw(struct Z {}); // ERROR - ANSI C++ forbids
+void fn8() throw(struct Z {}); // { dg-error "" } ANSI C++ forbids
+// { dg-do run }
// Test that we allow simple throw specs on pointers.
void f() throw () { }
+// { dg-do run }
// Test that an exception thrown out of the constructor for the exception
// object (i.e. "after completing evaluation of the expression to be thrown
// but before the exception is caught") causes us to call terminate.
+// { dg-do run }
// Test that an unhandled exception causes us to call terminate.
#include <exception>
-// Build don't link:
+// { dg-do assemble }
void athrow(const int & e) throw(int)
{
-// Build don't link:
+// { dg-do assemble }
// Submitted by Sebastian Ritterbusch <uabp@rz.uni-karlsruhe.de>
void athrow(const ANY & e) throw(ANY)
{
- throw e; // gets bogus error - discarding const
+ throw e; // { dg-bogus "" } discarding const
}
int main(void)
+// { dg-do run }
template <class T>
void f() throw (T)
{
-// Build don't link:
-// Special g++ flags: -O
-// crash test - XFAIL i*86-*-linux*
+// { dg-do assemble { xfail i*86-*-linux* } }
+// { dg-options "-O" }
// Posted by H. J. Lu <hjl@lucon.org>
-// Build don't link:
+// { dg-do assemble }
// Posted by Trevor Taylor <ttaylor@powerup.com.au>
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T> void test(){
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T = int>
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S
+// { dg-do run }
// Test that unwinding properly restores SP.
// Contributed by Jason Merrill <jason@cygnus.com>
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
int i;
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
int i;
-// Build don't link:
+// { dg-do assemble }
// Used to use -fsjlj-exceptions, but that isn't an option anymore.
// Origin: Donn Terry <donn@interix.com>
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 8 Mar 2000 <nathan@codesourcery.com>
+// { dg-do assemble }
+// { dg-options "-fms-extensions" }
// Test that taking the address of a member function name produces
// a pointer to member function.
// Contributed by Jason Merrill <jason@cygnus.com>
-// Special g++ Options: -fms-extensions
-// Build don't link:
struct A { };
int (A::*p)();
+// { dg-do run }
+// { dg-options "-fms-extensions" }
// Test for implicit & on methods.
// Contributed by Jason Merrill <jason@cygnus.com>.
-// Special g++ Options: -fms-extensions
struct A {
void f (int = 0) { }
+// { dg-do run }
+// { dg-options "-fpermissive -w" }
// Test for overload resolution in comparison expressions.
// Contributed by Jason Merrill <jason@cygnus.com>.
-// Special g++ Options: -fpermissive -w
void f (int) { }
void f ();
+// { dg-do run }
+// { dg-options "-fms-extensions" }
// Test that an object-dependent reference to a member function can be
// used to produce a pointer to member function, as in VC++.
// Contributed by Jason Merrill <jason@cygnus.com>
-// Special g++ Options: -fms-extensions
struct A
{
-// Special g++ Options:
+// { dg-do run }
+// { dg-options "" }
union U {
struct { int i; int j; };
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
struct S
{
union U {
struct {
- S s; // ERROR - struct with constructor in union
+ S s; // { dg-error "" } struct with constructor in union
};
};
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 Jun 2001 <nathan@codesourcery.com>
+// { dg-do assemble }
+// { dg-options "" }
// Testcase for assignment of non-array to array (assigns the same value to
// each member)
-// Build don't link:
// Special Options:
typedef struct {} ct2d_rigid, ct2d_rigid_a[1];
ccBgaInspection::reinspect (unsigned long diag_flags)
{
ct2d_rigid physTdev;
- _dev2phys = physTdev; // ERROR -
+ _dev2phys = physTdev; // { dg-error "" }
}
+// { dg-do assemble }
+// { dg-options "-w" }
// This testcase used to cause a crash on the Alpha.
-// Special g++ Options: -w
-// Build don't link:
struct A {
int i;
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options:
void *vp;
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
-// Special g++ Options:
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Mark Mitchell 19 Mar 2000 <mark@codesourcery.com>
+// { dg-do assemble }
+// { dg-options "" }
// PRMS Id: 4992
-// Build don't link:
-// Special g++ Options:
int *f(){
- return new int[1] = { 1 }; // ERROR - removed
+ return new int[1] = { 1 }; // { dg-error "" } removed
}
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
-int *foo = new int[1](0); // gets bogus error -
+int *foo = new int[1](0); // { dg-bogus "" }
-// Build don't link:
-// Skip if not target: i?86-*-*
+// { dg-do assemble { target i?86-*-* } }
// Origin: Anthony Green <green@cygnus.com>
void foo ()
+// { dg-do assemble { target i?86-*-* } }
// Test for using prefix attributes in a parameter decl.
// Contributed by Jason Merrill <jason@cygnus.com>
-// Skip if not target: i?86-*-*
-// Build don't link:
#define _stdcall __attribute__ ((__stdcall__))
+// { dg-do run { target i?86-*-* } }
// Test that stdcall doesn't prevent us from using op delete.
// Contributed by Jason Merrill <jason@cygnus.com>
-// Skip if not target: i?86-*-*
struct A {
void operator delete (void *) __attribute__ ((stdcall));
+// { dg-do run { target i?86-*-* } }
// Test for proper handling of attributes in template instantiation.
// Contributed by Jason Merrill <jason@cygnus.com>
-// Skip if not target: i?86-*-*
template <class T>
struct A {
+// { dg-do assemble }
+// { dg-options "-Wformat" }
// Test that attributes are really applied to function declarations under
// various conditions.
// Contributed by Jason Merrill (jason@cygnus.com)
-// Special g++ Options: -Wformat
-// Build don't link:
#define PF __attribute__ ((format (printf, 1, 2)))
void A::test ()
{
- f ("%f", 42); // WARNING -
- g ("%f", 42); // WARNING -
- h ("%f", 42); // WARNING -
- k ("%f", 42); // WARNING -
+ f ("%f", 42); // { dg-warning "" }
+ g ("%f", 42); // { dg-warning "" }
+ h ("%f", 42); // { dg-warning "" }
+ k ("%f", 42); // { dg-warning "" }
}
+// { dg-do run { xfail alpha*-dec-osf* *-*-hms i?86-pc-cygwin *-*-coff } }
// Test that attributes weak and alias coexist.
-// excess errors test - XFAIL alpha*-dec-osf* *-*-hms i?86-pc-cygwin *-*-coff
extern "C" {
void f () __attribute__((weak, alias ("_f")));
+// { dg-do assemble }
// Test that postfix attributes only apply to a single declared object.
// (decl_attributes used to chain them onto the end of the prefix attributes,
// which caused them to apply to other declarations as well.)
// Origin: Joseph Myers <jsm28@cam.ac.uk>.
-// Build don't link:
void __attribute__((__noreturn__)) foo (const char *, ...) __attribute__((__format__(__printf__, 1, 2))), bar (void);
+// { dg-do assemble }
+// { dg-options "-Wno-pmf-conversions" }
// Testcase for cast of bound pointer to member function.
-// Special g++ Options: -Wno-pmf-conversions
-// Build don't link:
struct A {
int f ();
+// { dg-do run }
+// { dg-options "" }
// Testcase for constructor expressions (GNU extension)
-// Special g++ Options:
struct Any {
int *type;
+// { dg-do assemble }
// PRMS Id: 5353
// This may be an extension, but it's a very common one...
class A {
public:
static A*func (int = 3);
- static A*(*ptr)(int = 4); // ERROR - .*
+ static A*(*ptr)(int = 4); // { dg-error "" } .*
};
A*(*A::ptr)(int) = &A::func;
{
A foo;
- A::ptr(); // ERROR - .*
+ A::ptr(); // { dg-error "" } .*
A::ptr(47);
}
+// { dg-do run }
+// { dg-options "-w" }
// Jason Merrill <jason@redhat.com>
-// Special g++ Options: -w
// Test for deleting a void pointer, which the standard says is undefined,
// but which is used by several free C++ programs.
+// { dg-do run }
+// { dg-options "-fpermissive -w" }
// Test that we can jump over the declaration of a non-POD object.
// Contributed by Jason Merrill <jason@cygnus.com>
-// Special g++ Options: -fpermissive -w
struct A { };
union U {
+// { dg-do run }
+// { dg-options "" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options:
int main ()
{
+// { dg-do run }
+// { dg-options "" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options:
template <class T>
int f ()
+// { dg-do assemble }
+// { dg-options "" }
// From: Ove.Ewerlid@syscon.uu.se (Ove Ewerlid)
// Subject: ss-940630:cc1plus: internal error
// Date: Sat, 2 Jul 1994 05:07:20 +0200
-// Special g++ Options:
-// Build don't link:
class qwerty {
public:
class foo {
private:
- static const unsigned char * const dummy_key = (unsigned char*)"ThisIs a dummy!"; // ERROR -
+ static const unsigned char * const dummy_key = (unsigned char*)"ThisIs a dummy!"; // { dg-error "" }
public:
void bar ();
void
foo::bar ()
{
- qwerty QWERTY ((unsigned short*)dummy_key); // ERROR -
+ qwerty QWERTY ((unsigned short*)dummy_key); // { dg-error "" }
}
-// Special g++ Options: -Wno-deprecated
+// { dg-do assemble }
+// { dg-options "-Wno-deprecated" }
-int f(int x) return y(x) { } // ERROR -
+int f(int x) return y(x) { } // { dg-error "" }
extern "C" void abort ();
-// Skip if not target: alpha*-*-*
-// Special g++ Options: -Wno-deprecated
+// { dg-do assemble { target alpha*-*-* } }
+// { dg-options "-Wno-deprecated" }
// This test verifies that return type promotion is working correctly.
// The Alpha ABI specifies that 32-bit return values have bit 31 propagated,
// i.e. the value is sign-extended even if the unpromoted type is unsigned.
-unsigned int f(unsigned int x) return y(x) { } // ERROR -
+unsigned int f(unsigned int x) return y(x) { } // { dg-error "" }
extern "C" void abort ();
-// Special g++ Options: -Wno-deprecated
+// { dg-do assemble }
+// { dg-options "-Wno-deprecated" }
extern "C" void abort();
return 2;
}
-int f1() return x // ERROR -
+int f1() return x // { dg-error "" }
{
- f2(&x); // ERROR -
+ f2(&x); // { dg-error "" }
}
void g()
+// { dg-do run }
+// { dg-options "-fno-weak" }
// Test that -fno-weak doesn't break explicit instantiation of static data.
-// Special g++ Options: -fno-weak
template <class T> struct A
{
+// { dg-do run }
// Test for overloading with g++ NULL.
void f (int *) { }
-// Build don't link:
-// Special g++ Options: -fpermissive
+// { dg-do assemble }
+// { dg-options "-fpermissive" }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 28 Feb 2001 <nathan@codesourcery.com>
{
X (int);
};
-void Foo (int, float, bool); // WARNING - candidate
-void Foo (float, int, X); // WARNING - candidate
+void Foo (int, float, bool); // { dg-warning "" } candidate
+void Foo (float, int, X); // { dg-warning "" } candidate
void Baz ()
{
- Foo (1, 1, 0); // WARNING - least worse
+ Foo (1, 1, 0); // { dg-warning "" } least worse
}
+// { dg-do assemble }
// Test for PRETTY_FUNCTION
-// Build don't link:
class SV;
+// { dg-do run }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>
+// { dg-do run }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 3 Mar 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Nov 1999 <nathan@acm.org>
+// { dg-do assemble }
+// { dg-options "-Wno-deprecated" }
// Test that the named return value extension works when passed as a reference.
// Origin: Jason Merrill <jason@redhat.com>
-// Special g++ Options: -Wno-deprecated
void f (int &i)
{
i = 42;
}
-int g () return r // ERROR - named return value
+int g () return r // { dg-error "" } named return value
{
- f (r); // ERROR - undeclared
+ f (r); // { dg-error "" } undeclared
}
int main ()
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options:
void f ()
{
+// { dg-do assemble }
+// { dg-options "" }
// Test that we don't complain about trying to define bool or wchar_t in a
// system header.
-// Special g++ Options:
-// Build don't link:
# 1 "syshdr1.C"
# 1 "syshdr1.h" 1 3
+// { dg-do run }
// Bug: g++ forgets about the instantiation of class1 when looking up
// class11_value, and tries to look things up in class1<class2>.
-// Build don't link:
+// { dg-do assemble }
struct inttest {
int elem[1];
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S
{
- int i; // ERROR - non-static data member
- __typeof( S::i ) f (); // ERROR - referenced here
+ int i; // { dg-error "" } non-static data member
+ __typeof( S::i ) f (); // { dg-error "" } referenced here
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed gb scope
struct c { typedef int t; };
struct d { typedef char t; };
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed gb scope
struct c {
typedef int t;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed gb scope
struct c {
class t { };
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed gb scope
struct a {
struct c {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed gb scope
struct C {
void foo (int);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed gb scope
struct C {
struct D {
int x;
void foo ();
};
- const int Ok = 0; // ERROR - initialization forbidden
+ const int Ok = 0; // { dg-error "" } initialization forbidden
};
void C::D::foo ()
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed gb scope
struct D {
friend class A;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed gb scope
template <class X> class C {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed gb scope
class enclose {
int e;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed gb scope
void Foo (void)
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed gb scope
template<class T, int N> class fixed_array {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed gb scope
template<class T, int N> class FixedArray_t {
public:
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed gb scope
class X {
public:
+// { dg-do run }
+// { dg-options "" }
# 1 "SetLS.cc"
// GROUPS passed templates nested-classes
-// Special g++ Options:
//
// The SetLS template test
//
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed assignment
class ccUnwind
{
+// { dg-do assemble }
// Bug: access declarations are broken.
-// Build don't link:
class A {
public:
void foo() {
B b;
- b.foo (); // gets bogus error -
+ b.foo (); // { dg-bogus "" }
}
+// { dg-do assemble }
// PRMS Id: 4839
// Bug: The initializer of a static member of a class has the same acess
// rights as a member function. g++ doesn't realize that.
-// Build don't link:
class X
{
+// { dg-do assemble }
// PRMS Id: 4900
// Bug: g++ doesn't apply access control uniformly to type conversion operators
-// Build don't link:
struct A {
protected:
+// { dg-do assemble }
// PRMS Id: 4694
// Bug: g++ doesn't realize that A::i refers to a member of `this' in B().
-// Build don't link:
class A {
protected:
+// { dg-do assemble }
// PRMS Id: 4955
-// Build don't link:
struct A {
protected:
struct B: public A {
void g () {
- this->A::i = 1; // gets bogus error - access control failure
- this->A::f(); // gets bogus error - access control failure
+ this->A::i = 1; // { dg-bogus "" } access control failure
+ this->A::f(); // { dg-bogus "" } access control failure
}
};
-// Build don't link:
+// { dg-do assemble }
template <class T> struct A { T t; };
template <class T> class B: private T {
public:
- T::t; // gets bogus error - doesn't recognize access decl
+ T::t; // { dg-bogus "" } doesn't recognize access decl
};
template class B<A<int> >;
+// { dg-do assemble }
// Bug: g++ complains about Z being a private base when trying to
// initialize B::foo.
-// Build don't link:
struct Z {
Z();
B(const B&);
};
-B::B() : foo(1) { } // gets bogus error
+B::B() : foo(1) { } // { dg-bogus "" }
+// { dg-do assemble }
// Bug: g++ uses the same binfo for the a subobject of c and the a subobject
// of b, so basetype_paths get bashed improperly.
-// Build don't link:
class a {
protected:
- virtual void foo() { } // gets bogus error
+ virtual void foo() { } // { dg-bogus "" }
};
class b : public virtual a {};
class c : public b {
public:
- void bar() { b::foo(); } // gets bogus error
+ void bar() { b::foo(); } // { dg-bogus "" }
};
int main() {
+// { dg-do assemble }
// Make sure definitions of static members have the right access.
-// Build don't link:
struct A {
protected:
- int i; // ERROR - private
- int f (); // ERROR -
+ int i; // { dg-error "" } private
+ int f (); // { dg-error "" }
};
struct B: public A {
static int (A::*fp)();
};
-int A::* B::p = &A::i; // ERROR -
+int A::* B::p = &A::i; // { dg-error "" }
int (A::* B::fp)() = &A::f; // ERROR -
struct C {
static int (A::*fp)();
};
-int A::* C::p = &A::i; // ERROR -
-int (A::* C::fp)() = &A::f; // ERROR -
+int A::* C::p = &A::i; // { dg-error "" }
+int (A::* C::fp)() = &A::f; // { dg-error "" }
+// { dg-do assemble }
+// { dg-options "-w" }
// PRMS Id: 5073
// Bug: g++ doesn't catch access violations in base initializers.
-// Special g++ Options: -w
int r = 0;
class A {
private:
- A() { r = 1; } // ERROR -
- ~A() {} // ERROR -
+ A() { r = 1; } // { dg-error "" }
+ ~A() {} // { dg-error "" }
};
class B : public A {
public:
- B(): A() {} // ERROR -
- B(const B&) {} // ERROR -
- ~B() { } // ERROR - private dtor
+ B(): A() {} // { dg-error "" }
+ B(const B&) {} // { dg-error "" }
+ ~B() { } // { dg-error "" } private dtor
};
main()
+// { dg-do assemble }
// Bug: g++ doesn't deal with friends also being derived classes.
-// Build don't link:
class A {
int i;
+// { dg-do assemble }
// PRMS Id: 6662
// Bug: we crash trying to check the access on anglesSinesCosines.
-// Build don't link:
#define Double double
+// { dg-do assemble }
// PRMS Id: 6877
-// Build don't link:
typedef __SIZE_TYPE__ size_t;
class aa {
class bb {
public:
aa caa;
-}; // gets bogus error - calling private delete
+}; // { dg-bogus "" } calling private delete
void
f(){
+// { dg-do assemble }
// PRMS Id: 8518
// Bug: Call to foo is not checked for accessibility
class A
{
private:
- static void foo() {} // ERROR -
+ static void foo() {} // { dg-error "" }
public:
void goo() {}
};
struct B : public A
{
- void func() { foo(); } // ERROR -
+ void func() { foo(); } // { dg-error "" }
};
int main()
+// { dg-do assemble }
// PRMS Id: 9127
// Bug: members of anonymous unions are not access-controlled.
int PUB_A;
protected:
union {
- long B; // ERROR - protected
- void *pY; // ERROR - protected
+ long B; // { dg-error "" } protected
+ void *pY; // { dg-error "" } protected
} ;
union Y {
long B;
void *pY;
- } PRT; // ERROR - protected
- int PRT_A; // ERROR - protected
+ } PRT; // { dg-error "" } protected
+ int PRT_A; // { dg-error "" } protected
private:
union {
- long C; // ERROR - private
- void *pZ; // ERROR - private
+ long C; // { dg-error "" } private
+ void *pZ; // { dg-error "" } private
};
union Z {
long C;
void *pZ;
- } PRV; // ERROR - private
- int PRV_A; // ERROR - private
+ } PRV; // { dg-error "" } private
+ int PRV_A; // { dg-error "" } private
};
struct Bar : public Foo {
PRT_A = 0;
PRT.B = 0;
printf("%x\n",Foo::PRT.pY);
- PRV_A = 0; // ERROR -
- Foo::C = 0; // ERROR -
- printf("%x\n",pZ); // ERROR -
- Foo::PRV.C = 0; // ERROR -
- printf("%x\n",PRV.pZ); // ERROR -
+ PRV_A = 0; // { dg-error "" }
+ Foo::C = 0; // { dg-error "" }
+ printf("%x\n",pZ); // { dg-error "" }
+ Foo::PRV.C = 0; // { dg-error "" }
+ printf("%x\n",PRV.pZ); // { dg-error "" }
}
};
a.PUB_A = 0;
a.A = 0;
printf("%x\n",a.pX);
- a.PRT_A = 0; // ERROR -
- a.B = 0; // ERROR -
- printf("%x\n",a.pY); // ERROR -
- a.PRV_A = 0; // ERROR -
- a.C = 0; // ERROR -
- printf("%x\n",a.pZ); // ERROR -
+ a.PRT_A = 0; // { dg-error "" }
+ a.B = 0; // { dg-error "" }
+ printf("%x\n",a.pY); // { dg-error "" }
+ a.PRV_A = 0; // { dg-error "" }
+ a.C = 0; // { dg-error "" }
+ printf("%x\n",a.pZ); // { dg-error "" }
a.PUB.A = 0;
printf("%x\n",a.PUB.pX);
- a.PRT.B = 0; // ERROR -
- printf("%x\n",a.PRT.pY); // ERROR -
- a.PRV.C = 0; // ERROR -
- printf("%x\n",a.PRV.pZ); // ERROR -
+ a.PRT.B = 0; // { dg-error "" }
+ printf("%x\n",a.PRT.pY); // { dg-error "" }
+ a.PRV.C = 0; // { dg-error "" }
+ printf("%x\n",a.PRV.pZ); // { dg-error "" }
}
+// { dg-do assemble }
// Bug: forward reference to friend doesn't work in template.
-// Build don't link:
template <class T> class A {
static int i;
+// { dg-do assemble }
// Simple testcase for access control.
-// Build don't link:
class A {
protected:
+// { dg-do assemble }
// Simple testcase for access control.
-// Build don't link:
class A {
protected:
+// { dg-do assemble }
// Simple testcase for access control.
-// Build don't link:
class A {
protected:
+// { dg-do assemble }
// Simple testcase for access control.
-// Build don't link:
class A {
public:
+// { dg-do assemble }
// Simple testcase for access control.
-// Build don't link:
class A {
protected:
class B: public A {};
class C: public A {};
class D: public C, public B {
- void g () { A::f(); } // gets bogus error - wrongly ambiguous static member call
+ void g () { A::f(); } // { dg-bogus "" } wrongly ambiguous static member call
};
+// { dg-do assemble }
// From: smidt@dd.chalmers.se (Peter Smidt)
// Date: 25 Jan 1994 23:41:33 -0500
// Bug: g++ forgets access decls after the definition.
-// Build don't link:
-class inh { // ERROR - inaccessible
+class inh { // { dg-error "" } inaccessible
int a;
protected:
void myf(int);
}
void top_t::myf(int i) {
- inh::myf(i); // ERROR - cannot convert to inh
+ inh::myf(i); // { dg-error "" } cannot convert to inh
mel::myf(i);
}
+// { dg-do assemble }
// Bug: g++ doesn't allow const objects to be constructed.
-// Build don't link:
struct B { B(); };
const B foo()
{
- return B(); // gets bogus error - constructing const
+ return B(); // { dg-bogus "" } constructing const
}
+// { dg-do run }
struct A { int i; };
int main()
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// Testcase for ambiguity between functional cast and abstract declarator.
// This ambiguity accounts for 6 of the r/r conflicts.
-// Special g++ Options: -pedantic-errors
-int i = sizeof (int ()); // ERROR - sizeof applied to fn type
+int i = sizeof (int ()); // { dg-error "" } sizeof applied to fn type
int j = sizeof (int () + 1);
+// { dg-do assemble }
+// { dg-options "-Wno-pointer-arith" }
// Testcase for ambiguity between cast and parmlist.
// This ambiguity accounts for 1 of the r/r conflicts.
// Do not compile with -pedantic so that the compiler will accept taking
// the sizeof a function type.
-// Special g++ Options: -Wno-pointer-arith
-// Build don't link:
void f(){
(void)sizeof(int((int)1.2));
- (void)sizeof(int((int))); // gets bogus error -
+ (void)sizeof(int((int))); // { dg-bogus "" }
}
+// { dg-do assemble }
// Testcase for ambiguity between function and variable declaration (8.2).
-// Build don't link:
struct A {
A (int, int);
void f ()
{
int i[2], j;
- A a (int (i[1]), j); // gets bogus error - late parsing
+ A a (int (i[1]), j); // { dg-bogus "" } late parsing
A b (int (i[1]), int j); // function
- a.k = 0; // gets bogus error - late parsing
+ a.k = 0; // { dg-bogus "" } late parsing
b (i, j);
}
+// { dg-do run }
// Bug: g++ has trouble copying anonymous structs.
typedef struct { int i; } foo;
+// { dg-do assemble }
// g++ should not complain about anonymous bitfields.
-// Build don't link:
struct A
{
+// { dg-do assemble }
// Bug: g++ dies.
-// Build don't link:
class cl {
public:
private:
union {
float vf;
- struct ff { // ERROR - nested class in anonymous union
+ struct ff { // { dg-error "" } nested class in anonymous union
void *ptr;
char *name;
int sz;
+// { dg-do assemble }
+// { dg-options "-O" }
// PRMS Id: 5371
// Bug: g++ screws up the alignment of buff and dies.
-// Build don't link:
-// Special g++ Options: -O
main()
{
+// { dg-do assemble }
// Bug: g++ only looks in the current temporary binding level for a name.
struct T { ~T(); };
int main()
{
foo:
- T t; // ERROR - redeclared
+ T t; // { dg-error "" } redeclared
bar:
- T t; // ERROR - redeclaration
+ T t; // { dg-error "" } redeclaration
}
+// { dg-do assemble }
// Bug: g++ screws up binding levels in a switch statement with cleanups.
-// Build don't link:
struct A {
~A() { }
+// { dg-do assemble }
// Bug: g++ fails to clear out the IDENTIFIER_CLASS_VALUEs of various names
// after a class definition.
-// Build don't link:
struct A {
typedef double T;
};
struct C : public A {
- T f (); // gets bogus error
+ T f (); // { dg-bogus "" }
};
+// { dg-do assemble }
// Testcase for uses of bool.
-// Build don't link:
int i,j,k;
{
a || true;
b || true;
- c || true; // gets bogus error
+ c || true; // { dg-bogus "" }
d || true;
e || true;
}
+// { dg-do run }
// Make sure that bool bitfields promote to int properly.
struct F {
+// { dg-do assemble }
// From: panisset@cae.ca (Jean-Francois Panisset)
// Subject: Problem with constant expressions for bitfields
// Date: Mon, 6 Jun 94 14:00:01 EDT
// Bug: g++ doesn't treat boolean true and false as constant values.
-// Build don't link:
enum E { e1,e2,e3,e4,e5 };
struct X
{
- unsigned int bits : ((e5 > 4) ? 8 : 4); // gets bogus error - constant expression
+ unsigned int bits : ((e5 > 4) ? 8 : 4); // { dg-bogus "" } constant expression
};
+// { dg-do run }
// Test for allowing conversion to bool.
struct A { };
+// { dg-do run }
int main ()
{
bool b = false;
+// { dg-do assemble }
// Bug: The conversion from bool to int gets stripped.
-// Build don't link:
bool b;
-// Build don't link:
+// { dg-do assemble }
struct A
{
+// { dg-do assemble }
+// { dg-options "-w" }
// Bug: g++ overloads strlen instead of bashing the builtin version.
-// Special g++ Options: -w
-// Build don't link:
extern "C" void strlen (const char *);
-// Build don't link:
+// { dg-do assemble }
static inline void strlen (const char *) { }
void f ()
{
- strlen("Hi"); // gets bogus error - wrongful overload
+ strlen("Hi"); // { dg-bogus "" } wrongful overload
}
+// { dg-do run }
// Bug: a is destroyed in both foo() and main()
int count;
+// { dg-do assemble }
// From: panisset@cae.ca (Jean-Francois Panisset)
// Subject: 2.6.0 pre-rel, internal error, regression, mips-sgi-irix4
// Date: Thu, 14 Jul 94 23:34:21 EDT
-// Build don't link:
class Char
{
+// { dg-do assemble }
// Test to make sure that value return of classes with cleanups works; it
// has been broken at various times on PCC_STATIC_STRUCT_RETURN targets.
-// Build don't link:
struct A {};
+// { dg-do assemble }
// Bug: the compiler gets hopelessly confused.
-// Build don't link:
#line 1 "c-inline.h"
#pragma interface
+// { dg-do assemble }
// Bug: g++ fails to grok functional casts in all situations.
-// Build don't link:
class A {
public:
typedef int B;
- static B foo() { return B(1); } // gets bogus error -
+ static B foo() { return B(1); } // { dg-bogus "" }
};
-// Build don't link:
+// { dg-do assemble }
// The compiler tried to build up a double with a NOP_EXPR from
// integer_zero_node, which fails.
+// { dg-do assemble }
// PRMS Id: 7088
-// Build don't link:
struct string
{
+// { dg-do run }
// Bug: continue over object decl calls destructor but not constructor.
int c = 0;
+// { dg-do assemble }
// PRMS Id: 6303
// Bug: compiler crashes processing the cleanup for arrayOfClass.
-// Build don't link:
class Class {
public:
+// { dg-do assemble }
// PRMS Id: 4695
// Bug: g++ wrongly requires A to be complete here.
-// Build don't link:
struct A;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed rtti
// Negative testcase for decls in conditions.
{
float i;
- if (int i = 1) // ERROR - , XFAIL *-*-*
+ if (int i = 1) // { dg-error "" "" { xfail *-*-* } } ,
{
- char i; // ERROR - , XFAIL *-*-*
+ char i; // { dg-error "" "" { xfail *-*-* } } ,
char j;
}
else
{
- short i; // ERROR - , XFAIL *-*-*
+ short i; // { dg-error "" "" { xfail *-*-* } } ,
char j;
}
- while (int i = 0) // ERROR - XFAIL *-*-*
+ while (int i = 0) // { dg-error "" "" { xfail *-*-* } }
{
- int i; // ERROR - XFAIL *-*-*
+ int i; // { dg-error "" "" { xfail *-*-* } }
}
- for (; int i = 0; ) // ERROR - XFAIL *-*-*
+ for (; int i = 0; ) // { dg-error "" "" { xfail *-*-* } }
{
- int i; // ERROR - XFAIL *-*-*
+ int i; // { dg-error "" "" { xfail *-*-* } }
}
- switch (int i = 0) // ERROR - XFAIL *-*-*
+ switch (int i = 0) // { dg-error "" "" { xfail *-*-* } }
{
default:
- int i; // ERROR - XFAIL *-*-*
+ int i; // { dg-error "" "" { xfail *-*-* } }
}
- if (struct A { operator int () { return 1; } } *foo = new A) // ERROR -
+ if (struct A { operator int () { return 1; } } *foo = new A) // { dg-error "" }
;
- A bar; // ERROR -
+ A bar; // { dg-error "" }
- if (enum A { one, two, three } foo = one) // ERROR -
+ if (enum A { one, two, three } foo = one) // { dg-error "" }
;
struct B { operator int () { return 2; } };
if (struct B * foo = new B)
;
- if (int f () = 1) // ERROR -
+ if (int f () = 1) // { dg-error "" }
;
- if (int a[2] = {1, 2}) // ERROR -
+ if (int a[2] = {1, 2}) // { dg-error "" }
;
}
+// { dg-do run }
// Positive testcase for decls in conditions.
extern "C" int printf(const char *, ...);
+// { dg-do assemble }
// PRMS id: 5629
-// Build don't link:
struct String { const char *x; };
class Pathname: public String { };
+// { dg-do run }
// Bug: a ends up in the text segment, so trying to initialize it causes
// a seg fault.
+// { dg-do run }
// Example of static member constants
extern "C" int printf (const char *, ...);
+// { dg-do run }
// Bug: bar isn't emitted, which causes havoc.
extern int i;
+// { dg-do assemble }
// PRMS Id: 8927
// Bug: complex inheritance interferes with const checking
void Child::DoX() const
{
- A = 10; // ERROR - assignment to const
+ A = 10; // { dg-error "" } assignment to const
}
+// { dg-do assemble }
// PRMS Id: 3988
// Bug: DECL_CONTEXT of A::B gets clobbered in pushdecl when defining A::foo().
-// Build don't link:
#pragma implementation "context.h"
#line 1 "context.h"
+// { dg-do assemble }
// Bug: g++ doesn't find the conversion path from DPtr& to B*.
-// Build don't link:
class B {};
class D : public B {};
+// { dg-do assemble }
// PRMS Id: 9019
// Bug: g++ doesn't find conversion to const char *.
-// Build don't link:
struct String {
String ();
+// { dg-do assemble }
// PRMS Id: 8805
// Bug: The two-level conversion is not found when calling a global fn.
class Something {
public:
- void DoSomething(Ding A); // ERROR - referred to
+ void DoSomething(Ding A); // { dg-error "" } referred to
};
void DoSomething(Ding A);
void foo(Something* pX)
{
- DoSomething(1); // ERROR -
- pX->DoSomething(1); // ERROR -
- (*pX).DoSomething(1); // ERROR -
+ DoSomething(1); // { dg-error "" }
+ pX->DoSomething(1); // { dg-error "" }
+ (*pX).DoSomething(1); // { dg-error "" }
}
+// { dg-do assemble }
// PRMS Id: 3069
-void f(int&); // ERROR - referenced by error below
+void f(int&); // { dg-error "" } referenced by error below
void g(const int& i) {
- f(i); // ERROR - discarding const
+ f(i); // { dg-error "" } discarding const
}
+// { dg-do assemble }
void qsort (void *, int, int, int (*)(const void *, const void *));
int f (char *, char *);
void g ()
{
typedef int (*pf)(void *, void *);
- qsort(0, 0, 0, pf(f)); // ERROR - adding const to function parms
+ qsort(0, 0, 0, pf(f)); // { dg-error "" } adding const to function parms
}
-// Build don't link:
+// { dg-do assemble }
struct A {
A (int);
};
{
B b;
f ((A) b);
- f (A (b)); // gets bogus error - functional cast treated differently from C style
+ f (A (b)); // { dg-bogus "" } functional cast treated differently from C style
}
-// Build don't link:
+// { dg-do assemble }
struct A { };
struct B: public A {
A a;
- operator A () { return a; } // WARNING - never used implicitly
+ operator A () { return a; } // { dg-warning "" } never used implicitly
};
void f (const A&);
void g()
{
B b;
- (A) b; // gets bogus error - trying both constructor and type conversion operator
+ (A) b; // { dg-bogus "" } trying both constructor and type conversion operator
}
+// { dg-do run }
// PRMS Id: g++/6034
extern "C" int printf (const char *, ...);
+// { dg-do run }
// Bug: g++ tries to look inside (B*)0 for a virtual base pointer.
struct A
+// { dg-do run }
// PRMS id: 8279
int main ()
+// { dg-do run }
// PRMS Id: 8475
class SomeClass {
+// { dg-do assemble }
// Bug: g++ dies on this input.
-// Build don't link:
class Sample
{
+// { dg-do assemble }
// PRMS Id: 5155
struct A {
enum foo { bar };
};
-typedef A::foo A::foo; // ERROR - causes compiler segfault
+typedef A::foo A::foo; // { dg-error "" } causes compiler segfault
+// { dg-do assemble }
// Bug: g++ crashes on this input.
-// Build don't link:
struct A {
const char *p;
+// { dg-do assemble }
// Bug: g++ dies instead of flagging this invalid.
-// Build don't link:
inline float max(float x, float y) { return (x>y)?x:y; }
float b(float x, float y, float z)
{
- float f = (y<x)?x:(max<y)?z:y; // ERROR -
+ float f = (y<x)?x:(max<y)?z:y; // { dg-error "" }
return f;
}
+// { dg-do assemble }
// Bug: g++ tries to generate initialization semantics for a Node from an int,
// and fails.
-// Build don't link:
struct Node
-{ // ERROR -
+{ // { dg-error "" }
Node* child[2];
};
void bug(int i)
{
- Node* q = new Node(i); // ERROR -
+ Node* q = new Node(i); // { dg-error "" }
}
+// { dg-do assemble }
// PRMS Id: 4346
// Bug: g++ dies on redefinition of cc_Array::repInvariant.
-// Build don't link:
class ccObjectInfo
{
template <class T>
const ccObjectInfo& cc_Array<T>::repInvariant(int) const
-{ return *this /* *this is required here */; } // ERROR - redefined
+{ return *this /* *this is required here */; } // { dg-error "" } redefined
template <class T>
class ccArray :public ccObjectInfo
template <class T>
const ccObjectInfo& cc_Array<T>::repInvariant(int) const
-{ return 0; } // ERROR - causes compiler segfault
+{ return 0; } // { dg-error "" } causes compiler segfault
typedef ccObjArray< double> ccROIRuns;
+// { dg-do assemble }
// Bug: g++ doesn't deal well with abstract declarators used inappropriately.
-// Build don't link:
-void (*)(); // ERROR -
+void (*)(); // { dg-error "" }
+// { dg-do assemble }
// Bug: g++ dies on the below.
-// Build don't link:
class A { };
void f ()
{
A a;
- a.~a(); // ERROR - causes segfault
+ a.~a(); // { dg-error "" } causes segfault
}
+// { dg-do assemble }
// Bug: g++ can't deal.
-typedef unsigned size_t; // ERROR - previous declaration
-typedef unsigned long size_t; // ERROR - redefining size_t
+typedef unsigned size_t; // { dg-error "" } previous declaration
+typedef unsigned long size_t; // { dg-error "" } redefining size_t
void f (size_t); // causes compiler segfault -
+// { dg-do assemble }
struct A {
A();
- A(A); // ERROR - copy ctor must take reference
+ A(A); // { dg-error "" } copy ctor must take reference
};
int main()
{
+// { dg-do assemble }
// PRMS Id: 5085
// Bug: TYPE_POINTER_TO wasn't set.
-// Build don't link:
class A {
A(const A &);
+// { dg-do run }
// PRMS Id: 5584
extern "C"
+// { dg-do assemble }
// Bug: the reference to c in the initializer list doesn't get fixed up.
-// Build don't link:
struct AP {
AP(unsigned char);
+// { dg-do assemble }
// PRMS Id: 7162
-// Build don't link:
struct B {
int i;
+// { dg-do run }
struct A { virtual void f() { } };
struct B { virtual void g() { } };
struct C : public A, public B { };
+// { dg-do run }
// Testcase for tricky dynamic cast situations.
struct A {
+// { dg-do assemble }
// PRMS Id: 5204
// Bug: g++ bashes the type of add_sym with the type of add, so calling it
// with one parameter generates an error.
-// Build don't link:
int add(int const &symbol,
- const unsigned char flags=(void*)0); // ERROR - invalid default arg
+ const unsigned char flags=(void*)0); // { dg-error "" } invalid default arg
int add_sym(int const &symbol,
const unsigned char flags=0);
+// { dg-do assemble }
// PRMS Id: 5921
-// Build don't link:
// Bug: default arguments containing constructor calls persist incorrectly.
class foo
+// { dg-do assemble }
// Bug: type_list_equal aborts when it sees lang-specific tree nodes.
-// Build don't link:
struct A { };
void f (A a = A());
+// { dg-do run }
// Bug: g++ doesn't generate default constructor.
class A {
+// { dg-do assemble }
#include <stddef.h>
struct A {
- virtual void operator delete (void *); // ERROR - virtual delete
- virtual void * operator new (size_t); // ERROR - virtual new
+ virtual void operator delete (void *); // { dg-error "" } virtual delete
+ virtual void * operator new (size_t); // { dg-error "" } virtual new
};
+// { dg-do assemble }
// PRMS Id: 5003
// Bug: g++ complains about calling the destructor for a const object.
-// Build don't link:
struct A {
public:
void bar()
{
A n;
- n = foo(); // gets bogus error - deleting const
+ n = foo(); // { dg-bogus "" } deleting const
}
+// { dg-do assemble }
// PRMS Id: 6093
class A {
A();
~A();
protected:
- void operator delete(void *); // ERROR - protected
+ void operator delete(void *); // { dg-error "" } protected
};
A::~A()
void foo(A *p)
{
- delete p; // ERROR - in this context
+ delete p; // { dg-error "" } in this context
}
+// { dg-do assemble }
// Exhaustive test for destructors of simple types.
// PRMS Id: 2744, 3308
-// Build don't link:
template <class T> class A {
T q;
+// { dg-do assemble }
// PRMS Id: 4342
// Bug: g++ does not massage things enough to allow calling ~X().
-// Build don't link:
struct X
{
{};
struct Z : public Y, public X
-{}; // WARNING -
+{}; // { dg-warning "" }
void foo ()
{
Z* f = new Z;
- delete f; // gets bogus error -
+ delete f; // { dg-bogus "" }
}
-// Special g++ Options: -w
+// { dg-do assemble }
+// { dg-options "-w" }
// PRMS Id: 4342 (second testcase)
// Bug: g++ still can't deal with ambiguous inheritance in destructor calls.
-// Build don't link:
struct ccUnwind
{
+// { dg-do assemble }
// PRMS Id: 4342
// Bug: g++ fails to massage ambiguity in calling virtual destructor.
-// Build don't link:
class A { public: virtual ~A();};
class B: public A { };
+// { dg-do assemble }
// PRMS Id: 4143
// Bug: Pointer is silently dereferenced in method call.
-// Build don't link:
extern "C" int printf (const char *, ...);
{
Test *p = new Test('x');
- p.Print(); // ERROR -
+ p.Print(); // { dg-error "" }
}
+// { dg-do assemble }
struct A {
~A();
};
int main()
{
A a;
- a.~B(); // ERROR - wrong name
+ a.~B(); // { dg-error "" } wrong name
}
+// { dg-do run }
// PRMS Id: 5163
// Bug: g++ doesn't accept the explicit destructor call syntax for templates.
int main()
{
- a.~A(); // gets bogus error
+ a.~A(); // { dg-bogus "" }
}
+// { dg-do assemble }
// PRMS Id: 5341
// Bug: g++ complains about the explicit destructor notation.
-// Build don't link:
#include <stddef.h>
+// { dg-do assemble }
// PRMS Id: 5420
// Bug: g++ gets mixed up calling destructors for references.
-// Build don't link:
template<class X>
class Z {
+// { dg-do run }
// PRMS Id: 5286
// Bug: g++ forgets side-effects of object in call to nonexistent destructor.
+// { dg-do assemble }
// PRMS Id: 4337
// Bug: Enums are not looked up to arbitrary depth.
-// Build don't link:
struct W {
enum A { B };
struct S
{
X::A a1;
- Y::A a2; // gets bogus error -
+ Y::A a2; // { dg-bogus "" }
};
-// Build don't link:
+// { dg-do assemble }
enum tristate { no = -1, maybe, yes };
void foobar ()
{
- tristate var = no; // gets bogus error
+ tristate var = no; // { dg-bogus "" }
}
-// Build don't link:
-// Special g++ Options: -Wall
+// { dg-do assemble }
+// { dg-options "-Wall" }
enum tristate { no = -1, maybe, yes };
-// Build don't link:
-// Special g++ Options: -Wall
+// { dg-do assemble }
+// { dg-options "-Wall" }
enum tristate { no = -1, maybe, yes };
+// { dg-do run }
enum { a = 1 };
int main(void)
-// Special g++ Options: -fshort-enums
+// { dg-do run }
+// { dg-options "-fshort-enums" }
#include <limits.h>
+// { dg-do assemble }
// Yet Another testcase for signed/unsigned enums.
-// Build don't link:
enum A { AA = 0, AB = 1};
enum B { BA = -1, BB = 1};
void
foo()
{
- set(AA); // gets bogus error - why is this ambiguous
+ set(AA); // { dg-bogus "" } why is this ambiguous
set(BA); // when this is not amibguous
}
+// { dg-do run }
// Bug: the switch fails on the Alpha because folding ef - 1 fails.
enum foo { one=1, thirty=30 };
+// { dg-do assemble }
// Testcase for explicit instantiation of templates.
-// Build don't link:
template <class T>
class A {
+// { dg-do assemble }
// Bug: g++ doesn't figure out what to do.
-// Build don't link:
struct A {
operator char *();
char foo(A a)
{
- char c = a[0]; // gets bogus error
+ char c = a[0]; // { dg-bogus "" }
return c;
}
+// { dg-do run }
// Bug: g++ doesn't keep track of the lexical context of friends properly.
extern "C" void exit(int);
+// { dg-do assemble }
// PRMS Id: 5189
// Bug: g++ fails to collapse the several declarations of freefoo, so it isn't
// recognized as a friend.
-// Build don't link:
extern "C"
void freefoo(void);
+// { dg-do run }
// PRMS Id: 3744
// Bug: unswitching a COND_EXPR initializer fails to set SIDE_EFFECTS on the
// result, so expand_expr ignores it.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates default-arguments
template <class I>
class Class {
+// { dg-do assemble }
// The reference parameter to fred isn't dereferenced properly.
-// Build don't link:
class Gump {};
Gump operator & (const Gump x){return x;}
-// Build don't link:
+// { dg-do assemble }
struct A {
int foo(A a) { return a.bar(); }
+// { dg-do assemble }
// Bug: g++ uses an empty initializer list for its own devious purpose
// internally, and gets confused if it shows up in the input.
-// Build don't link:
struct A { int i; };
+// { dg-do run }
// PRMS Id: 5126
extern int i, j;
+// { dg-do run }
// PRMS Id: 5652
// Bug: strings does not get initialized.
+// { dg-do assemble }
struct A { int i; };
-A a = {{{1}}}; // ERROR - causes abort
+A a = {{{1}}}; // { dg-error "" } causes abort
+// { dg-do run }
// PRMS Id: 4341
// Bug: Instantiating a template in the middle of processing the functions
// from another template screws up lineno/input_filename.
+// { dg-do assemble }
+// { dg-options "-O" }
// Bug: the lang-specific bits of the decl for g aren't being copied when
// inlining.
-// Special g++ Options: -O
-// Build don't link:
inline void f () {
void g ();
+// { dg-do run }
+// { dg-options "-O2" }
// Testcase for order of destruction.
-// Special g++ Options: -O2
extern "C" int printf (const char *, ...);
int c;
+// { dg-do assemble }
// PRMS Id: 6036
extern int a;
int main() {
switch (a) {
case 1:
- int v2 = 3; // ERROR - referenced below
- case 2: // ERROR - jumping past initializer
+ int v2 = 3; // { dg-error "" } referenced below
+ case 2: // { dg-error "" } jumping past initializer
if (v2 == 7)
;
}
+// { dg-do run }
int main()
{
char c = '\351';
+// { dg-do assemble }
// Bug; g++ binds a function definition to the line number of a later decl.
-// Build don't link:
-void foo () { } // ERROR - redeclared
-void foo (); // gets bogus error - invalid binding
-void foo () { } // ERROR - redeclared
+void foo () { } // { dg-error "" } redeclared
+void foo (); // { dg-bogus "" } invalid binding
+void foo () { } // { dg-error "" } redeclared
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// GROUPS passed error-reporting
-// Special g++ Options:
// Bug: # line directive gets ignored immediately after text.
template <class T> class A
{
main()
{
- undef1(); // ERROR - , LINE 204
+ undef1(); // { dg-error "" "" { target *-*-* } 204 }
}
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
// GROUPS passed error-reporting
// potential bug: # line directive does not get reproduced in template
// expansion
{
public:
# 200 "lineno3.C"
- int foo () { undef1(); } // ERROR - , LINE 200
+ int foo () { undef1(); } // { dg-error "" "" { target *-*-* } 200 }
};
template class A<int>;
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
// GROUPS passed error-reporting
// Bug: # line directive in template definition interferes with growing obstack
template <class T> class A
public:
# 200 "lineno4.C"
- int foo () { undef1(); } // ERROR - , LINE 200
+ int foo () { undef1(); } // { dg-error "" "" { target *-*-* } 200 }
};
template class A<int>;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed error-reporting
// Bug: incomplete instantiation messes with lineno
template <class T> class A;
int main()
{
A<int> *p;
- undef1();// ERROR -
+ undef1();// { dg-error "" }
}
+// { dg-do assemble }
// General testcase for local classes.
int x;
void f ()
{
static int s;
- int x; // ERROR - referenced below
+ int x; // { dg-error "" } referenced below
extern int q();
struct local {
- int g() { return x; } // ERROR - automatic variable
- int h() { return s; } // gets bogus error - local class
+ int g() { return x; } // { dg-error "" } automatic variable
+ int h() { return s; } // { dg-bogus "" } local class
int k() { return ::x; } // OK
int l() { return q(); } // OK
int m(); // OK - not defined
- static int foo; // ERROR - static data member of local class
+ static int foo; // { dg-error "" } static data member of local class
};
}
-local* p = 0; // ERROR - no such type in scope
+local* p = 0; // { dg-error "" } no such type in scope
+// { dg-do assemble }
// PRMS Id: 4357
// Bug: g++ forgets to clear out push/popclass cache stuff when instantiating
// templates.
-// Build don't link:
template <class T> class ccHandle { };
-// Build don't link:
+// { dg-do assemble }
struct A {
struct B {
void g ()
{
A::B b;
- f (b); // gets bogus error - can't find nested constructor
+ f (b); // { dg-bogus "" } can't find nested constructor
}
+// { dg-do assemble }
// [class.ambig]: A single function, object, type, or enumerator may be
// reached through more than one path through the DAG of base classes. This
// is not an ambiguity.
-// Build don't link:
struct A {
typedef long T;
struct C : public A { };
struct D : public C , public B {
- void f (T&); // gets bogus error - ambiguous lookup
+ void f (T&); // { dg-bogus "" } ambiguous lookup
};
+// { dg-do assemble }
// Bug: g++ can't deal with multi-language overloading.
-// Build don't link:
extern void foo (int, int);
extern "C" void foo (int);
+// { dg-do assemble }
// PRMS Id: 2010
// Bug: g++ doesn't deal with overloads involving C-language fns properly.
-// Build don't link:
extern "C" double pow (double, double);
inline double pow (double d, int e) { return pow (d, (double) e); }
+// { dg-do assemble }
// Bug: g++ dies on this input.
-// Build don't link:
inline char abs (char x) { return 0; }
+// { dg-do assemble }
// Bug: Scoped method calls don't propagate the constness of `this'.
// PRMS Id: 4181 (second testcase)
-// Build don't link:
class D;
+// { dg-do assemble }
// PRMS Id: 4892
// Bug: COND_EXPRs, MODIFY_EXPRs and COMPOUND_EXPRs aren't properly recognized
// as lvalues.
-// Build don't link:
extern int foo;
int& f (int& a, int& b)
{
- return (foo ? a : b); // gets bogus error -
+ return (foo ? a : b); // { dg-bogus "" }
}
int& g (int& a)
{
- return (a = 0); // gets bogus error -
+ return (a = 0); // { dg-bogus "" }
}
int& h (int& a, int& b)
{
- return (a = 1, b); // gets bogus error -
+ return (a = 1, b); // { dg-bogus "" }
}
+// { dg-do assemble }
// Bug: C++ semantics for assignment don't match the backend semantics for
// MODIFY_EXPR.
-// Build don't link:
void
foo (int j)
+// { dg-do run }
int main() {
int i = 2;
int *pi = &(++i);
+// { dg-do assemble }
// Bug: numeric_outputed_need_bar is not cleared properly, adding random '_'s
// to mangled names.
-// Build don't link:
template <int seed_length>
class rand1
+// { dg-do assemble }
// I guess this was broken once.
-// Build don't link:
template <class C, int D> class X { };
typedef X<int, 0> T;
+// { dg-do run }
// PRMS Id: 7563
// Bug: declaration at function scope causes mismangling.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed member-pointers error-reporting
struct Y
{
struct X
{
int A;
- int Y::X::* foo () { undef1(1); return &Y::X::A; }// ERROR - foo().*
+ int Y::X::* foo () { undef1(1); return &Y::X::A; }// { dg-error "" } foo().*
int bar () { return A; }
};
};
int Y::X::* foo ()
{
- undef2(1);// ERROR - foo().*
+ undef2(1);// { dg-error "" } foo().*
return &Y::X::A;
}
int Y::X::* (* foo2 ())()
{
- undef3(1);// ERROR - foo().*
+ undef3(1);// { dg-error "" } foo().*
return foo;
}
int (Y::X::* bar2 ()) ()
{
- undef4(1);// ERROR - foo\(\).*
- return Y::X::bar;// ERROR - foo\(\).*
+ undef4(1);// { dg-error "" } foo\(\).*
+ return Y::X::bar;// { dg-error "" } foo\(\).*
}
int Y::X::* (Y::X::* foo3 ())()
{
- undef5(1);// ERROR - foo().*
- return Y::X::foo;// ERROR - foo().*
+ undef5(1);// { dg-error "" } foo().*
+ return Y::X::foo;// { dg-error "" } foo().*
}
+// { dg-do assemble }
// Bug: pointer to pointer is treated as plain pointer.
// PRMS Id: 1767
-// Build don't link:
class Foo {
public:
};
void func(Foo ** ppFoo) {
- ppFoo->method(); // ERROR -
+ ppFoo->method(); // { dg-error "" }
}
+// { dg-do run }
int status;
struct A { virtual void foo () { status = 1; } };
+// { dg-do run }
struct X
{
X () { }
+// { dg-do assemble }
// Bug: g++ can't deal with function-local classes that talk about themselves.
-// Build don't link:
void foo() {
class Wrapper {
public:
void F (void * Wrapperptr)
{
- Wrapper * wrapptr = ( Wrapper *) Wrapperptr; // gets bogus error
+ Wrapper * wrapptr = ( Wrapper *) Wrapperptr; // { dg-bogus "" }
}
};
}
+// { dg-do assemble }
// PRMS Id: 3764 (c/h)
// Bug: g++ gets into an infinite loop trying to find the top-level context
-// Build don't link:
class Menu;
class MenuItem;
+// { dg-do assemble }
// From: quipu@ulrik.uio.no
// Subject: extern "C" nested class
// Date: Fri, 13 Aug 1993 15:33:53 +0200
-// Build don't link:
extern "C" {
struct A {
foo () {
A a;
struct A::B *b;
- b = a.x; // gets bogus error - type `B' is not a base type for type `B'
+ b = a.x; // { dg-bogus "" } type `B' is not a base type for type `B'
}
-// Build don't link:
+// { dg-do assemble }
struct A {
struct B { };
struct C : public A {
struct D
- : public B // gets bogus error - can't find B
+ : public B // { dg-bogus "" } can't find B
{ };
};
-// Build don't link:
+// { dg-do assemble }
union A {
struct B { };
- A::B b; // gets bogus error
+ A::B b; // { dg-bogus "" }
};
+// { dg-do assemble }
// Testcase for defining nested types separately.
-// Build don't link:
class remote
{
-// Build don't link:
+// { dg-do assemble }
struct A { };
struct B: public A {
struct C {
-friend struct B; // gets bogus error - base clause w/o members
+friend struct B; // { dg-bogus "" } base clause w/o members
};
};
+// { dg-do assemble }
// Bug: g++ doesn't instantiate function templates in instantiate_type.
-// Build don't link:
template <class T> void fn (T t) { }
template <class T> struct A {
+// { dg-do run }
// Test of various ?: problems.
class D
+// { dg-do assemble }
// Bug: new doesn't make sure that the count is an integral value.
#include <new>
float f = 3;
int* b1 = new int[(int)f];
- int* b2 = new int[f]; // ERROR - new requires integral size
+ int* b2 = new int[f]; // { dg-error "" } new requires integral size
return s;
}
+// { dg-do run }
+// { dg-options "-Wno-deprecated -fno-exceptions" }
// PRMS Id: 6267
-// Special g++ Options: -Wno-deprecated -fno-exceptions
struct A {
int i;
+// { dg-do run }
+// { dg-options "-fcheck-new -pedantic" }
// PRMS Id: 6037
-// Special g++ Options: -fcheck-new -pedantic
extern "C" void * malloc (__SIZE_TYPE__);
-// Special g++ Options: -fcheck-new
+// { dg-do run }
+// { dg-options "-fcheck-new" }
struct A {
A(): i(42) { }
+// { dg-do run }
int main ()
{
const int *p = new const int (0);
+// { dg-do assemble }
// PRMS Id: 5070 (testcase 1)
-// Build don't link:
struct foo {
foo(int x = 0) {};
int xx::IsOk(int X)
{
- return ((xx::a).IsAlive()); // gets bogus error
+ return ((xx::a).IsAlive()); // { dg-bogus "" }
}
+// { dg-do run }
// PRMS Id: 5070 (testcase 2)
int status = 1;
+// { dg-do assemble }
// PRMS Id: 5070 (bug 2)
-// Build don't link:
struct A {
void f ();
};
void C::g() {
- B::p->f(); // gets bogus error
+ B::p->f(); // { dg-bogus "" }
}
+// { dg-do assemble }
// Bug: g++ complains about the use of A::p below.
-// Build don't link:
struct A {
void *p;
+// { dg-do run }
// PRMS Id: 4297 (related to 3525)
// Bug: Generating default op= didn't set TYPE_HAS_ASSIGNMENT, so it wasn't
// found.
+// { dg-do assemble }
// Bug: default operator= is not being generated properly.
// PRMS Id: 3525
-// Build don't link:
struct ccUnwind
{
void foo ()
{
ccEllipse e;
- e = ccEllipseUnit(); // gets bogus error - assignment not defined
+ e = ccEllipseUnit(); // { dg-bogus "" } assignment not defined
}
+// { dg-do assemble }
// Bug: g++ generates code for assignment in invalid situations.
-// Build don't link:
class X {
int& a;
{
int one=1, two=2;
X a(one), b(two);
- a = b; // ERROR - no assignment semantics defined
+ a = b; // { dg-error "" } no assignment semantics defined
}
+// { dg-do assemble }
// PRMS Id: 4329
// Bug: default op= gives an warning about casting away volatile.
-// Build don't link:
struct foo
{
+// { dg-do run }
// Testcase for tricky synthesized op= in complex inheritance situation.
// This used to test whether the virtual base was copy-assigned only once.
// That feature is not required by ISO C++, so the test now only checks
+// { dg-do assemble }
// Testcase for wrongful generation of operator =.
-// Build don't link:
class ivResource {
public:
+// { dg-do assemble }
+// { dg-options "" }
// General test for operator overloading permissiveness.
-// Build don't link:
-// Special g++ Options:
typedef __SIZE_TYPE__ size_t;
struct A {
- int operator?:(int a, int b); // WARNING -
- static int operator()(int a); // ERROR - must be nonstatic
- static int operator+(A,A); // ERROR - must be nonstatic
- int operator+(int a, int b = 1); // ERROR - two errors on this line
- int operator++(char); // ERROR - must take 'int'
+ int operator?:(int a, int b); // { dg-warning "" }
+ static int operator()(int a); // { dg-error "" } must be nonstatic
+ static int operator+(A,A); // { dg-error "" } must be nonstatic
+ int operator+(int a, int b = 1); // { dg-error "" } two errors on this line
+ int operator++(char); // { dg-error "" } must take 'int'
void operator delete (void *);
void operator delete (void *, unsigned long);
};
B * operator->();
};
-int operator-(int a, int b); // ERROR - no class argument
+int operator-(int a, int b); // { dg-error "" } no class argument
-void * operator new (A a); // ERROR - invalid first argument
-void operator delete (A a); // ERROR - ditto
+void * operator new (A a); // { dg-error "" } invalid first argument
+void operator delete (A a); // { dg-error "" } ditto
-char * operator char * (int); // ERROR - return value, nonmember
+char * operator char * (int); // { dg-error "" } return value, nonmember
+// { dg-do assemble }
// PRMS Id: 6018
-// Build don't link:
class string {
char *p;
+// { dg-do assemble }
// Bug: g++ prefers a non-matching operator== over user-defined conversions
// and a default operator==.
-// Build don't link:
struct A {
operator int ();
+// { dg-do assemble }
+// { dg-options "-O -pedantic-errors" }
// Bug: g++ claims that control can fall off the end of these functions.
// PRMS Id: 4943
-// Special g++ Options: -O -pedantic-errors
-// Build don't link:
struct A {
A();
{
A a[2];
return 1;
-} // gets bogus error - jump_optimize
+} // { dg-bogus "" } jump_optimize
int g ()
{
A a;
return 1;
-} // gets bogus error - jump_optimize
+} // { dg-bogus "" } jump_optimize
struct B {
B();
{
B b;
return 1;
-} // gets bogus error - jump_optimize
+} // { dg-bogus "" } jump_optimize
+// { dg-do run }
+// { dg-options "-w" }
// Used to crash on the alpha with optimization.
-// Special g++ Options: -w
extern "C" void abort (void);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed overloading
enum bar {};
-void operator+ (int, int);// ERROR - .*
+void operator+ (int, int);// { dg-error "" } .*
void operator+ (bar&, int);
template <class T> void operator+ (int b, T& t) { return b; }
+// { dg-do assemble }
// Bug: g++ thinks there is a conversion from void * to B *.
-// Build don't link:
struct A {
operator void* ();
struct B: public A { };
void bar (A& a) {
- B* bp = (B*)a; // ERROR -
+ B* bp = (B*)a; // { dg-error "" }
}
+// { dg-do run }
// PRMS Id: 4697
// Bug: g++ calls the non-const method for a const object.
+// { dg-do run }
// PRMS Id: 4066
// Bug: g++ doesn't notice the const on reference returns.
+// { dg-do run }
// Bug: g++ screws up derived->base conversions when calling a global function
// in the presence of matching members in the base. Whew.
+// { dg-do assemble }
// Bug: g++ fails to recognize that the template matches the target type.
-// Build don't link:
template <class T> void foo (T *, int);
+// { dg-do assemble }
// Bug: g++ thinks that int->long is a promotion.
-// Build don't link:
long f (long, long);
double f (double, double);
-void f (int); // ERROR -
-void f (long); // ERROR -
+// { dg-do assemble }
+void f (int); // { dg-error "" }
+void f (long); // { dg-error "" }
int main()
{
- f (1 & 0xffffff00UL); // ERROR - ambiguous
+ f (1 & 0xffffff00UL); // { dg-error "" } ambiguous
}
+// { dg-do assemble }
// Bug: g++ fails to prefer UDC's alone to UDC's plus standard conversions.
-// Build don't link:
struct B { };
struct D: public B { };
+// { dg-do assemble }
// pushdecl gets confused by this.
-// Build don't link:
void f ();
void f (int, int);
+// { dg-do run }
// PRMS Id: 4689
// Bug: g++ doesn't notice operators overloaded on enumeral types.
+// { dg-do assemble }
// Bug: foo and bar are considered to be overloaded (i.e. their
// IDENTIFIER_GLOBAL_VALUES are TREE_LISTs) even though they aren't,
// so ?: thinks it can't resolve the names.
-// Build don't link:
void foo ();
void bar ();
void baz ()
{
- void (*p)() = 1 ? foo : bar; // gets bogus error - wrongful overloading
+ void (*p)() = 1 ? foo : bar; // { dg-bogus "" } wrongful overloading
}
+// { dg-do assemble }
// Bug: this code causes an internal compiler error 4.
void f (char *);
void f (int);
struct A {
- void f (); // ERROR - candidate
- void f (int); // ERROR - candidate
+ void f (); // { dg-error "" } candidate
+ void f (int); // { dg-error "" } candidate
void g () {
- void (*p)(char *) = f; // ERROR - no matching function in scope
+ void (*p)(char *) = f; // { dg-error "" } no matching function in scope
}
};
+// { dg-do assemble }
struct X {
- void f (int = 4, char = 'r'); // ERROR -
- void g (int = 4, char = 'r'); // ERROR -
+ void f (int = 4, char = 'r'); // { dg-error "" }
+ void g (int = 4, char = 'r'); // { dg-error "" }
};
void
X::f (int i = 4, char x = 'r')
-{ } // ERROR - duplicate default args
+{ } // { dg-error "" } duplicate default args
void
X::g (int i = 9, char x = 's')
-{ } // ERROR - duplicate default args
+{ } // { dg-error "" } duplicate default args
+// { dg-do assemble }
// PRMS Id: 4574
// Bug: g++ prefers int to double for float& argument
-// Build don't link:
inline double abs (double x) { return x;}
inline int abs (int i) { return i; }
+// { dg-do assemble }
// From: panisset@cae.ca (Jean-Francois Panisset)
// Date: Mon, 6 Jun 94 13:39:25 EDT
// Subject: Problem with operator overloading
-// Build don't link:
class ostream {
public:
{
X x;
ostream os;
- os << x; // gets bogus error - converting to float
+ os << x; // { dg-bogus "" } converting to float
}
+// { dg-do assemble }
// PRMS Id: 5124
// Bug: g++ promotes bar to int* too soon and the call to f fails.
-// Build don't link:
typedef int arr[1];
+// { dg-do assemble }
// Bug: g++ tries to build up a mangled name for its ideal match, which
// fails for one call below.
-// Build don't link:
extern const char foo[];
extern const char baz[10];
void bing(const char *);
int main ()
{
- a->f(foo); // gets bogus error because foo's size unknown.
+ a->f(foo); // { dg-bogus "" } because foo's size unknown.
a->f(baz);
a->f(fred);
bing(fred);
+// { dg-do run }
void f(const int &) { }
void f(const float &);
int main()
{
- f(false); // gets bogus error
+ f(false); // { dg-bogus "" }
}
+// { dg-do assemble }
// PRMS Id: 6056
struct Foo {
- Foo() { } // ERROR - candidate
- Foo(int i = 25) { } // ERROR - candidate
+ Foo() { } // { dg-error "" } candidate
+ Foo(int i = 25) { } // { dg-error "" } candidate
};
int main()
{
- Foo* f1 = new Foo(); // ERROR - ambiguous
+ Foo* f1 = new Foo(); // { dg-error "" } ambiguous
}
+// { dg-do assemble }
// Bug: we get an error trying to build up our ideal candidate.
-// Build don't link:
class C {
public:
+// { dg-do assemble }
// Bug: bar is considered to be overloaded (i.e. its
// IDENTIFIER_GLOBAL_VALUES are TREE_LISTs) even though it isn't,
// so default_conversion thinks it can't resolve the name.
-// Build don't link:
void foo ();
void bar ();
+// { dg-do assemble }
// PRMS Id: 6412
-// Build don't link:
class Foo;
+// { dg-do assemble }
// PRMS Id: 6568
// Bug: g++ complains about the ambiguous conversion to bool even though
// we wouldn't end up using it anyway.
-// Build don't link:
class AString
{
+// { dg-do assemble }
// PRMS Id: 7128
-// Build don't link:
class B {};
+// { dg-do assemble }
// PRMS ID: 7507
-// Build don't link:
/* ------------------------------------------------------------ */
+// { dg-do assemble }
// PRMS ID: 8010
-// Build don't link:
class X {
int & flag;
+// { dg-do assemble }
// PRMS Id: 9647
-// Build don't link:
class castBug
{
{
castBug b;
castBug2 b2;
- voidfn(b); // gets bogus error
- voidfn(b2); // ERROR - discarding const
+ voidfn(b); // { dg-bogus "" }
+ voidfn(b2); // { dg-error "" } discarding const
}
+// { dg-do run }
// Test for subsequence checking in overload resolution.
class foo {
+// { dg-do assemble }
// Testcase for simple overloading resolution.
-// Build don't link:
void foo (int);
void foo (int, int);
+// { dg-do assemble }
// Testcase for simple overloading resolution.
-int foo (); // ERROR -
-void foo (); // ERROR - disallowed overload
+int foo (); // { dg-error "" }
+void foo (); // { dg-error "" } disallowed overload
+// { dg-do assemble }
// Bug: g++ thinks there is a default conversion from void* to B*.
// There isn't.
-// Build don't link:
struct A {
operator void* ();
void foo (B* bp);
void bar (A& a) {
- foo (a); // ERROR -
+ foo (a); // { dg-error "" }
}
+// { dg-do assemble }
// Bug: g++ thinks there is a default conversion from A& to B*.
// There isn't.
-// Build don't link:
struct A {
operator A* ();
void foo (B* bp);
void bar (A& a) {
- foo (a); // ERROR -
+ foo (a); // { dg-error "" }
}
+// { dg-do assemble }
// Bug: g++ fails to catch the ambiguity below.
-// Build don't link:
struct A {
operator int () { return 1; };
- operator int &() { return 1; }; // ERROR -
+ operator int &() { return 1; }; // { dg-error "" }
};
+// { dg-do assemble }
// PRMS Id: 4257
// Bug: g++ ignores non-member possibilities (ideal_candidate_ansi bug)
-// Build don't link:
class ostream
{
+// { dg-do assemble }
// Bug: g++ parses the declaration of r as a function declaration.
-// Build don't link:
void foo (int i)
{
int &r (i);
- r = 1; // gets bogus error -
+ r = 1; // { dg-bogus "" }
}
+// { dg-do run }
// Testcase for precedence of ?: wrt =
extern "C" int printf (const char *, ...);
+// { dg-do assemble }
// PRMS Id: 6825
-// Build don't link:
class aClass
{
- ; // ERROR - missing declaration
+ ; // { dg-error "" } missing declaration
private:
- ; // ERROR - missing declaration
+ ; // { dg-error "" } missing declaration
};
+// { dg-do run }
// PRMS Id: 6821
struct A {
struct B {
A* p;
- int f () { return (*p)(42); } // gets bogus error
+ int f () { return (*p)(42); } // { dg-bogus "" }
};
int main ()
-// Build don't link:
+// { dg-do assemble }
struct A {
struct B {};
struct C;
};
-struct A :: C : A :: B {}; // gets bogus error - parse error before `:'
+struct A :: C : A :: B {}; // { dg-bogus "" } parse error before `:'
+// { dg-do assemble }
// Bug: g++ decides that A::foo is introducing a constructor declarator.
-// Build don't link:
struct A {
typedef bool foo;
+// { dg-do assemble }
// Bug: g++ doesn't understand constructor syntax for pointers.
-// Build don't link:
void f () {
char * p (0);
+// { dg-do assemble }
// PRMS Id: 4484 (bug 2)
// Bug: g++ does not grok abstract declarator syntax for method pointers.
-// Build don't link:
template <class T> class A { };
-void (A<int>::*p)() = (void (A<int>::*)())0; // gets bogus error - abstract declarator failure
+void (A<int>::*p)() = (void (A<int>::*)())0; // { dg-bogus "" } abstract declarator failure
+// { dg-do assemble }
// Bug: g++ doesn't handle superfluous parentheses when redeclaring a TYPENAME.
-// Build don't link:
typedef int foo;
class A {
- typedef int ((foo)); // gets bogus error -
+ typedef int ((foo)); // { dg-bogus "" }
};
+// { dg-do assemble }
// Bug: foo (bar) should be a declaration of a static data member, not a
// function; it's getting caught by the rules for constructors.
-// Build don't link:
typedef int foo;
typedef int bar;
struct A {
- static foo (bar); // gets bogus error
+ static foo (bar); // { dg-bogus "" }
};
-int i = A::bar; // gets bogus error
-int (*fp)(bar) = A::foo; // ERROR -
+int i = A::bar; // { dg-bogus "" }
+int (*fp)(bar) = A::foo; // { dg-error "" }
+// { dg-do assemble }
// PRMS id: 4653
// Bug: g++ tries to resolve declarator/expression ambiguities too soon.
-// Build don't link:
template<class T> struct A { };
void f () {
- void (A<int>::*pmf) (); // gets bogus error - late binding
+ void (A<int>::*pmf) (); // { dg-bogus "" } late binding
}
+// { dg-do assemble }
// Bug: g++ tries to parse this as a constructor.
-// Build don't link:
typedef int foo;
struct A {
-// Build don't link:
-void foo(const int* const); // gets bogus error
+// { dg-do assemble }
+void foo(const int* const); // { dg-bogus "" }
+// { dg-do run }
// PRMS Id: 5720
// Bug: the extra set of parens confuses the expr/declarator disambiguation.
{
int * i = &argc;
- Fu((*i)).print(); // gets bogus error
+ Fu((*i)).print(); // { dg-bogus "" }
Fu((*j));
}
+// { dg-do assemble }
// Bug: g++ parses the declaration of 'char A::* foo' below as a
// declaration of 'char A'.
-// Build don't link:
class A { };
typedef int foo;
void f ()
{
char A::* foo;
- foo = 0; // gets bogus error - parsing blunder
+ foo = 0; // { dg-bogus "" } parsing blunder
}
+// { dg-do run }
template <class Called>
class aCallback
{
+// { dg-do run }
// Test that comparison of pointers to members does not complain about
// contravariance violation.
+// { dg-do assemble }
struct X {};
-X& X::*PTM_1; // ERROR - pointer to reference member
-void X::*PTM_2; // ERROR - pointer to void member
+X& X::*PTM_1; // { dg-error "" } pointer to reference member
+void X::*PTM_2; // { dg-error "" } pointer to void member
struct A {
static int& ir;
+// { dg-do assemble }
// PRMS Id: 4333
// Bug: g++ can't deal with casts to pointer to member function.
-// Build don't link:
class A { };
typedef void (A::* pmf)();
+// { dg-do assemble }
// PRMS Id: 4484 (bug 3)
// Bug: g++ does implicitly take the address of methods passed to fns.
-// Build don't link:
struct A {
void f ();
void g (void (A::*)());
void h () {
- g (A::f); // ERROR - failed conversion to method pointer
+ g (A::f); // { dg-error "" } failed conversion to method pointer
}
+// { dg-do assemble }
// From: enewton@uunet.uu.NET
// Subject: g++ 2.5.8: cannot cast member function pointers
// Date: 27 Jan 1994 01:22:56 -0500
-// Build don't link:
struct A {
void f(char);
+// { dg-do assemble }
// PRMS Id: 4484 (bug 5)
// Bug: g++ can't convert between pmf types.
-// Build don't link:
class A;
typedef void (A::*pmf)();
typedef void (A::*pmfc)() const;
-pmfc p = (pmfc)(pmf)0; // gets bogus error - pmf conversion
+pmfc p = (pmfc)(pmf)0; // { dg-bogus "" } pmf conversion
+// { dg-do assemble }
+// { dg-options "" }
// PRMS Id: 4985
-// Build don't link:
-// Special g++ Options:
struct Thing {
int OverloadFn() const;
static ThingEntry KeyWordTable[] = {
&Thing::FunctionA,
Thing::OverloadFn,
-}; // WARNING - implicit &
+}; // { dg-warning "" } implicit &
+// { dg-do assemble }
// PRMS Id: 5656
// Bug: g++ tries (which is a bug) and fails (which is a bug) to initialize
// var at runtime.
-// Build don't link:
struct A
{
+// { dg-do run }
// PRMS Id: 6486
// Make sure that no confused handling of COND_EXPRs and SAVE_EXPRs messes
// with the number of calls to foo.
+// { dg-do run }
// PRMS Id: 6905
class Parent {
+// { dg-do assemble }
// PRMS id: g++/13340
-// Build don't link:
class rectangle {
+// { dg-do assemble }
// PRMS Id: 4484 (bug 1)
// Bug: g++ does not support templates involving method pointers.
-// Build don't link:
struct A {
void f ();
};
template <class T> void
-f (void (T::*p)()) // gets bogus error - use of template parm as aggregate
+f (void (T::*p)()) // { dg-bogus "" } use of template parm as aggregate
{ }
void g ()
{
- f (&A::f); // gets bogus error - templates and method pointers
+ f (&A::f); // { dg-bogus "" } templates and method pointers
}
+// { dg-do assemble }
// Bug: g++ groups ->* before casts.
// PRMS Id: 4484 (bug 4)
-// Build don't link:
struct A { };
struct B : public A { void f (); };
A* ap = new B;
void (B::*p)() = &B::f;
- ((B*)ap->*p)(); // gets bogus error - incorrect precedence
+ ((B*)ap->*p)(); // { dg-bogus "" } incorrect precedence
}
+// { dg-do assemble }
class A
{
public:
A (const A& ccref);
- friend A const re (const A& v1); // ERROR -
+ friend A const re (const A& v1); // { dg-error "" }
};
A // const
re (const A& ref)
-{ // ERROR - mismatched decls
+{ // { dg-error "" } mismatched decls
return A (ref);
}
+// { dg-do assemble }
// Bug: g++ tries to call a constructor for a reference. Doh!
-// Build don't link:
class B;
struct A {
B & b;
- A (B & x) : b (x) { } // gets bogus error -
-}; // gets bogus error -
+ A (B & x) : b (x) { } // { dg-bogus "" }
+}; // { dg-bogus "" }
+// { dg-do run }
// Test that conversion from D* to B*& works properly.
extern "C" int printf (const char *, ...);
+// { dg-do run }
int main(int argc, char ** argv) {
int (&var_field_ref)[] = * (int (*)[]) new int [42];
int static_field[42];
- int *const &var_field_ptr_ref = var_field_ref; // gets bogus error
+ int *const &var_field_ptr_ref = var_field_ref; // { dg-bogus "" }
int *const &fix_field_ptr_ref = fix_field_ref;
int *const &static_field_ptr_ref = static_field;
- int * var_field_ptr = var_field_ref; // gets bogus error
+ int * var_field_ptr = var_field_ref; // { dg-bogus "" }
int * fix_field_ptr = fix_field_ref;
int * static_field_ptr = static_field;
+// { dg-do run }
void f (char *const &) { }
int main ()
{
+// { dg-do assemble }
// Bug: g++ can't deal with references to arrays.
-// Build don't link:
typedef float Matrix[4][4];
Matrix m;
+// { dg-do assemble }
// PRMS Id: ????
-// Build don't link:
void f (const int& i)
{
- &(int&)i; // gets bogus error - references ARE lvalues
+ &(int&)i; // { dg-bogus "" } references ARE lvalues
}
-// Build don't link:
+// { dg-do assemble }
void f ();
void (&fr)() = f;
-// Build don't link:
+// { dg-do assemble }
int i;
-int &const j = i; // ERROR - invalid const
-int &const f(); // ERROR - invalid const
+int &const j = i; // { dg-error "" } invalid const
+int &const f(); // { dg-error "" } invalid const
void g ()
{
j = 1;
+// { dg-do assemble }
const int &f();
-int &a = f(); // ERROR -
+int &a = f(); // { dg-error "" }
+// { dg-do run }
// Testcase for the lifetime of a temporary object which is used to
// initialize a reference.
+// { dg-do run }
// PRMS Id: 5184
// Bug: cast to C& below does not adjust address
+// { dg-do run }
// Bug: g++ re-evaluates the initializer for r before calling f(); since i has
// changed to an invalid index, this breaks.
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-Wreturn-type" }
// GROUPS passed error-reporting
-// Special g++ Options: -Wreturn-type
// DR 295 allows qualification via typedef
int foo (int a = (**bar) (s))
{
- return doowop<foo>::bar; // ERROR - not a member
+ return doowop<foo>::bar; // { dg-error "" } not a member
}
int foo2 (int (*a)(int) = &foo)
{
- undef4 (1); // ERROR - implicit declaration
+ undef4 (1); // { dg-error "" } implicit declaration
return 1;
}
class X{
- class Y{}; // ERROR - private
+ class Y{}; // { dg-error "" } private
};
typedef int const * bart ();
//The following is DR295 dependant
-typedef bart const * const * bar2; // ERROR - constifying qualifiers
-typedef bart volatile * const * bar2v; // ERROR - qualifiers
+typedef bart const * const * bar2; // { dg-error "" } constifying qualifiers
+typedef bart volatile * const * bar2v; // { dg-error "" } qualifiers
bar2 baz (X::Y y)
-{ // ERROR - in this context
- X::Y f; // ERROR - in this context
+{ // { dg-error "" } in this context
+ X::Y f; // { dg-error "" } in this context
bar2 wa [5];
wa[0] = baz(f);
- undef2 (1); // ERROR - implicit declaration
+ undef2 (1); // { dg-error "" } implicit declaration
}
int ninny ()
{
struct A
{
- static int ninny2 () { return badoo<'\001'>::foo; } // ERROR - not a member
+ static int ninny2 () { return badoo<'\001'>::foo; } // { dg-error "" } not a member
};
return A::ninny2();
int darg (char X::*p)
{
- undef3 (1); // ERROR - implicit declaration
+ undef3 (1); // { dg-error "" } implicit declaration
}
+// { dg-do run }
// PRMS Id: 5331
// Bug: the return value of foo is constructed in a temporary and then
// copied into the return slot. This is not necessary.
+// { dg-do run }
// PRMS Id: 5368
// Bug: the X temporary in foo() is not destroyed.
+// { dg-do run }
// PRMS id: 10912
struct A {
+// { dg-do assemble }
// Bug: g++ parses the declaration of i as a functional cast.
-// Build don't link:
void take_int (int arg) { }
+// { dg-do assemble }
// Bug: g++ doesn't notice the overflow in the enum values.
#include <limits.h>
{
red,
green = ULONG_MAX, blue
-}; // ERROR - enum overflow
+}; // { dg-error "" } enum overflow
-typedef int int; /* ERROR - trying to redefine int */
+// { dg-do assemble }
+typedef int int; /* { dg-error "" } trying to redefine int */
-int array[3] = { 1, 2, 3, 4 }; /* ERROR - excess initializer elements */
+// { dg-do assemble }
+int array[3] = { 1, 2, 3, 4 }; /* { dg-error "" } excess initializer elements */
+// { dg-do assemble }
// Bug: g++ does overloading on a function-by-function basis.
void
{
extern void g ();
}
- fp = g; /* ERROR - no 'g' in scope */
+ fp = g; /* { dg-error "" } no 'g' in scope */
}
+// { dg-do assemble }
void *vp;
int (*ap)[];
struct S *sp;
void
test ()
{
- vp++; /* ERROR - incrementing void * */
- ap++; /* ERROR - incrementing ptr to incomplete type */
- sp++; /* ERROR - incrementing ptr to incomplete type */
- up++; /* ERROR - incrementing ptr to incomplete type */
- fp++; /* ERROR - incrementing ptr to function */
+ vp++; /* { dg-error "" } incrementing void * */
+ ap++; /* { dg-error "" } incrementing ptr to incomplete type */
+ sp++; /* { dg-error "" } incrementing ptr to incomplete type */
+ up++; /* { dg-error "" } incrementing ptr to incomplete type */
+ fp++; /* { dg-error "" } incrementing ptr to function */
}
+// { dg-do assemble }
// Bug: g++ doesn't push parameter decls as they are parsed.
-// Build don't link:
-void (*ptr) (int foo, int array[sizeof(foo)]); // gets bogus error XFAIL *-*-*
-void test2 (int bar, int array[sizeof(bar)]) { } // gets bogus error XFAIL *-*-*
+void (*ptr) (int foo, int array[sizeof(foo)]); // { dg-bogus "" "" { xfail *-*-* } }
+void test2 (int bar, int array[sizeof(bar)]) { } // { dg-bogus "" "" { xfail *-*-* } }
+// { dg-do assemble }
// The default assignment operator for B uses array assignment, so we can't
// just disallow it...
test ()
{
b1 = b2; /* OK */
- a1 = a2; /* ERROR - array assignment */
+ a1 = a2; /* { dg-error "" } array assignment */
}
+// { dg-do assemble }
// Any expression may be explicitly converted to type void.
-// Build don't link:
struct S { int m[10]; } object;
struct S f () { return object; }
+// { dg-do assemble }
// Bug: g++ complains about a class definition containing a const member
// but no constructor; it shouldn't complain at that point, since this is
// valid use.
-// Build don't link:
struct S { const int member; } object = { 0 };
-// Build don't link:
+// { dg-do assemble }
typedef void func_type ();
func_type *fp;
void example ()
{
- vp != fp; // ERROR - no conversion from pfn to void*
+ vp != fp; // { dg-error "" } no conversion from pfn to void*
}
-char array0[4] = "abcde"; /* ERROR - initializer too long */
+// { dg-do assemble }
+char array0[4] = "abcde"; /* { dg-error "" } initializer too long */
-static void f (); // ERROR - used but not defined
+// { dg-do assemble }
+static void f (); // { dg-error "" } used but not defined
void g ()
{
- signed char *ptr2 = "hello"; /* ERROR - changing sign */
-unsigned char *ptr3 = "hello"; /* ERROR - changing sign */
+// { dg-do assemble }
+ signed char *ptr2 = "hello"; /* { dg-error "" } changing sign */
+unsigned char *ptr3 = "hello"; /* { dg-error "" } changing sign */
+// { dg-do assemble }
typedef int Int;
Int Int_object_1;
void test ()
{
- ((Int) Int_object_1) = Int_object_1; /* ERROR - not an lvalue*/
+ ((Int) Int_object_1) = Int_object_1; /* { dg-error "" } not an lvalue*/
}
-struct { int :0; }; /* ERROR - anon struct not used to declare objects */
+// { dg-do assemble }
+struct { int :0; }; /* { dg-error "" } anon struct not used to declare objects */
+// { dg-do assemble }
typedef void (FTYPE) ();
FTYPE f; /* ok */
void
test_0 ()
{
- (FTYPE) f; /* ERROR - casting to function type */
+ (FTYPE) f; /* { dg-error "" } casting to function type */
}
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// Don't compile this one with -Wno-long-long...
-// Special g++ Options: -pedantic-errors
-short volatile short var_0_2; /* ERROR - duplicate short */
-long volatile long var_0_3; /* ERROR - duplicate long */
-signed volatile signed var_0_7; /* ERROR - duplicate signed */
-unsigned volatile unsigned var_0_8; /* ERROR - duplicate unsigned */
+short volatile short var_0_2; /* { dg-error "" } duplicate short */
+long volatile long var_0_3; /* { dg-error "" } duplicate long */
+signed volatile signed var_0_7; /* { dg-error "" } duplicate signed */
+unsigned volatile unsigned var_0_8; /* { dg-error "" } duplicate unsigned */
+// { dg-do assemble }
/* From 01/25/94 working paper (7.1.3):
If, in a decl-specifier-seq containing the decl-specifier typedef,
qualifiers, the typedef declaration is ill-formed.
*/
-typedef foo; // ERROR - invalid typedef
-typedef const bar; // ERROR - invalid typedef
+typedef foo; // { dg-error "" } invalid typedef
+typedef const bar; // { dg-error "" } invalid typedef
+// { dg-do assemble }
// Bug: g++ remembers the members of OUTER and complains about the second
// definition.
-// Build don't link:
void
test ()
+// { dg-do assemble }
+// { dg-options "-ansi -pedantic-errors -w" }
// Bug: f1 and f2 are treated as overloaded when they aren't.
-// Build don't link:
-// Special g++ Options: -ansi -pedantic-errors -w
int i;
void f1(double) { }
void
test ()
{
- i ? f1 : f2; // gets bogus error - improper overloading
+ i ? f1 : f2; // { dg-bogus "" } improper overloading
}
+// { dg-do assemble }
+// { dg-options "-ansi -pedantic-errors -w" }
// Bug: func is treated as an overloaded function when it isn't.
-// Build don't link:
-// Special g++ Options: -ansi -pedantic-errors -w
int *func () { return 0; }
void
test ()
{
- *func; // gets bogus error - improper overloading
+ *func; // { dg-bogus "" } improper overloading
}
-// Build don't link:
+// { dg-do assemble }
wchar_t *single = L"xyz" ;
wchar_t *(array[]) = { L"xyz" };
+// { dg-do assemble }
// Bug: fixincludes and/or cpp mangle the definition of wchar_t so that this
// doesn't work.
-// Build don't link:
#include <stdlib.h>
-wchar_t array[] = L"xxx"; // gets bogus error - wchar_t
+wchar_t array[] = L"xxx"; // { dg-bogus "" } wchar_t
+// { dg-do assemble }
// Bug: g++ is wrongfully pedantic about union initializers.
-// Build don't link:
union U { int mbr; } array[1] = { 0 };
+// { dg-do assemble }
int cond;
int i;
int *ip;
void
test ()
{
- cond ? i : ip; /* ERROR - pointer/integer mismatch */
+ cond ? i : ip; /* { dg-error "" } pointer/integer mismatch */
}
+// { dg-do run }
// PRMS Id: 6000
// Bug: g++ gets confused trying to build up a reference to a cast.
+// { dg-do run }
// Test for undesired aliasing.
struct A {
+// { dg-do assemble }
int main ()
{
int i;
- int &ir = (int&)(int)i; // ERROR - casting rvalue to reference type
+ int &ir = (int&)(int)i; // { dg-error "" } casting rvalue to reference type
}
+// { dg-do assemble }
// PRMS Id: 3977
// Bug: A member function is not hidden properly by a later use of its name.
-// Build don't link:
struct A {
void index ();
+// { dg-do assemble }
// Test for scope-based hiding of functions.
void f (char *);
struct A {
- void f (); // ERROR - referred to
+ void f (); // { dg-error "" } referred to
};
struct B : public A {
void g (char *);
void h () {
- extern void g (); // ERROR -
- f("foo"); // ERROR - hidden
- g("foo"); // ERROR - hidden
+ extern void g (); // { dg-error "" }
+ f("foo"); // { dg-error "" } hidden
+ g("foo"); // { dg-error "" } hidden
}
};
-// Build don't link:
+// { dg-do assemble }
void f ();
void g ()
int f;
{
void f ();
- f (); // gets bogus error - trying to call integer
+ f (); // { dg-bogus "" } trying to call integer
}
}
-// Build don't link:
+// { dg-do assemble }
void f ()
{
struct A {
};
}
void h () {
- g (); // ERROR - no g in scope
+ g (); // { dg-error "" } no g in scope
}
-// Build don't link:
+// { dg-do assemble }
struct A { typedef int foo; };
struct B: public A {
typedef int bar;
struct C {
- void g (B::bar); // gets bogus error - nested type failure
+ void g (B::bar); // { dg-bogus "" } nested type failure
void f (B::foo);
};
};
+// { dg-do assemble }
// [class.scope0]: The scope of a name declared in a class consists
// ... also of all ... default arguments ... in that class ....
-// Build don't link:
struct A {
void f (int A::* = &A::i);
+// { dg-do assemble }
// Bug: g++ ignores the :: qualification and dies trying to treat an integer
// variable as a list of functions.
-// Build don't link:
class DComplex {
public:
+// { dg-do assemble }
struct A {
- int a(); // ERROR -
- int a; // ERROR -
+ int a(); // { dg-error "" }
+ int a; // { dg-error "" }
};
+// { dg-do run }
// Test that the integer hides the struct in block scope.
int main ()
+// { dg-do assemble }
// Bug: A function is not hidden properly by a use of its name in an
// inner scope.
-// Build don't link:
struct A
{
+// { dg-do assemble }
// Bug: g++ does not grok nested types very well.
-// Build don't link:
class A {
class B;
friend class B;
- class B { }; // gets bogus error -
+ class B { }; // { dg-bogus "" }
};
+// { dg-do assemble }
// PRMS Id: 4375
// Bug: g++ fails to keep track of nested typedefs properly.
-// Build don't link:
class A {
public:
B(Ptr a_ptr);
};
-A::A(Ptr string) { // gets bogus error -
- s = string; // gets bogus error -
+A::A(Ptr string) { // { dg-bogus "" }
+ s = string; // { dg-bogus "" }
}
int main() {
+// { dg-do assemble }
// Bug: g++ thinks that A defines operator delete, and tries to call it.
-// Build don't link:
struct A {
~A () { ::operator delete (0); }
+// { dg-do assemble }
// Testcase for all uses of explicit global scope.
-// Build don't link:
int a, B;
struct B {
struct C {
static int a;
- static int f () { A a; return ::operator+ (a, ::a); } // gets bogus error
+ static int f () { A a; return ::operator+ (a, ::a); } // { dg-bogus "" }
};
};
int B::C::a = 0;
-struct D : public ::B::C { }; // gets bogus error
+struct D : public ::B::C { }; // { dg-bogus "" }
void f ()
{
int B;
::B::C b;
- B = ::B::C::a; // gets bogus error
- B = ::B::C::f(); // gets bogus error
+ B = ::B::C::a; // { dg-bogus "" }
+ B = ::B::C::f(); // { dg-bogus "" }
}
+// { dg-do assemble }
// Bug: g++ doesn't flag name collisions between types and non-types as
// errors. It shouldn't for class names, but it should for typedefs.
-// Build don't link:
-int bar; // ERROR -
-typedef int bar; // ERROR -
+int bar; // { dg-error "" }
+typedef int bar; // { dg-error "" }
+// { dg-do assemble }
// Bug: g++ allows two different meanings of a name in the same scope.
-typedef int foo; // ERROR -
+typedef int foo; // { dg-error "" }
struct A {
A (foo);
- int foo (); // ERROR - foo already used in scope
+ int foo (); // { dg-error "" } foo already used in scope
};
+// { dg-do assemble }
// Bug: g++ silently mangles the second 'B' to 'A::B', so the definition is
// lost.
-// Build don't link:
struct A {
enum B { };
-// Special g++ Options: -Wshadow
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-Wshadow" }
class x {
public:
+// { dg-do assemble }
// Bug: dfs_pushdecls doesn't create an overload list for member functions,
// like it claims to.
-// Build don't link:
struct A
{
static int foo (int);
static int foo (int, int);
- void bar () { foo (1, 2); } // gets bogus error - broken overloading
+ void bar () { foo (1, 2); } // { dg-bogus "" } broken overloading
};
+// { dg-do assemble }
// Make sure that forward declarations of specializations work...
template <class T> class A { };
template <> class A<int>;
-A<int> a; // ERROR - incomplete type
+A<int> a; // { dg-error "" } incomplete type
template <> class A<int> { };
+// { dg-do run }
// PRMS id: 6863
extern "C" int printf(const char *, ...);
+// { dg-do assemble }
// Bug: the synthesized copy constructor for A is not found.
-// Build don't link:
struct A {
// A (const A& a): i(a.i) {}
struct B {
A a;
- B (const B& b): a(b.a), j(b.j) { } // gets bogus error -
+ B (const B& b): a(b.a), j(b.j) { } // { dg-bogus "" }
int j;
};
-// Special g++ Options: -O
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O" }
// Bug: Synthesizing methods for the nested class screwed up current_class_decl
// for the outer class.
+// { dg-do assemble }
// PRMS Id: 4623
// Bug: g++ tries and fails to synthesize a copy constructor for D.
-// Build don't link:
class A { };
class B: public virtual A { };
class C: public A { };
-class D: public B, public C { }; // gets bogus error - bad synthesis
+class D: public B, public C { }; // { dg-bogus "" } bad synthesis
+// { dg-do assemble }
// Testcase for wrongful generation of copy constructor.
-// Build don't link:
class A { };
class B: virtual private A { };
-class D: public B { }; // gets bogus error
+class D: public B { }; // { dg-bogus "" }
-// Build don't link:
+// { dg-do assemble }
struct X {
X();
void f()
{
Y *y1, *y2 ;
- *y1 = *y2; // gets bogus error - failed to synthesize op=
+ *y1 = *y2; // { dg-bogus "" } failed to synthesize op=
}
+// { dg-do run }
// Bug: generated B::operator= tries to call A::operator=
#pragma implementation
+// { dg-do assemble }
// Bug: g++ tries to generate an op= for DbmItem and fails.
-// Build don't link:
class RefCount{
public:
+// { dg-do run }
// Testcase to make sure that synthesized methods are found when needed.
struct B { ~B() { } };
+// { dg-do assemble }
// Bug: the synthesized constructor for A tries to use the mem-initializer
// list for the B constructor.
-// Build don't link:
struct A
{
+// { dg-do assemble }
// PRMS Id: 6837
// Bug: anonymous union confuses g++.
-// Build don't link:
struct my_key {
my_key(const my_key&);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates overloading
template<class T> class Vector { };
template<class T> struct Sort { static void sort (Vector<typename T::foo> &); };
+// { dg-do assemble }
// Bug: member initializers are allowed where they shouldn't be.
-// Build don't link:
template <class T>
struct A {
int i;
- Blarg () : i(0) { } // ERROR -
+ Blarg () : i(0) { } // { dg-error "" }
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates destructors
// Example of PR 3308 workaround
+// { dg-do link }
+// { dg-options "-g" }
// Bug: g++ fails to instantiate operator<<.
-// Build don't run:
-// Special g++ Options: -g
struct ostream {
ostream& operator<< (const char *) { return *this; };
+// { dg-do assemble }
// PRMS Id: 4688
// Bug: g++ can't deal with templates instantiated within extern "C".
-// Build don't link:
class Gnaf {
public:
+// { dg-do assemble }
// Bug: member operator shadows global template in tsubst.
-// Build don't link:
class ostream;
void X::print(ostream& os)
{
smanip<double> smd;
- os << smd; // gets bogus error
+ os << smd; // { dg-bogus "" }
}
+// { dg-do run }
// Bug: initializers for static data members of templates don't get run.
template <class T> struct A {
+// { dg-do assemble }
// Testcase for 'this is a type' syntax.
-// Build don't link:
struct B {
typedef int A;
+// { dg-do run }
// PRMS Id: 4745
// Bug: g++ gets the constructor and destructor confused because the default
// parm prevents the two constructor types from satisfying ==.
+// { dg-do run }
// PRMS Id: 2139
// Bug: g++ tries to instantiate the template with types on the function
// obstack and fails.
+// { dg-do run }
// PRMS Id: 1502
// Bug: g++ fails to resolve 'gnc' in the call to 'grid'.
+// { dg-do assemble }
// Caught by Booch Components.
// Bug: g++ tries to instantiate nested enums.
-// Build don't link:
template <class T> struct A
{
+// { dg-do link }
+// { dg-options "-g -fno-inline -Wno-deprecated -fexternal-templates" }
// GROUPS passed templates
// Bug: g++ emits template instances when it shouldn't.
-// Special g++ Options: -g -fno-inline -Wno-deprecated -fexternal-templates
-
-// We mark this XFAIL because we can't test for expected linker errors.
-// If we get an XPASS for this testcase, that's a bug.
-
// Suppressed-instantiation tests like this are known to break on
// Cygwin, because of the MULTIPLE_SYMBOL_SPACES stuff. This is OK.
-// (OK) excess errors test - XFAIL *-*-*
#pragma implementation "irrelevant_file"
#line 1 "template18.h"
main()
{
- min (1, 1); // should produce an undefined symbol error.
+ min (1, 1); // { dg-error "" "" { target *-*-* } 0 } should produce an undefined symbol error.
}
+// { dg-do run }
// 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; }
+// { dg-do assemble }
// Bug: instantiation of member templates breaks.
-// Build don't link:
template <class T> struct A {
static void f ();
+// { dg-do run }
// 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]) { }
+// { dg-do assemble }
// Gosh, this works!
-// Build don't link:
template<class T>
struct A
+// { dg-do assemble }
// Testcase for proper unification of code involving references.
-// Build don't link:
template<class T>
struct A
+// { dg-do assemble }
// Testcase for instantiation with cv-qualified type
-// Build don't link:
template<class T>
struct A
+// { dg-do run }
// Bug: g++ doesn't find the conversion from ostream_withassign to ostream.
#include <iostream>
+// { dg-do run }
// PRMS Id: 6393
// Bug: g++ is too lax in considering UPTs to be the same.
+// { dg-do run }
// PRMS Id: 6275
// Bug: unification fails for call to find_parameter_in_stack.
+// { dg-do run }
// PRMS Id: 6826
// Check that unnecessary templates are not instantiated.
+// { dg-do run }
// PRMS Id: 7179
template <class T>
+// { dg-do assemble }
// PRMS Id: 9500
-// Build don't link:
template <int S>
class base
+// { dg-do run }
// PRMS Id: 4679
// Bug: g++ doesn't re-instantiate templates after definition is seen.
int main()
{
if (a)
- a->t = 1; // gets bogus error
+ a->t = 1; // { dg-bogus "" }
}
+// { dg-do assemble }
template <class T, class U>
-int func(U, T); // ERROR - ref below
+int func(U, T); // { dg-error "" } ref below
template <class T, class U>
int func(T, U)
-{ // ERROR - ref below
+{ // { dg-error "" } ref below
return 2;
}
int main ()
{
- func (0, 1); // ERROR - ambiguous
+ func (0, 1); // { dg-error "" } ambiguous
}
+// { dg-do run }
// PRMS Id: 8569
#include <iostream>
+// { dg-do assemble }
// Bug: Instantiating A<int> screws with class bindings for B
-// Build don't link:
template <class T> struct A { };
struct B {
+// { dg-do assemble }
// Test nested enums in templates.
-// Build don't link:
template <class T>
class A
+// { dg-do run }
template<class T>
class Set {
public:
+// { dg-do assemble }
// Bug: instantiation of D() corrupts declaration of basis[].
-// Build don't link:
struct B { };
template <int t>
+// { dg-do run }
// Testcase for implicit 'typename' and resolution of 'typename's in the
// current scope.
+// { dg-do run }
+// { dg-options "-Wno-deprecated -fexternal-templates" }
+// { dg-warning "switch.*deprecated" "" { target *-*-* } 0 }
+
// PRMS Id: 9930
// Test of -fexternal-templates hackery in new template code
-// Special g++ options: -Wno-deprecated -fexternal-templates
#pragma implementation "foo.hh"
#pragma interface "foo.hh"
+// { dg-do assemble }
// PRMS Id: 10283
-// Build don't link:
template <class T> struct B {
static void (*p)();
+// { dg-do assemble }
// Bug: g++ tries to instantiate ccList twice, and fails.
-// Build don't link:
template<class T> class ccHandle{ };
template <class T> class ccList;
+// { dg-do run }
// PRMS id: 11315
// Bug: g++ doesn't recognize the copy ctor for Array<long>.
+// { dg-do run }
// PRMS Id: 11420
// Bug: Can't handle indirect virtual template base init.
+// { dg-do run }
// Testcase for not evaluating template default args if they are
// never used.
+// { dg-do run }
// Test matching of partial specializations.
template <int* x, int* y>
+// { dg-do run }
#include <stdlib.h>
#include <string.h>
+// { dg-do assemble }
// Bug: g++ fails to compare integer constants properly.
-// Build don't link:
template <int X, int Y>
struct Matrix {
+// { dg-do run }
// PRMS Id: 4656
// Testcase for use of member pointers in template resolution
}
int main()
{
- int A<int>::*pm = &A<int>::a; // gets bogus error - failed temp resolution
+ int A<int>::*pm = &A<int>::a; // { dg-bogus "" } failed temp resolution
foo (pm);
return 0;
}
+// { dg-do assemble }
// PRMS Id: 4826
-// Build don't link:
class A;
template <class T> void f(const T&, const T&);
void g (const A& a, A& b) {
- f (a, b); // gets bogus error - failed unification
+ f (a, b); // { dg-bogus "" } failed unification
}
+// { dg-do assemble }
// PRMS Id: 4827
-// Build don't link:
class A;
template <class T> int f (const T&, const A *);
int g (const int& a)
{
- return f (a, (A *)0); // gets bogus error - failed unification
+ return f (a, (A *)0); // { dg-bogus "" } failed unification
}
+// { dg-do assemble }
// PRMS Id: 4864
// Bug: g++ can't deal with a guiding declaration which comes before the
// template.
-// Build don't link:
void f (const int&, const int&);
template <class T> void f (const T&, const T&) { }
void g (int a)
{
- f (a,a); // gets bogus error - two identical candidates
+ f (a,a); // { dg-bogus "" } two identical candidates
}
+// { dg-do run }
// From: bruno@isoft.com.ar (Bruno R. Depascale)
// Subject: No destructor bug
// Date: Mon, 14 Feb 1994 12:49:45 -0300 (Arg)
+// { dg-do assemble }
class X // Indentation has been done so to see the similarities.
{
public:
- X() {} // ERROR - referenced below
- X(X& x) {x.i=7;} // ERROR - Both functions modify the
- void bar(X& x) {x.i=7;} // ERROR - reference parameter x.
+ X() {} // { dg-error "" } referenced below
+ X(X& x) {x.i=7;} // { dg-error "" } Both functions modify the
+ void bar(X& x) {x.i=7;} // { dg-error "" } reference parameter x.
int i;
};
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.
+ X x(foo()); // { dg-error "" } Compiler doesn't warn about temporary reference.
+ x.bar(foo()); // { dg-error "" } The same mistake is warned about in this case.
}
+// { dg-do run }
// Bug: the temporary returned from f is elided, causing a to be constructed
// twice but only destroyed once.
+// { dg-do run }
// Bug: g++ initializes both B::i and B::j before destroying any temps.
extern "C" int printf (const char *, ...);
+// { dg-do run }
// PRMS Id: 6604
// Bug: Scoped constructor call is not properly recognized as a functional cast
+// { dg-do assemble }
// Bug: the temporary from the default parameter to f2 is reused.
-// Build don't link:
struct A {};
int f2 (int i, const A& ar = A());
+// { dg-do run }
// PRMS ID: 7304
struct V {
+// { dg-do run }
// Test for proper handling of temporaries in ?: exprs.
extern "C" int printf (const char *, ...);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates overloading
#define TEMPL template <class T>
+// { dg-do assemble }
/*
PRMS Id: 3631
Bug is: g++ mangles template class names in a way that it won't accept,
and then tries to feed them to itself.
*/
-// Build don't link:
template<class T>
struct A {
template<class T>
struct B : A<T> {
B();
-}; // gets bogus error - B<C<char>>
+}; // { dg-bogus "" } B<C<char>>
template<class T>
struct C {
+// { dg-do assemble }
// Distillation of crash1.C problem (PR 3633)
-// Build don't link:
template<class P>
class A
+// { dg-do assemble }
// PRMS Id: 5190
// Bug: g++ fails to build up a const reference to `this'.
-// Build don't link:
class X
{
+// { dg-do run }
// Test that non-variadic function calls using thunks work right.
struct A {
+// { dg-do run { xfail m68k-motorola-sysv m88k-motorola-sysv3 } }
+// { dg-options "-fPIC" }
// Test that non-variadic function calls using thunks and PIC work right.
-// Skip if not native
-// Special g++ Options: -fPIC
-// excess errors test - XFAIL m68k-motorola-sysv m88k-motorola-sysv3
struct A {
void* p;
+// { dg-do run { xfail mips*-*-* rs6000-*-* powerpc-*-eabi m68k-*-coff m68k-motorola-sysv m88k-motorola-sysv3 mn10300-*-* mn10200-*-* v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa-*-* } }
// Test that variadic function calls using thunks work right.
// Note that this will break on any target that uses the generic thunk
// support, because it doesn't support variadic functions.
-// excess errors test - XFAIL mips*-*-* rs6000-*-* powerpc-*-eabi m68k-*-coff m68k-motorola-sysv m88k-motorola-sysv3 mn10300-*-* mn10200-*-* v850-*-* sh-*-* sh64-*-* h8*-*-* xtensa-*-*
#include <stdarg.h>
+// { dg-do assemble }
// Bug: Foo<Bar> *p semi-instantiates Foo<Bar> in local scope, so
// when Foo<Bar> f tries to instantiate it later, it only finds the partial
// instantiation from before.
//
// No PR; distilled from James Clark's SGML project.
//
-// Build don't link:
class Bar { };
template<class T> class Foo { };
-Foo<Bar> f; // gets bogus error - hosed binding levels
+Foo<Bar> f; // { dg-bogus "" } hosed binding levels
+// { dg-do assemble }
// No bug; making sure my fix for tredecl.C doesn't break other cases
-// Build don't link:
template<class T> struct Foo { Foo<T> * me() { return this; } };
Foo<int> i;
+// { dg-do assemble }
// PRMS Id: 4679
// Bug: redeclaration of templates erases the definition.
-// Build don't link:
template <class T> class Foo { public: void h(); };
template <class T> class Foo;
+// { dg-do assemble }
// It is illegal to use the name of a class template for anything else,
// including another class template.
-template <class T> class A { }; // ERROR -
-template <class U, class V> class A { }; // ERROR -
+template <class T> class A { }; // { dg-error "" }
+template <class U, class V> class A { }; // { dg-error "" }
+// { dg-do assemble }
// PRMS Id: 3665
-// Build don't link:
//-------------------------------------------------------------
// Referential declaration within class
+// { dg-do assemble }
// Bug: g++ fails to catch incompatibilities in the parameter lists when
// assigning.
-// Build don't link:
typedef struct S *type_p;
typedef struct S const *ctype_p;
void foobar ()
{
- static PF p = callee; // ERROR -
+ static PF p = callee; // { dg-error "" }
- p = callee; // ERROR -
+ p = callee; // { dg-error "" }
}
-PF pp = callee; // ERROR -
+PF pp = callee; // { dg-error "" }
+// { dg-do assemble }
// PRMS Id: 4687
// Bug: g++ misinterprets typedefs of function type in class scope.
-// Build don't link:
typedef int (*F1) ();
struct A {
typedef int F();
F *fp;
- F1 g() { return fp; } // gets bogus error - typing
+ F1 g() { return fp; } // { dg-bogus "" } typing
};
+// { dg-do run }
// PRMS Id: 5367
// Bug: the nested name of C::func gets hosed.
+// { dg-do assemble }
// Test that inheriting from a type typedefed to itself works.
-// Build don't link:
typedef struct class1 {
class1& operator=(const class1&);
+// { dg-do run }
#include <typeinfo>
#include <iostream>
+// { dg-do run }
// PRMS Id: 11596
#include <typeinfo>
+// { dg-do assemble }
// Bug: g++ doesn't insert anon union members into class scope.
// Breaks groff.
-// Build don't link:
struct A {
union {
int i;
};
- void foo () { i = 1; } // gets bogus error -
+ void foo () { i = 1; } // { dg-bogus "" }
};
+// { dg-do run }
__SIZE_TYPE__ newsize = 0;
__SIZE_TYPE__ delsize = 0;
+// { dg-do assemble }
// From: chw@bellcore.com (Charlie Woloszynski,MRE 2J-278,8295228,,27143)
// Newsgroups: gnu.g++.bug
// Subject: gcc-2.5.5 bug in multiple inheritance and pure virtual functions
// Date: 25 Jan 1994 23:41:36 -0500
// Bug: g++ fails to notice definitions of abstract virtuals.
-// Build don't link:
class A
{
int main()
{
- D d; // gets bogus error
+ D d; // { dg-bogus "" }
}
+// { dg-do run }
struct A {
virtual A* f () { return this; }
};
+// { dg-do assemble }
// Bug: g++ protests that foo was never defined.
-// Build don't link:
static void foo ();
static void foo ();
static void foo () { }
-void bar () { foo(); } // gets bogus error -
+void bar () { foo(); } // { dg-bogus "" }
+// { dg-do assemble }
+// { dg-options "-W -Wall" }
// Don't warn about these comparisons.
-// Build don't link:
-// Special g++ Options: -W -Wall
struct A {
unsigned int b : 14;
+// { dg-do assemble }
// g++ ought to warn about casting a base pointer to a derived reference.
-// Build don't link:
struct A {
virtual void f () = 0;
int main()
{
B* bp;
- A& ar = (A&)bp; // WARNING -
+ A& ar = (A&)bp; // { dg-warning "" }
}
+// { dg-do assemble }
+// { dg-options "-Wshadow" }
// Bug: overloading of 'A' for template causes bogus shadowing warnings.
-// Special g++ Options: -Wshadow
-// Build don't link:
template<class T>
class A
+// { dg-do assemble }
+// { dg-options "-Woverloaded-virtual" }
// Bug: a virtual function with the same name in an unrelated class will
// cause a bogus overloading warning.
-// Special g++ Options: -Woverloaded-virtual
-// Build don't link:
struct A {
virtual void foo ();
+// { dg-do run }
+// { dg-options "-Wall" }
// PRMS Id: 5135
// Bug: g++ complains that the result of the new expression is not used.
-// Special g++ Options: -Wall
extern "C" int printf (const char *, ...);
inline void * operator new (__SIZE_TYPE__, void *p) { return p; }
-// Special g++ Options: -Wunused
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-Wunused" }
struct A {
int i:8;
+// { dg-do assemble }
+// { dg-options "-Wunused" }
// PRMS Id: 5481
-// Special g++ Options: -Wunused
-// Build don't link:
struct A { };
static A a = A();
-// Build don't link:
+// { dg-do assemble }
struct A {
A();
const B& f ()
{
A a;
- return a; // WARNING - returning reference to temporary
+ return a; // { dg-warning "" } returning reference to temporary
}
-// Special g++ Options: -Wsynth
+// { dg-do assemble }
+// { dg-options "-Wsynth" }
struct A {
operator int ();
- A& operator= (int); // WARNING - not used below
+ A& operator= (int); // { dg-warning "" } not used below
};
main()
{
A a, b;
- a = b; // WARNING - uses synthesized op=
+ a = b; // { dg-warning "" } uses synthesized op=
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed access
// access file
// Message-Id: <9211281852.AA24557@cove.cis.ufl.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed access
// access file
// Message-Id: <9306301534.AA05072@sparc1.cnm.us.es>
{
private:
friend class Bar; // To avoid warning.
- Foo(const T &v) {}; // ERROR - private
+ Foo(const T &v) {}; // { dg-error "" } private
};
int main()
{
- Foo<int>(1);// ERROR -
+ Foo<int>(1);// { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed access
// unsorted.2 file
// Date: Sat, 6 Jun 1992 18:23:03 -0400
// Subject: bug with access control to member functions
class X {
- void g (int); // ERROR - is private
+ void g (int); // { dg-error "" } is private
public:
void g (double);
};
- class Y : public X { void f() { g (1); } };// ERROR -
+ class Y : public X { void f() { g (1); } };// { dg-error "" }
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed access
// (Message bugs/access:3)
// From: jamshid@ses.com (Jamshid Afshar)
// Subject: g++ 2.5.5 doesn't warn about inaccessible virtual base ctor
// Message-ID: <9403030024.AA04534@ses.com>
-class ForceLeafSterile { // ERROR -
+class ForceLeafSterile { // { dg-error "" }
friend class Sterile;
- ForceLeafSterile() {} // ERROR -
+ ForceLeafSterile() {} // { dg-error "" }
};
class Sterile : private virtual ForceLeafSterile {
class Illegitimate : public Sterile {
public:
- Illegitimate() {} // ERROR - can't access virtual base deflt ctor
+ Illegitimate() {} // { dg-error "" } can't access virtual base deflt ctor
Illegitimate(const char* /*blah*/)
- : ForceLeafSterile() {} // ERROR - can't access default ctor
+ : ForceLeafSterile() {} // { dg-error "" } can't access default ctor
Illegitimate(const Illegitimate&)
- {} // ERROR - can't access default ctor
+ {} // { dg-error "" } can't access default ctor
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed access
// access file
// From: Jeffrey C. Gealow <jgealow@mtl.mit.edu>
protected:
class nested_protected { int x; };
private:
- class nested_private { int x; }; // ERROR - private
+ class nested_private { int x; }; // { dg-error "" } private
};
class derived : public enclose {
nested_public obj1; // ok
nested_protected obj2; // ok
- nested_private obj3; // error// ERROR - in this context
+ nested_private obj3; // error// { dg-error "" } in this context
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed arg-matching
// arg-matching file
// Subject: argument matching depending on the def order
// check the order of declarations
class A {
public:
- void f(double* p) { std::cout << "A(double*)\n"; } // ERROR - candidate
- void f(int* p) { std::cout << "A(int*)\n"; } // ERROR - candidate
+ void f(double* p) { std::cout << "A(double*)\n"; } // { dg-error "" } candidate
+ void f(int* p) { std::cout << "A(int*)\n"; } // { dg-error "" } candidate
};
class B {
public:
- void f(int* p) { std::cout << "B(int*)\n"; } // ERROR - candidate
- void f(double* p) { std::cout << "B(double*)\n"; } // ERROR - candidate
+ void f(int* p) { std::cout << "B(int*)\n"; } // { dg-error "" } candidate
+ void f(double* p) { std::cout << "B(double*)\n"; } // { dg-error "" } candidate
};
int main()
A a;
B b;
- a.f(0);// ERROR - .*
- b.f(0);// ERROR - .*
+ a.f(0);// { dg-error "" } .*
+ b.f(0);// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed arg-matching
// arg-matching file
// From: Terry Lee <terry@uivlsisd.csl.uiuc.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed arg-matching
// From: gustavo@cpqd.br (Gustavo Chaves)
// Date: Wed, 25 May 94 09:38:00 EST
struct Ack { Ack(String); };
-struct S { void method(Ack); }; // ERROR - referenced below
+struct S { void method(Ack); }; // { dg-error "" } referenced below
void function(Ack);
int
foo(S *o)
{ // Neither call has a usable constructor for conversions of char[5] to Ack.
- function("adsf");// ERROR -
- o->method("adsf");// ERROR -
+ function("adsf");// { dg-error "" }
+ o->method("adsf");// { dg-error "" }
return 0;
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed arg-matching
// arg-matching file
// Message-Id: <199303032114.AA03574@kolvir.Boulder.ParcPlace.COM>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed arg-matching
typedef void* Ptr;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed arg-matching
// arg-matching file
// Message-Id: <14t4tyk@rpi.edu>
extern void Wrong4(char *a, int *b);
extern Amazing Wrong5(char *a, int *b);
-FuncPtr p = &Wrong5;// ERROR - .*
-FuncPtr func_ptr_array[] = { &Wrong1, &Wrong2, &Wrong3, &Wrong4, &Wrong5, 0 };// ERROR - .*
+FuncPtr p = &Wrong5;// { dg-error "" } .*
+FuncPtr func_ptr_array[] = { &Wrong1, &Wrong2, &Wrong3, &Wrong4, &Wrong5, 0 };// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed arg-matching
extern double pow(double,int*);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed arg-matching
// arg-matching file
// Message-Id: <9305032310.AA03900@malachite.bbn.com>
+// { dg-do run }
// GROUPS passed arg-matching
// arg-matching file
// Message-Id: <9305041759.AA04913@malachite.bbn.com>
+// { dg-do run }
// GROUPS passed arg-matching
// arg-matching file
// Message-Id: <9307081747.AA14030@tnt>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed arg-matching
// arg-matching file
// Message-Id: <199405132049.QAA06835@elan.cs.UMD.EDU>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed ARM-compliance
// arm file
// Message-Id: <9211191128.AA14718@us-es.sel.de>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed ARM-compliance
// arm file
// Message-Id: <1oab2hINN7m@gap.caltech.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed ARM-compliance
// arm file
// Message-Id: <9302181055.AA12522@slsvitt>
int main() {
- int x[ 10, 11]; // ERROR - .*
+ int x[ 10, 11]; // { dg-error "" } .*
return 0;
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed ARM-compliance
// arm file
// From: belley@cae.ca (Benoit Belley 3218)
};
X::X()
-{// ERROR - .*
+{// { dg-error "" } .*
std::cout << "X::X()" << std::endl;
}
}
Y::Y()
-{// ERROR - within this
+{// { dg-error "" } within this
std::cout << "Y::Y()" << std::endl;
}
+// { dg-do run }
// GROUPS passed ARM-compliance
#include <stdio.h>
#include <stdlib.h>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed ARM-compliance
// unsorted.2 file
// Message-Id: <BpBu19.GrF@math.waterloo.edu>
class X {
private:
- enum E1 {a1, b1}; // ERROR - private
+ enum E1 {a1, b1}; // { dg-error "" } private
public:
enum E2 {a2, b2};
};
X::E2 e2;
int x2 = X::a2;
- X::E1 e1; // ERROR - within this context
- int x1 = X::a1; // ERROR - Should be rejected, and is.
+ X::E1 e1; // { dg-error "" } within this context
+ int x1 = X::a1; // { dg-error "" } Should be rejected, and is.
}
+// { dg-do run }
// GROUPS passed ARM-compliance
// arm file
// From: Johan Bengtsson <jbn@lulea.trab.se>
-// Build don't link:
-// Special g++ Options: -ansi -Wall -pedantic
+// { dg-do assemble }
+// { dg-options "-ansi -Wall -pedantic" }
// GROUPS passed ARM-compliance
// arm file
// From: Olaf.Weber@cwi.nl
void foo();
};
-void (C::*pfm)() = C::foo;// ERROR - .*
+void (C::*pfm)() = C::foo;// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed ARM-compliance
// arm file
// Message-Id: <199301260140.AA13734@world.std.com>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed ARM-compliance
// arm file
// Message-Id: <199301260139.AA13555@world.std.com>
+// { dg-do run }
// GROUPS passed ARM-compliance
// arm file
// Message-Id: <199301272139.AA25489@world.std.com>
+// { dg-do run }
// GROUPS passed ARM-compliance
// arm file
// Message-Id: <9212072127.AA24243@us-es.sel.de>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed ARM-compliance
// arm file
// Message-Id: <9211231051.AA11287@us-es.sel.de>
switch (a) {
case 1:
- int v2 = 3;// ERROR - crosses.*
- case 2:// ERROR - jump.*
+ int v2 = 3;// { dg-error "" } crosses.*
+ case 2:// { dg-error "" } jump.*
if (v2 == 7) // error not flagged by 2.3.1
;
}
-// Special g++ Options: -w
+// { dg-do run }
+// { dg-options "-w" }
// GROUPS passed ARM-compliance
// arm file (also in cvt file)
// Message-Id: <9303061246.AA09402@gjetost.cs.wisc.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed ARM-compliance
// arm file
// Message-Id: <9303161105.AA29336@slsvitt>
// Date: Tue, 16 Mar 93 12:05:24 +0100
struct K {
- void f( int *p = 0); // ERROR - previous specification
+ void f( int *p = 0); // { dg-error "" } previous specification
};
extern int * q;
-void K::f( int *p = q);// ERROR - .*
+void K::f( int *p = q);// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed ARM-compliance
#include <iostream>
enum f1 {
public:
void set (f2 f);
};
-void B::set (f2 f) { std::cout << "called B\n";} // ERROR - candidate
+void B::set (f2 f) { std::cout << "called B\n";} // { dg-error "" } candidate
int main() {
B b;
- b.set(F1); // ARM page 309: should call A.set(f1) and that what g++ does,// ERROR - .*
+ b.set(F1); // ARM page 309: should call A.set(f1) and that what g++ does,// { dg-error "" } .*
// but 13.1 of ARM clearly states that it should call B::set()
// or generate an error because overloading works only for
// functions within the same scope (first page of chapter 13)
+// { dg-do run }
// GROUPS passed arrays
// array file
// Message-Id: <9204120353.AA06266@cs.rice.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed arrays
-// excess errors test - XFAIL *-*-*
// array file
// Message-Id: <"nac.no.188:05.10.92.14.37.45"@nac.no>
// From: frode@auticon.no
// Date: Thu, 5 Nov 92 15:37:34 PST
extern unsigned char * (*trt_def(int))[][2];
- extern unsigned char * (trt_rplst(unsigned char *(*)[][2]));
+ extern unsigned char * (trt_rplst(unsigned char *(*)[][2])); // { dg-error "" }
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed bad-errors
// bad-error file
// Message-Id: <9301081103.AA29469@jclark.com>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed bad-errors
// bad-error file
// Date: Sun, 31 Jul 1994 11:37:43 +1000 (EST)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed bad-errors
#include <stddef.h>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed bad-errors
typedef __SIZE_TYPE__ size_t;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed bad-errors
#include <iostream>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed bit-fields
typedef int A;
+// { dg-do run }
// GROUPS passed bit-fields
// bitfield file
// Message-Id: <92Oct29.191913est.62@jarvis.csri.toronto.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed bit-fields
class t {
short :(sizeof(short)-2);
+// { dg-do run }
+// { dg-options "" }
// GROUPS passed builtins
// Apparently not in g++ bug snapshot (was originally sent to bug-gcc)
// Message-Id: <m0p74Fh-0002fCC@neal.ctd.comsat.com>
// Subject: builtin_alloca on hpux (gcc-2.5.6)
// We have to avoid using -ansi, which results in a call to alloca instead of
// the use of __builtin_alloca, and thus ends up being unresolved.
-// Special g++ Options:
extern "C" int printf (const char *, ...);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed casts
// casts file
// From: dcb@us-es.sel.de (David Binderman 3841)
// Message-ID: <9302181342.AA14050@slsvitt>
int main() {
- (struct T { int b; } *) 0; // ERROR -
+ (struct T { int b; } *) 0; // { dg-error "" }
return 0;
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed casts
class VObject;
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// GROUPS passed casts
// casts file
// From: fjh@cs.mu.oz.au
// Message-Id: <9310121939.29641@munta.cs.mu.OZ.AU>
// Subject: should emit diagnostic for `int *p = (void *)0;'
// Date: Wed, 13 Oct 93 5:39:35 EST
- int *p = (void *)0;// ERROR - .*
+ int *p = (void *)0;// { dg-error "" } .*
+// { dg-do run }
// GROUPS passed code-generation
// code-gen file
// From: Jeffrey C. Gealow <jgealow@mtl.mit.edu>
+// { dg-do run }
// GROUPS passed code-generation
// code-gen file
// From: Gunther Seitz <Gunther.Seitz@regent.e-technik.tu-muenchen.dbp.de>
+// { dg-do run }
// GROUPS passed code-generation
// code-gen file
// From: david.binderman@pmsr.philips.co.uk
+// { dg-do run }
// GROUPS passed code-generation
// code-gen file
// From: "David" <norman@pi14.arc.umn.edu>
+// { dg-do run }
// GROUPS passed copy-ctors
#include <stdio.h>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed copy-ctors
// copy file
// From: Vivek Khera <khera@cs.duke.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
// ctor file
// From: rac@qedinc.com (Robert Clark)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
// ctor file
// Message-Id: <9302052351.AA10789@harvey>
};
public:
//template<class T> Err& operator << (const T x) { return Err() << x; }
- Err& operator << (const char *x) { return Err() << x; }// ERROR - .*
+ Err& operator << (const char *x) { return Err() << x; }// { dg-error "" } .*
private:
char x;
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
// ctor file
// Message-Id: <9302081631.AA14744@tera.com>
inline A(int x){printf("constructing A with %d\n", x);}
};
-class B:public A{ // ERROR - non-default constructor
+class B:public A{ // { dg-error "" } non-default constructor
private:
public:
};
int main()
{
- B(10);// ERROR - B doesn't have a constructor taking int
+ B(10);// { dg-error "" } B doesn't have a constructor taking int
}
+// { dg-do run }
// GROUPS passed constructors
#include <cstdio>
#include <cstdlib>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
#include <iostream>
class A {
- A() {} // private constructor// ERROR - .*
+ A() {} // private constructor// { dg-error "" } .*
};
int main() {
- A* a = new A();// ERROR - .*
+ A* a = new A();// { dg-error "" } .*
if (a) {
std::cout << "a != NULL\n";
} else {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
// ctor file
// Message-Id: <199301310203.AA22417@oak.ucsc.edu>
+// { dg-do run }
// GROUPS passed constructors
// ctor file
// Message-Id: <9303270404.28207@munta.cs.mu.OZ.AU>
+// { dg-do run }
// GROUPS passed constructors
// ctor file
// Message-Id: <9306021533.AA14347@icepick.jts.com>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
// ctor file
// Message-Id: <199306151813.gD28471@mail.Germany.EU.net>
#include <fstream>
-class X : public std::ifstream { // ERROR - candidate
+class X : public std::ifstream { // { dg-error "" } candidate
public:
- X(int a, char *b) {} // ERROR - candidate
+ X(int a, char *b) {} // { dg-error "" } candidate
};
int main()
{
X *y = new X(10, "123");
// the compiler must reject this constructor call:
- X *x = new X("abc");// ERROR - .*
+ X *x = new X("abc");// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
class test1 {
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
// ctor file
// From: mkohtala@vinkku.hut.fi
+// { dg-do run }
// GROUPS passed constructors
// Message-Id: <m0p8Am6-0002fCC@neal.ctd.comsat.com>
// Date: Fri, 10 Dec 93 11:33 EST
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
// ctor file
// Message-Id: <9311011758.AA25157@thneed.cs.duke.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
// ctor file
// From: mln@tera.com (Mark Niehaus)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
// ctor file
// Message-Id: <m0oxRi1-0002fPC@nesmith.pactitle.com>
-// Special g++ Options: -w
+// { dg-do run }
+// { dg-options "-w" }
// GROUPS passed constructors
// ctors file
// Message-Id: <ACHILLES.92Nov25192123@i90s8.ira.uka.de>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
// ctors file
// Subject: bug in handling static const object of the enclosing class
// Date: Tue, 1 Sep 92 10:38:44 EDT
class X
-{ // ERROR - candidate
+{ // { dg-error "" } candidate
private:
int x;
public:
Y();
}
X::X( int xi )
-{// ERROR - return.*
+{// { dg-error "" } return.*
x = xi;
}
const X X::x0( 0 );
Y::Y()
-{// ERROR - no mat
+{// { dg-error "" } no mat
xx = X::x0;
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
#include <complex>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed constructors
// ctors file
// Message-Id: <3JUL199214462623@envmsa.eas.asu.edu>
// The const keyword on this constructor is an error, but it shouldn't
// cause the compiler to crash.
- d1_t () const;// ERROR - .*const.*
+ d1_t () const;// { dg-error "" } .*const.*
virtual ~d1_t ();
};
+// { dg-do run }
// GROUPS passed constructors
// ctor file
// Message-Id: <199212160609.AA18247@phecda.cs.sfu.ca>
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// GROUPS passed constructors
// ctors file
// Message-Id: <9301132030.AA05210@cs.rice.edu>
struct var_Foo: public Foo
-{ // ERROR - base.*// ERROR - in class.*
+{ // { dg-error "" } base.*// ERROR - in class.*
var_Foo* operator-> () {return this;}
};
int main()
{
- var_Foo b(2);// ERROR -
+ var_Foo b(2);// { dg-error "" }
b->a = 0;
int x = blort(b);
return x;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// From: dak@pool.informatik.rwth-aachen.de
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <CC7oHn.B4F@izf.tno.nl>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Date: Tue, 10 Nov 92 11:08:08 PST
class Thing{
private: int x;
- public: const int N = -1; // ERROR - bad initialization
+ public: const int N = -1; // { dg-error "" } bad initialization
Thing(int y);
};
+// { dg-do run }
// GROUPS passed conversions
// cvt file
// Message-Id: <9301071708.AA03432@muresh.et.tudelft.nl>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <ISHAI.93Mar26102509@cs73.technion.ac.il>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <9303241504.AA25988@spock.orl.mmc.com>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <9308051530.AA05922@NeoSoft.Com>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <9304121647.AA25819@tnt>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <9305210124.AA02409@kato.cs.brown.edu>
int main()
{
Node** node1;
- Line_Segment(node1->Location()); // intended (*node1)// ERROR - .*
+ Line_Segment(node1->Location()); // intended (*node1)// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <9307090042.AA28565@uluru.Stanford.EDU>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <1166.9307131600@ace.eng.cam.ac.uk>
+// { dg-do run }
// GROUPS passed conversions
#include <cstdio>
#include <cstdlib>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <9307152250.AA24812@volterra>
// Compiles fine with Sun CC 2.1
void f(char *& x)
-{// ERROR - location of error
+{// { dg-error "" } location of error
x++;
}
int main()
{
- f ("foo");// ERROR - init of non-const ref from char*
+ f ("foo");// { dg-error "" } init of non-const ref from char*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <9307200528.AA02094@legolas>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <93Aug2.163542pdt.26892@franklin.parc.xerox.com>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <9308051209.AA15962@NeoSoft.Com>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <9308122113.AA14119@tnt.acsys.com>
+// { dg-do run }
// GROUPS passed conversions
// cvt file
// Message-Id: <9308091213.AA11572@emmy.Mathematik.Uni-Dortmund.DE>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <1992Jul31.142856.10082@ericsson.se>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// Message-Id: <9208261851.AA16997@josquin.media.mit.edu>
+// { dg-do run }
// GROUPS passed conversions
// cvt file
// From: krste@icsi.berkeley.edu (Krste Asanovic)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed conversions
// cvt file
// From: solomon@cs.wisc.edu (Marvin Solomon)
return a;
}
-void f(A &a) { // ERROR - in passing argument
+void f(A &a) { // { dg-error "" } in passing argument
printf("A at %x is %d\n", &a, a.i);
}
int main() {
B b;
b.i = 99;
- f(b);// ERROR - .*
+ f(b);// { dg-error "" } .*
}
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// GROUPS passed conversions
// cvt file
// Message-Id: <m0mVSRj-0000cEC@mobius.veritas.com>
int Isopen ();
};
-widget fp = (widget) &window::Isopen; // ERROR - // ERROR -
+widget fp = (widget) &window::Isopen; // { dg-error "" } // ERROR -
-// Build don't link:
-// Special g++ Options: -frtti
+// { dg-do assemble }
+// { dg-options "-frtti" }
// GROUPS passed rtti
// dossier file
// Message-Id: <9212021501.AA02484@olympia.miro.com>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed destructors
// friends file
// From: offline!marc@ai.mit.edu (Marc Duponcheel) (Marc Duponcheel)
void f()
{
int i;
- i.i::~i();// ERROR - .*
+ i.i::~i();// { dg-error "" } .*
}
+// { dg-do run }
// GROUPS passed destructors
#include <stdio.h>
+// { dg-do run }
// GROUPS passed destructors
// dtor file
// Message-Id: <9301242117.AA04053@cs.rice.edu>
+// { dg-do run }
// GROUPS passed destructors
#include <stdio.h>
+// { dg-do run }
// GROUPS passed destructors
// dtor file:
// Message-Id: <1992Jun25.181845.18886@leland.Stanford.EDU>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
class X {
struct X1;
-// Build don't link:
-// Special g++ Options: -fshort-enums
+// { dg-do assemble }
+// { dg-options "-fshort-enums" }
// GROUPS passed enums
// enum file
// From: Jeff Gehlhaar <jbg@qualcomm.com>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
// enum file
// From: frode@auticon.no
private:
TOGGLE toggle;
public:
- virtual void on(void) { toggle = 3; };// ERROR - .*
- virtual void off(void) { toggle = on; };// ERROR - .*
+ virtual void on(void) { toggle = 3; };// { dg-error "" } .*
+ virtual void off(void) { toggle = on; };// { dg-error "" } .*
};
int main()
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
// enum file
// From: dougm@cs.rice.edu (Doug Moore)
struct Struct
{
int i;
- int getI(Enum) {return i;} // ERROR - candidates
+ int getI(Enum) {return i;} // { dg-error "" } candidates
};
int funct (Enum)
{
Enum e = enumerator1;
Struct s;
- int x = funct(e+1);// ERROR - .*
- int y = s.getI(e+1);// ERROR - .*
+ int x = funct(e+1);// { dg-error "" } .*
+ int y = s.getI(e+1);// { dg-error "" } .*
return x+y;
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
// enum file
// From: polstra!jdp@uunet.uu.net (John Polstra)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
// friends file
// From: offline!marc@ai.mit.edu (Marc Duponcheel) (Marc Duponcheel)
-// Build don't link:
-// Special g++ Options: -fshort-enums
+// { dg-do assemble }
+// { dg-options "-fshort-enums" }
// GROUPS passed enums
enum E { A = 0x80000000 };
-// Special g++ Options: -fshort-enums
+// { dg-do run }
+// { dg-options "-fshort-enums" }
// GROUPS passed enums
extern "C" int printf (const char *, ...);
-// Build don't link:
-// Special g++ Options: -fexceptions
+// { dg-do assemble }
+// { dg-options "-fexceptions" }
// GROUPS passed exceptions
// except file
// Message-Id: <9207221230.AA08566@life.ai.mit.edu>
-// Build don't link:
-// Special g++ Options: -fexceptions -g
+// { dg-do assemble }
+// { dg-options "-fexceptions -g" }
// GROUPS passed exceptions
// except file
// Message-Id: <9211061330.AA29334@ifad.dk>
-// Build don't link:
-// Special g++ Options: -fexceptions
+// { dg-do assemble }
+// { dg-options "-fexceptions" }
// GROUPS passed exceptions
// except file
// Message-Id: <9211301118.AA09810@ss670mp.geco.slb.com>
-// Build don't link:
-// Special g++ Options: -fexceptions
+// { dg-do assemble }
+// { dg-options "-fexceptions" }
// GROUPS passed exceptions
// except file
// Message-Id: <9307071456.AA05275@davinci.hio.hen.nl>
-// Build don't link:
-// Special g++ Options: -fexceptions
+// { dg-do assemble }
+// { dg-options "-fexceptions" }
// GROUPS passed exceptions
// except file
// Message-Id: <199311101607.AA11803@hsi86.hsi.com>
-// Build don't link:
-// Special g++ Options: -fexceptions
+// { dg-do assemble }
+// { dg-options "-fexceptions" }
// GROUPS passed exceptions
// except file
// From: GUSTAVO%DRAGON@orion.cpqd.ansp.br
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed friends
// friends file
// From: rwave!myersn%rwave.roguewave@cs.orst.edu (Nathan Myers)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed friends
// friends file
// From: osinski@cs.nyu.edu (Ed Osinski)
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-Wreturn-type" }
// GROUPS passed friends
-// Special g++ Options: -Wreturn-type
extern "C" int good_friend(int);
extern "C" int bad_friend();
int good_friend(int)
{
obj.parts = 0;
- } // ERROR - non-void
+ } // { dg-error "" } non-void
int bad_friend()
{
obj.parts = 0;
- } // ERROR - non-void
+ } // { dg-error "" } non-void
+// { dg-do run }
// GROUPS passed initialization
// global-init file
// Message-Id: <9212021756.AA12639@grumpy.pocs.com>
-// Build don't link:
-// Special g++ Options: -w -O3
+// { dg-do assemble }
+// { dg-options "-w -O3" }
// GROUPS passed incdec
typedef void* Pix;
class ndbArtPtrVec
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
class foo {
public:
class bar {
public:
- foo f[3] = { 1, 2, 3 }; // works: f[0] = 1, f[1] = 2, f[2] = 3 // ERROR - ANSI C++ forbids initialization of member f;
+ foo f[3] = { 1, 2, 3 }; // works: f[0] = 1, f[1] = 2, f[2] = 3 // { dg-error "" } ANSI C++ forbids initialization of member f;
};
class bar2 {
public:
- foo f[3] = { foo(1), foo(2), foo(3) }; // ERROR - ANSI C++ forbids initialization of member f;
+ foo f[3] = { foo(1), foo(2), foo(3) }; // { dg-error "" } ANSI C++ forbids initialization of member f;
// does not compile -- error: field initializer is not constant
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
// init file
// From: Ingo Donasch <ingo@specs.de>
};
b::b() : three(this)
-{ // ERROR - bad array initializer
+{ // { dg-error "" } bad array initializer
}
+// { dg-do run }
// GROUPS passed initialization
// init file
// From: hansen@srd.ull.rdc.toshiba.co.jp
+// { dg-do run }
// GROUPS passed initialization
// init file
// Message-Id: <9306280834.AA20921@slsvitt.us-es.sel.de>
+// { dg-do run }
// GROUPS passed initialization
// init file
// From: hansen@srd.ull.rdc.toshiba.co.jp
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
// init file
// From: lupine!segfault!rfg@uunet.UU.NET
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
// init file
// From: thayer@moose.cs.columbia.edu (Charles Thayer)
int main() {
int offset;
-char buf[offset]=""; // ERROR - ansi forbids variable arrays
+char buf[offset]=""; // { dg-error "" } ansi forbids variable arrays
}
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// GROUPS passed initialization
class Time;
class TimeNote;
class SvTime
{
public:
- static TimeNote *time_events = 0;// ERROR - .*
+ static TimeNote *time_events = 0;// { dg-error "" } .*
};
-SvTime CurrentTime = {0};// ERROR -
+SvTime CurrentTime = {0};// { dg-error "" }
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
// GROUPS passed initialization
// init file
// From: dcb@us-es.sel.de
class X {
public :
- void f( int = fred( 0) ) ; // ERROR - previous spec
+ void f( int = fred( 0) ) ; // { dg-error "" } previous spec
} ;
-void X::f( int x = fred( 0) ) {// ERROR - .*
+void X::f( int x = fred( 0) ) {// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
class Vector {
double *v;
~Vector();
};
-exmpl() { Vector x(8)[16]; }// ERROR - .*
+exmpl() { Vector x(8)[16]; }// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
class test
{
test (int val) { x = val; y = 0;}
};
-test ar(34)[5];// ERROR - .*
+test ar(34)[5];// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed initialization
// init file
// From: kol@world.std.com (Nikolay Yatsenko)
const int ic = 1;
void f(int& arg)
-{ // ERROR - argument 1
+{ // { dg-error "" } argument 1
if (arg) ;
}
const int& icr = ic;
int main(void)
{
- f(icr); // g++ does not give error here// ERROR - .*
+ f(icr); // g++ does not give error here// { dg-error "" } .*
return 0;
}
+// { dg-do run }
// GROUPS passed initialization
// init file
// From: Richard Speed <speed@cs.montana.edu>
+// { dg-do run }
// GROUPS passed inlining
// inline file
// Message-Id: <9306020823.AA14027@joker>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed inlining
// inline file
// Message-Id: <199307162240.AA04019@world.std.com>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed inlining
template <class Type>
struct A {
-// Build don't link:
-// Special g++ Options: -fsave-memoized
+// { dg-do assemble }
+// { dg-options "-fsave-memoized" }
// GROUPS passed memoized
class CArray
{
-// Build don't link:
-// Special g++ Options: -O
+// { dg-do assemble }
+// { dg-options "-O" }
// GROUPS passed mentor
struct Word {
struct S1 *p1;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed missed-error
// missed-error file
// From: John Carr <jfc@Athena.MIT.EDU>
}
pfv p = f;
-pfv p2 = cf; // ERROR - mismatch XFAIL *-*-*
-pcfv p3 = f; // ERROR - mismatch XFAIL *-*-*
+pfv p2 = cf; // { dg-error "" "" { xfail *-*-* } } mismatch
+pcfv p3 = f; // { dg-error "" "" { xfail *-*-* } } mismatch
pcfv p4 = cf;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed missed-error
// missed-error file
// From: ndc!don@csvax.cs.caltech.edu (Don Erway)
#include <iostream>
-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
+inline int max(int a, int b) {return a > b ? a : b;}; // { dg-error "" } candidate
+inline double max(double a, double b) {return a > b ? a : b;}; // { dg-error "" } candidate
int main() {
- static void foo(int i, int j, double x, double y) ;// ERROR - .*
+ static void foo(int i, int j, double x, double y) ;// { dg-error "" } .*
foo(4, -37, 14.39, 14.38);
}
std::cout << "Max(int): " << max(i,j) << " Max(double): " <<
max(x,y) << '\n';
- std::cout << "Max(int, double): " << max(i, y) << '\n';// ERROR -
+ std::cout << "Max(int, double): " << max(i, y) << '\n';// { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed missed-error
// missed-error file
// From: Neil Wilson <csf004@cch.coventry.ac.uk>
virtual const int lower() const;
virtual const int upper() const;
virtual const T item(const int index) const;
- const T Array::operator[](const int index); // ERROR - qualification ignored
+ const T Array::operator[](const int index); // { dg-error "" } qualification ignored
virtual const bool valid_index(const int index) const;
virtual const bool empty() const;
friend const bool operator==(const Array& left, const Array& right);
void Fixed_List::go_offleft() const
{
- cursor_position = 0;// ERROR -
+ cursor_position = 0;// { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed missing
// missing file
// Message-Id: <9207100259.AA11702@quaestor>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nest
// nest file
// From: gs4t@virginia.edu (Gnanasekaran Swaminathan)
// Subject: Local type names bug in g++ 2.3.3
// Message-ID: <1992Dec30.203807.17504@murdoch.acc.Virginia.EDU>
-typedef char* T; // ERROR - previous declaration
+typedef char* T; // { dg-error "" } previous declaration
struct Y {
T a;
- typedef long T; // error. See ARM p189-191 for details// ERROR -
+ typedef long T; // error. See ARM p189-191 for details// { dg-error "" }
T b;
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nest
struct B
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nest
#include <iostream>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nest
// nest file
// From: Neal Young <ney@princeton.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed nest
// nest file
// From: tal@vlsi.cs.caltech.edu
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// opr-eq file
// Message-Id: <9306040324.AA22954@balder.cs.wisc.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// opr-eq file
// Message-Id: <CCJrut.9M7@csc.ti.com>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// opr-eq file
// Message-Id: <199311181618.AA27761@oil.cs.columbia.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// opr-eq file
// Message-Id: <1993Nov18.210502.28842@midway.uchicago.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
void foo (int * a, int * b, int * c) {}
+// { dg-do run }
// GROUPS passed operators
// opr-del file
// Message-Id: <199301272137.AA25213@world.std.com>
+// { dg-do run }
// GROUPS passed operators
// copy file
// From: gfm@mencon.mencon.oz.au (Graham Menhennitt)
-// Build don't link:
-// Special g++ Options: -Wall -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-Wall -pedantic-errors" }
// GROUPS passed operators
// copy file
// From: gfm@mencon.mencon.oz.au (Graham Menhennitt)
// Message-ID: <9304291053.AA00090@mencon>
struct A {
- A& operator = (const A& a) {}// WARNING -
+ A& operator = (const A& a) {}// { dg-warning "" }
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// opr-ampr file
// From: mecklen@oops.cs.utah.edu (Robert Mecklenburg)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// opr-ampr file
// From: Jarkko Sonninen <Jarkko.Sonninen@lut.fi>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// opr-conv file
// Message-Id: <199301260142.AA13995@world.std.com>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
struct A {
int x;
};
-int operator()(A x,float y) {// ERROR - .*
+int operator()(A x,float y) {// { dg-error "" } .*
return 1;
}
int main() {
A x;
- x(1.0); // ERROR - no match
+ x(1.0); // { dg-error "" } no match
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
template <class T>
class t {
+// { dg-do run }
// GROUPS passed operators
// opr-new file
// From: (The Crossjammer) <xjam@cork.cs.berkeley.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// opr-new file
// From: rwave!myersn%rwave.roguewave@cs.orst.edu (Nathan Myers)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// opr-new file
// From: gparker@world.std.com (Glenn P Parker)
+// { dg-do run }
// GROUPS passed operators
// opr-new file
// From: David Binderman 3841 <dcb@us-es.sel.de>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
#include <sys/types.h>
#include <stdio.h>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// (Message bugs/opr-del:4)
// From: jamshid@ses.com (Jamshid Afshar)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// opr-pl file
// Message-Id: <9212010409.AA24967@zeus.research.otc.com.au>
+// { dg-do run }
// GROUPS passed operators
// opr-mm file
// Date: Thu, 2 Jun 94 10:00:29 +0200
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// opr-del file
// From: Eberhard Mattes <mattes@azu.informatik.uni-stuttgart.de>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
#include <iostream>
};
foo **f2;
-allocate2d(d1, d2, f2);// ERROR - type.*// ERROR - trying to.*
-ffree(d1, f2);// ERROR - type.*// ERROR - trying to.*
+allocate2d(d1, d2, f2);// { dg-error "" } type.*// ERROR - trying to.*
+ffree(d1, f2);// { dg-error "" } type.*// ERROR - trying to.*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// opr-new file
// From: flisakow@cae.wisc.edu
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
class A {
public:
+// { dg-do assemble }
// GROUPS passed operators
// opr-del file
// From: rollins@bart.ee.queensu.ca (Mark Rollins)
Complex *v;
public:
Vector(int s=1) { size = s; v = new Complex[size];};
- ~Vector() { delete [size] v;}// ERROR - warning
+ ~Vector() { delete [size] v;}// { dg-error "" } warning
};
void foo(int s)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// opr-as file
// From: Klaus Ahrens <ahrens@informatik.hu-berlin.de>
+// { dg-do run }
// GROUPS passed operators
#include <stdio.h>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// opr-eq file
// Message-Id: <9301141514.AA05925@mi.el.utwente.nl>
class B
{
public:
- operator=(B &); // ERROR - no type or storage class
+ operator=(B &); // { dg-error "" } no type or storage class
};
void
test(B &b1, const B &b2)
{
- b1 = b2;// ERROR - .*
+ b1 = b2;// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed parsing
// parsing folder
// From: hendrik%vedge.UUCP@iro.umontreal.ca
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed parsing
// parsing folder
// From: Eirik Fuller <eirik@elf.ithaca.ny.us>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed parsing
// parsing folder
// From: jonathan@Pescadero.Stanford.EDU
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed parsing
// parsing folder
// From: tll@cco.caltech.edu (Tal Lewis Lancaster)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed parsing
// parsing folder
// From: Glenn Engel <glenne@lsid.hp.com>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed parsing
// From: Teemu Torma <Teemu.Torma@frend.fi>
// Date: Mon, 15 Jun 92 18:42:25 +0300
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed parsing
// parsing folder
// From: "James S. Vera" <vera@fanaraaken.stanford.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed parsing
// parsing folder
// From: szahn%Robinie@goesser.sie.siemens.co.at (Hr. Zahn)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed parsing
// parsing folder
// From: nag@soft.flab.fujitsu.co.jp
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed parsing
// From: Jason Merrill <jason@cygnus.com>
// Date: Fri, 13 Aug 93 12:49:11 PDT
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed patches
// patches file
// From: david.binderman@pmsr.philips.co.uk
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed operators
// pic file
// Message-Id: <199406132030.NAA23508@dewitt.eecs.berkeley.edu>
-// Special g++ Options: -pg
+// { dg-do run { xfail m68k-motorola-sysv m88k-motorola-sysv3 mips*-*-* i[3456]86-*-sco3.2v5* } }
+// { dg-options "-pg" }
// GROUPS passed profiling
-// Skip if not native
-// excess errors test - XFAIL m68k-motorola-sysv m88k-motorola-sysv3 mips*-*-* i[3456]86-*-sco3.2v5*
#include <stdio.h>
main()
{
+// { dg-do run }
// GROUPS passed references
// (Message bugs/refs:1)
// From: tal@vlsi.cs.caltech.edu
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed references
int func(int& i)
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed references
const int& min(const int& n, const int& m)
{
+// { dg-do run }
// GROUPS passed references
// execution test
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed scoping
// scoping file
// From: kol@world.std.com (Nikolay Yatsenko)
+// { dg-do run }
// GROUPS passed scoping
// scoping file
// From: svkakkad@cs.utexas.edu (Sheetal V. Kakkad)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed scoping
// local-class file
// From: dcb@us-es.sel.de
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed scoping
// local-class file
// From: daniels@sugar.neosoft.com (Brad Daniels)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed scoping
// local-class file
// From: schlaege@methusalix.ert.rwth-aachen.de (Chris Schlaeger H Zivojnovic)
-// Build don't link:
-// Special g++ Options: -Wshadow
+// { dg-do assemble }
+// { dg-options "-Wshadow" }
// GROUPS passed shadow-warnings
// shadow file
// Message-Id: <9211061827.AA03517@harvey>
-// Build don't link:
-// Special g++ Options: -Wshadow
+// { dg-do assemble }
+// { dg-options "-Wshadow" }
// GROUPS passed shadow-warnings
// (Message bugs/shadow:2)
// From: michael@utex.rni.sub.org (Michael Utech)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed static-mem
class desc;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed static-mem
// static-mem file
// Message-Id: <9406021639.AA00789@oz.NeXT.COM>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed static-mem
struct test {
void test_member() {
-// Build don't link:
-// Special g++ Options: -w
+// { dg-do assemble }
+// { dg-options "-w" }
// GROUPS passed static-mem
// static-mem file
// From: bunch@tazboy.jpl.nasa.gov (Walt Bunch)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
class String {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template< class R, class T1 = R, class T2 = T1 >
struct plus
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed temps
// temps file
// Date: Mon, 07 Sep 1992 13:12:28 EDT
cookie ( foo * x) { v=x; }
};
-cookie cat(&foo("apabepa"));// ERROR - .*
+cookie cat(&foo("apabepa"));// { dg-error "" } .*
+// { dg-do run }
// GROUPS passed temps
// temps file
// Message-Id: <9212181914.AA05066@sparc1.cnm.us.es>
+// { dg-do run }
// GROUPS passed temps
// temps file
// Message-Id: <9308231535.AA19432@geant.cenatls.cena.dgac.fr>
-// Special g++ Options: -felide-constructors
+// { dg-do run }
+// { dg-options "-felide-constructors" }
// GROUPS passed temps
// temps file
// Message-Id: <9311102043.AA22871@ses.com>
+// { dg-do run }
// GROUPS passed temps
// temps file
// Message-Id: <9311171029.AA00592@mencon>
+// { dg-do run }
// GROUPS passed temps
// Date: Tue, 22 Mar 94 12:46:28 +0100
// From: dak@pool.informatik.rwth-aachen.de
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed temps
template <class B >
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed typeck
// typeck file
// From: vern@daffy.ee.lbl.gov (Vern Paxson)
int test( const foo* f, const bar* b )
{
- return f == b;// ERROR -
+ return f == b;// { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed typeck
// typeck file
// From: Jutta Degener <jutta@cs.tu-berlin.de>
{
int * p = new int[10];
int * q = new arr; /* g++ complains, but shouldn't */
- int (* r)[10] = new arr; /* g++ doesn't complain, but should */// ERROR -
+ int (* r)[10] = new arr; /* g++ doesn't complain, but should */// { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed typeck
// typeck file
// From: Dror Caspi <dror@fibronics.co.il>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed typeck
class A {
public:
void ff( A &anA )
{
- int &ani = anA[0];// ERROR -
+ int &ani = anA[0];// { dg-error "" }
ani = 7;
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed unions
// anon-union file
// From: "Terry R. Coley" <terry@wag.caltech.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed unions
// anon-union file
// From: gerlek@dat.cse.ogi.edu (Michael Gerlek)
public:
int x;
private:
- int y; // ERROR - private
+ int y; // { dg-error "" } private
union {
- int z; // ERROR - private
+ int z; // { dg-error "" } private
};
};
A a;
a.x = 0;
- a.y = 1;// ERROR - .*
- a.z = 2;// ERROR -
+ a.y = 1;// { dg-error "" } .*
+ a.z = 2;// { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed unions
// anon-union file
// From: dcb@us-es.sel.de (David Binderman 3841)
static union {
char* uC;
private:
- int uI;// ERROR -
+ int uI;// { dg-error "" }
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed unions
// anon-union file
// From: hossein@veritas.com (Hossein Raassi)
struct SS {
int ss;
};
-};// ERROR - .*
+};// { dg-error "" } .*
-// Build don't link:
-// Special g++ Options: -O
+// { dg-do assemble }
+// { dg-options "-O" }
// GROUPS passed unsorted
// unsorted.2 file
// From: skipnyc!skipsun!skip@fsg.com (Skip Gilbrech)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed unsorted
// code-gen file
// From: klaus@steinitz.mathematik.uni-dortmund.de
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed vbase
// vbase file
// From: pino@hubble.eecs.berkeley.edu (Jose Luis Pino)
-// Build don't link:
-// Special g++ Options: -Woverloaded-virtual
+// { dg-do assemble }
+// { dg-options "-Woverloaded-virtual" }
// GROUPS passed virtual-warnings
// copy file
// From: gfm@mencon.mencon.oz.au (Graham Menhennitt)
+// { dg-do run }
// GROUPS passed virtual-functions
// Not in g++ bugs snapshot
// From: grande@isi.edu (Jim Grande)
+// { dg-do run }
// GROUPS passed virtual-functions
// virtual file
// From: allan@ramjet.multinet.DE (Allan Brighton)
+// { dg-do run }
// GROUPS passed virtual-functions
#include <stdio.h>
#include <stdlib.h>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
#include <iostream>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
#include <iostream>
};
class deriv : public base {
- void base :: f1();// ERROR - .*
+ void base :: f1();// { dg-error "" } .*
};
int main ()
-// Build don't link:
-// Special g++ Options: -w
+// { dg-do assemble }
+// { dg-options "-w" }
// GROUPS passed visibility
// visibility file
// From: Alan Shepherd <a.shepherd@nexor.co.uk>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: Mark Rawling <Mark.Rawling@mel.dit.csiro.au>
// Subject: member access rule bug
// Message-ID: <9306300528.AA17185@coda.mel.dit.CSIRO.AU>
struct a {
- int aa; // ERROR - private
+ int aa; // { dg-error "" } private
};
class b : private a {
};
class c : public b {
- int xx(void) { return (aa); } // aa should be invisible// ERROR - .*
+ int xx(void) { return (aa); } // aa should be invisible// { dg-error "" } .*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: dinh@cs.ucla.edu (Dinh Le)
const int ArraySize = 12;
template <class Type>
-class Array { // ERROR - .struct Array_RC redecl.*
+class Array { // { dg-error "" } .struct Array_RC redecl.*
friend class Array_RC;
public:
Array(const Type *ar, int sz) { init(ar,sz); }
// --------------- Array_RC.h && Array_RC.cc ----------------
template <class Type>
-class Array_RC : public Array<Type> {// ERROR - previous declaration.*
+class Array_RC : public Array<Type> {// { dg-error "" } previous declaration.*
public:
Array_RC(const Type *ar, int sz);
Type& operator[](int ix);
template <class Type>
Type &Array_RC<Type>::operator[](int ix) {
- assert(ix >= 0 && ix < size);// ERROR - member .size.*
- return ia[ix];// ERROR - member .ia.*
+ assert(ix >= 0 && ix < size);// { dg-error "" } member .size.*
+ return ia[ix];// { dg-error "" } member .ia.*
}
// ------------------- Test routine ----------------------
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: ajp@eng.cam.ac.uk
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: wpsun4!xinforms!johnjo@uunet.uu.net (John D. Johnson)
class X {
private:
- void* operator new(size_t) throw(){// ERROR - .*
+ void* operator new(size_t) throw(){// { dg-error "" } .*
printf("Inside private new().\n");
return NULL;
}
int main(void)
{
- X* p = new X;// ERROR - .*
+ X* p = new X;// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: Marie Trapp <Marie.Trapp@analog.com>
// Message-ID: <9308051553.AA07639@nwd2sun1.analog.com>
class A {
protected:
- int astuff; // ERROR - protected
+ int astuff; // { dg-error "" } protected
A() {
astuff = 3;
}
int bstuff;
public:
B( A *p) {
- bstuff = p->astuff;// ERROR - .*
+ bstuff = p->astuff;// { dg-error "" } .*
}
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: Sandeep Shroff <ss@caere.com>
};
Base::Base()
-{ // ERROR - private
+{ // { dg-error "" } private
name_ = std::strcpy(new char[std::strlen(" ") + 1], " ");
}
Base::Base(char* str)
-{ // ERROR - private
+{ // { dg-error "" } private
if(str != NULL)
name_ = std::strcpy(new char[std::strlen(str) + 1], str);
}
Derived::Derived(int n, char* str) : Base(str)
-{// ERROR - .*
+{// { dg-error "" } .*
num_ = n;
}
Derived::Derived(int n) : Base()
-{// ERROR - .*
+{// { dg-error "" } .*
num_ = n;
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: cmwang@iis.sinica.edu.tw (Chien-Min Wang)
// Message-ID: <9308061142.AA08533@iiserv>
struct T1 { int i; };
-struct T2 { int j; }; // ERROR - private
+struct T2 { int j; }; // { dg-error "" } private
struct T3 : public T1, private T2 {
} x;
int main ()
{
x.i = 1;
- x.j = 2; // error: x.j is private// ERROR - .*
+ x.j = 2; // error: x.j is private// { dg-error "" } .*
return 0;
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: mclaugh@tnt.acsys.com (Mark A. McLaughlin)
// Message-ID: <9308252030.AA02352@tnt.acsys.com>
class B {
protected:
- int i; // ERROR - protected
+ int i; // { dg-error "" } protected
};
class D1 : public B {
void fr(B* pb, D1* p1, D2* p2)
{
- pb->i = 1; // illegal// ERROR - .*
- p1->i = 2; // illegal// ERROR - .*
+ pb->i = 1; // illegal// { dg-error "" } .*
+ p1->i = 2; // illegal// { dg-error "" } .*
p2->i = 3; // ok (access through D2)
}
void D2::mem(B* pb, D1* p1)
{
- pb->i = 1; // illegal// ERROR - .*
- p1->i = 2; // illegal// ERROR - .*
+ pb->i = 1; // illegal// { dg-error "" } .*
+ p1->i = 2; // illegal// { dg-error "" } .*
i = 3; // ok (access through `this')
}
void g(B* pb, D1* p1, D2* p2)
{
- pb->i = 1; // illegal// ERROR - .*
- p1->i = 2; // illegal// ERROR - .*
- p2->i = 3; // illegal// ERROR - .*
+ pb->i = 1; // illegal// { dg-error "" } .*
+ p1->i = 2; // illegal// { dg-error "" } .*
+ p2->i = 3; // illegal// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
#include <iostream>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: doug@foxtrot.ccmrc.ucsb.edu (Douglas Scott)
class Base {
protected:
- void protectedBaseFunction() {} // ERROR - protected
+ void protectedBaseFunction() {} // { dg-error "" } protected
public:
Base() {}
};
void
Derived::noticeThisFunction(Base *b) {
- b->protectedBaseFunction(); // ARM says this is not allowed// ERROR - .*
+ b->protectedBaseFunction(); // ARM says this is not allowed// { dg-error "" } .*
// since it is not called on 'this'
}
Base b;
Derived d;
d.noticeThisFunction(&b);
- printf("gpptest run\n");// ERROR - .*
+ printf("gpptest run\n");// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: klamer@mi.el.utwente.nl (Klamer Schutte)
// Message-ID: <9308121003.AA02294@mi.el.utwente.nl>
class A {
protected:
- void foo(); // ERROR - protected
+ void foo(); // { dg-error "" } protected
};
class B : public A
{
void bar(A &a)
- { a.foo(); }// ERROR - .*
+ { a.foo(); }// { dg-error "" } .*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: Robert Carden <carden@thoth.ics.uci.edu>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: joe@consolve.com (Joe Shapiro)
class A
{
public:
- void Fun() { printf( "Fun fun fun!\n" ); } // ERROR - private
+ void Fun() { printf( "Fun fun fun!\n" ); } // { dg-error "" } private
};
class C
{
public:
- C() { _b.Fun(); }// ERROR - .*
+ C() { _b.Fun(); }// { dg-error "" } .*
private:
B<int> _b;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: gfm@mencon.mencon.oz.au (Graham Menhennitt)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: jamshid@ses.com (Jamshid Afshar)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: jbuck@synopsys.com (Joe Buck)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
extern "C" int printf( const char *, ...);
class D : public B {
public:
virtual ~D() { printf( "D::~D\n"); }
- void operator = ( int i) { this->~B(); }// ERROR - D has no ~B part to it
+ void operator = ( int i) { this->~B(); }// { dg-error "" } D has no ~B part to it
};
int
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: kol@world.std.com (Nikolay Yatsenko)
int main(void)
{
static int s;
- int x; // ERROR - declared
+ int x; // { dg-error "" } declared
extern int g();
struct local {
- int g() { return x; } // illegal (non-static x); g++ does not give error// ERROR -
+ int g() { return x; } // illegal (non-static x); g++ does not give error// { dg-error "" }
int h() { return s; } // ok, but g++ give error
};
return 0;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: dcb@us-es.sel.de (David Binderman 3841)
class A {
public:
- int b; // ERROR - private
+ int b; // { dg-error "" } private
};
class C : private A { // NOTE WELL. private, not public
class E : public C {
void f() {
- printf( "%d\n", b);// ERROR - .*
+ printf( "%d\n", b);// { dg-error "" } .*
};
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
class a {
private:
- a (int i);// ERROR - .*
+ a (int i);// { dg-error "" } .*
public:
a ();
void test ()
{
a *ap = new a;
- a *ap2 = new a (3);// ERROR - .*
+ a *ap2 = new a (3);// { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: Rob Hasker <hasker@sparc0a.cs.uiuc.edu>
class Top {
public:
Top() {}
- void val() {} // ERROR - private base class
+ void val() {} // { dg-error "" } private base class
};
class Derived : private Top {
class Unrelated {
Derived derived;
public:
- void oops() { derived.val(); }// ERROR - .*
+ void oops() { derived.val(); }// { dg-error "" } .*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: Gordon Joly <G.Joly@cs.ucl.ac.uk>
virtual ~A()
{}
virtual void Number(int c)
- { number = c; } // ERROR - private
+ { number = c; } // { dg-error "" } private
virtual int Number()
- { return number; } // ERROR - private
+ { return number; } // { dg-error "" } private
};
class B : private A {
// and they should not be able to do so
//
virtual void setBValue(int i)
- { if (bobject) bobject->Number(i); }// ERROR - .*
+ { if (bobject) bobject->Number(i); }// { dg-error "" } .*
virtual int getBValue()
- { if (bobject) { return bobject->Number(); } return 0; }// ERROR - .*
+ { if (bobject) { return bobject->Number(); } return 0; }// { dg-error "" } .*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// From: roland@jts.com (Roland Knight )
// Message-ID: <m0nof3E-0021ifC@jts.com
class t1 {
protected:
- int a; // ERROR - protected
+ int a; // { dg-error "" } protected
};
};
-int t3::ttt() { return a; }// ERROR - .*
+int t3::ttt() { return a; }// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed visibility
// visibility file
// rom: roland@jts.com (Roland Knight )
class A {
protected:
- int a; // ERROR - protected
+ int a; // { dg-error "" } protected
};
class B : public A {
void B::f1(A* pa) {
- pa->a = 1; // illegal but allowed by gcc// ERROR - .*
+ pa->a = 1; // illegal but allowed by gcc// { dg-error "" } .*
}
-// Build don't link:
-// Special g++ Options: -w
+// { dg-do assemble }
+// { dg-options "-w" }
// GROUPS passed vtable
// vtable file
// From: mrs@cygnus.com (Mike Stump)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed vtable
struct C1
{
+// { dg-do run }
// GROUPS passed vtable
// vtable file
// From: Pete Bevin <pete@deng.icl.co.uk>
+// { dg-do link { target i?86-*-linux* } }
+// { dg-options "-static" }
// Bug: g++ fails to instantiate operator<<.
-// Build don't run:
-// Special g++ Options: -static
-// Skip if not target: i?86-*-linux*
// libc-5.4.xx has __IO_putc in its static C library, which can conflict
// with the copy of __IO_putc in the libstdc++ library built by egcs.
-// Build don't link:
+// { dg-do assemble }
class A{
public:
enum Foo{f1,f2};
-//Build don't link:
+// { dg-do assemble }
//Based on a report by Bill Currie <bcurrie@tssc.co.nz>
struct foo {
protected:
- int x; // ERROR - candidate
+ int x; // { dg-error "" } candidate
};
struct bar {
public:
- int x(); // ERROR - candidate
+ int x(); // { dg-error "" } candidate
};
struct foobar: public foo, public bar {
foobar::foobar()
{
- func(x); // ERROR - ambiguous member access
+ func(x); // { dg-error "" } ambiguous member access
}
+// { dg-do run }
// Origin: Jeff Donner <jdonner@schedsys.com>
#include <bitset>
+// { dg-do run }
struct S{
operator bool()
{
-// Build don't link:
+// { dg-do assemble }
int i = 4;
struct S{
- char c[i]; // ERROR - size not constant
+ char c[i]; // { dg-error "" } size not constant
int h;
int foo(){
return h;
+// { dg-do run }
// Postfix expression must be evaluated even if accessing a static member.
struct S
-//Build don't link:
+// { dg-do assemble }
//In the base class list, the context of the current is used
//reported by Stephen Vavasis <vavasis@CS.Cornell.EDU>
+// { dg-do run }
//Lifetime of temporaries:
//egcs 2.92 performs cleanup for temporaries inside new expressions
//after the new is complete, not at the end of the full expression.
+// { dg-do run }
//Overload resolution should consider both declarations of func identically.
struct S{};
+// { dg-do run }
// Based on a test case by Andrew Bell <andrew.bell@bigfoot.com>
// Check for pointer-to-virtual-function calls on
// bases without virtual functions.
-// Special g++ Options: -Wno-pmf-conversions
+// { dg-do run }
+// { dg-options "-Wno-pmf-conversions" }
// Test conversion of pointers to virtual member functions to
// pointers to non-member functions.
-// Build don't link:
+// { dg-do assemble }
class A
{
public:
virtual void f(void) = 0; // pure virtual function.
- A() {f();} // ERROR - called in a constructor
- ~A() {f();} // ERROR - called in a destructor
+ A() {f();} // { dg-error "" } called in a constructor
+ ~A() {f();} // { dg-error "" } called in a destructor
};
+// { dg-do run }
// ecgs-bugs 1999-02-22 14:21, Stefan Schwarzer
// sts@ica1.uni-stuttgart.de
// this code should compile quietly
int main(){
CArray a;
- double *pa = a + 1; // gets bogus error - should convert
+ double *pa = a + 1; // { dg-bogus "" } should convert
return 0;
}
+// { dg-do run }
// egcs-bugs 999-02-22 14:26 Stefan Schwarzer
// sts@ica1.uni-stuttgart.de
// should compile and return 0
+// { dg-do run }
// ecgs-bugs 1999-02-22 14:26 Stefan Schwarzer
// sts@ica1.uni-stuttgart.de
// partial ordering problem in egcs <= 1.1.1
-// Special g++ Options: -O2 -w
+// { dg-do run }
+// { dg-options "-O2 -w" }
// egcs-bugs 1999-02-22 14:24 Stefan Schwarzer
// sts@ica1.uni-stuttgart.de
// optimizer problem in egcs <= 1.1.1
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 31 Mar 1999 <nathan@acm.org>
-// Build don't link:
+// { dg-do assemble }
// Testcase from Alexander Zvyagin <zvyagin@mx.ihep.su>
// Check implicit conversion from string constants into typedefs
+// { dg-do run }
// Check to make sure we align virtual base classes properly
class eel_base {
+// { dg-do run }
class Foo {
};
+// { dg-do assemble }
extern "C" int printf(const char *, ...);
struct VB {
class rM : public M {
};
-class D : public lM, rM { // ERROR - ambiguous function
+class D : public lM, rM { // { dg-error "" } ambiguous function
} d;
int main() {
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
struct A {
static void foo() asm("_my_routine");
+// { dg-do run }
// Compile with -S, there should be no references to
// LTRAMP in the output.
+// { dg-do assemble }
// bool test case
-// Build don't link:
void foo(int i) {
foo (true);
-// Special g++ Options:
+// { dg-do run }
+// { dg-options "" }
class A {
public:
operator bool () {
-// Build don't link:
+// { dg-do assemble }
void foo(bool arg = (1==0)) {}
+// { dg-do run }
enum E { C };
E foo() {
-// Build don't link:
-// Special g++ Options: -g -O -fkeep-inline-functions
+// { dg-do assemble }
+// { dg-options "-g -O -fkeep-inline-functions" }
class c {
public:
-// Special g++ Options: -fexceptions -w
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions -w" }
#include <typeinfo>
-// Special g++ Options: -fexceptions -w
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions -w" }
// Ensure reference handling works.
-// Special g++ Options: -fexceptions -w
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe**-*
+// { dg-do run { xfail sparc64-*-elf arm-*-pe**-* } }
+// { dg-options "-fexceptions -w" }
// Ensure that the return type of dynamic_cast is the real type.
struct B {
+// { dg-do assemble }
int main() {
int* d;
- dynamic_cast<void*>(d); // ERROR -
+ dynamic_cast<void*>(d); // { dg-error "" }
}
+// { dg-do run }
#include <stddef.h>
void *p;
+// { dg-do assemble }
#include <typeinfo>
class A {
class B : public A { };
void x (A& a) {
- const B& b1 = dynamic_cast<B&>((const A&)a); // ERROR - opps
+ const B& b1 = dynamic_cast<B&>((const A&)a); // { dg-error "" } opps
}
-// Special g++ Options: -fexceptions
+// { dg-do run }
+// { dg-options "-fexceptions" }
#include <typeinfo>
#include <stdexcept>
+// { dg-do run }
#include <typeinfo>
class Base
+// { dg-do run }
class S1 { int i; };
class S2 { int i; };
class VB {
-// Build don't link:
-// Special g++ Options: -fexceptions -O -S
+// { dg-do assemble }
+// { dg-options "-fexceptions -O -S" }
extern "C" int printf (const char *, ...);
extern "C" int atoi (const char *);
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
void foo() {
int i;
-// Special g++ Options: -fexceptions
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-fexceptions" }
struct A {
~A();
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
class MyError { };
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL arm-*-pe
+// { dg-do run { xfail arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <string>
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
class arghh {
public:
-// Build don't link:
-// Special g++ Options: -fexceptions
+// { dg-do assemble }
+// { dg-options "-fexceptions" }
struct A {
A() throw (int);
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
int err = 1;
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
int err = 1;
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
class VB {
public:
-// Special g++ Options: -fexceptions
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-fexceptions" }
class test1 {
public:
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <cstdlib>
#include <iostream>
-// Build don't link:
-// Special g++ Options: -fexceptions -Wall
+// { dg-do assemble }
+// { dg-options "-fexceptions -Wall" }
int
main() {
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
int main () {
try {
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <exception>
#include <stdlib.h>
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
int fail = 0;
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <exception>
#include <stdlib.h>
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
class MyExceptionHandler { };
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <typeinfo>
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <typeinfo>
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
int count;
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
class foo {
public:
-// Build don't link:
-// Skip if not native
-// Special g++ Options: -fexceptions -fPIC -S
+// { dg-do assemble { target native } }
+// { dg-options "-fexceptions -fPIC -S" }
main() { throw 1; }
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
int count;
-// Build don't link:
-// Special g++ Options: -fexceptions
+// { dg-do assemble }
+// { dg-options "-fexceptions" }
class Base {
public:
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf z8k-*-* arm-*-pe
+// { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <exception>
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <exception>
#include <stdlib.h>
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
main() {
try {
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <typeinfo>
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <typeinfo>
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <typeinfo>
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
int fail = 1;
class B {
-// Build don't link:
-// Special g++ Options: -fexceptions
+// { dg-do assemble }
+// { dg-options "-fexceptions" }
void foo() {
throw 1;
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
int fail = 1;
class B {
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
int fail = 0;
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
struct none { int i[50]; };
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
// prms-id: 9159
static unsigned int iCounter = 0;
+// { dg-do run }
int i;
int fail;
-// Build don't link:
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL arm-*-pe
+// { dg-do assemble { xfail arm-*-pe } }
+// { dg-options "-fexceptions" }
int atoi(const char *);
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <cstdlib>
#include <exception>
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <exception>
#include <stdlib.h>
-// Special g++ Options: -fexceptions -O9
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions -O9" }
void main1() {
throw 1;
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
class foo {
public:
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf z8k-*-* arm-*-pe
+// { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <exception>
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf z8k-*-* arm-*-pe
+// { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <exception>
-// Special g++ Options: -fexceptions -O9
+// { dg-do run }
+// { dg-options "-fexceptions -O9" }
int promote_mode (int mode, int *punsignedp)
{
-// Special g++ Options: -fexceptions -g
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions -g" }
class zeroset {
public:
-// Special g++ Options: -fexceptions
+// { dg-do assemble }
+// { dg-options "-fexceptions" }
-int main() { try { 1; } } // ERROR -
+int main() { try { 1; } } // { dg-error "" }
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
#include <exception>
#include <stdlib.h>
-// Special g++ Options: -fexceptions
+// { dg-do run }
+// { dg-options "-fexceptions" }
struct A {
A() { }
-// Build don't link:
-// Special g++ Options: -fno-exceptions
+// { dg-do assemble }
+// { dg-options "-fno-exceptions" }
class Calendar_Time {
public:
-// Build don't link:
-// Special g++ Options: -fexceptions
+// { dg-do assemble }
+// { dg-options "-fexceptions" }
struct C {
bool mem;
-// Special g++ Options: -O -funroll-loops
+// { dg-do run }
+// { dg-options "-O -funroll-loops" }
struct A {
~A();
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
extern "C" int printf(const char *, ...);
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
main() {
if (0)
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
extern "C" int printf(const char *, ...);
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
main() throw () { }
-// Build don't link:
+// { dg-do assemble }
// Warn if a enum cannot fit into a small bit-field.
enum TypeKind { ATK, BTK, CTK, DTK } ;
struct Type {
- enum TypeKind kind : 1; // WARNING -
+ enum TypeKind kind : 1; // { dg-warning "" }
void setBTK();
};
-// Build don't link:
+// { dg-do assemble }
struct gorf {
int stuff;
- void snarf(); // ERROR -
+ void snarf(); // { dg-error "" }
};
-template <class T> void gorf::snarf() { return; } // ERROR -
+template <class T> void gorf::snarf() { return; } // { dg-error "" }
+// { dg-do assemble }
class foo {
public:
void apply(foo *(foo::*memptr)()) {
- this->*memptr(); // ERROR - wrong
+ this->*memptr(); // { dg-error "" } wrong
}
};
+// { dg-do assemble }
class cb {
};
class cc {
public:
cc()
- : cb() { // ERROR -
+ : cb() { // { dg-error "" }
}
};
+// { dg-do assemble }
struct A1 {
explicit A1(int) { }
} a1(1);
void foo(A a) {
foo(a);
- foo(1); // ERROR - not allowed
+ foo(1); // { dg-error "" } not allowed
}
-// Build don't link:
+// { dg-do assemble }
class string {
public:
string bar() {
foo("hello"); // ok
foo(string(2)); // ok
- foo(2); // ERROR - no implicit conversion from int to string
- string x = 2; // ERROR - no implicit conversion from int to string
+ foo(2); // { dg-error "" } no implicit conversion from int to string
+ string x = 2; // { dg-error "" } no implicit conversion from int to string
string y(2); // ok
foo((string)2); // ok
- return 2; // ERROR - no implicit conversion from int to string
+ return 2; // { dg-error "" } no implicit conversion from int to string
}
class A : string {
+// { dg-do assemble }
int main() {
- for( {int i = 0; int j = 0;} i < 10; ++i ) ; // ERROR -
+ for( {int i = 0; int j = 0;} i < 10; ++i ) ; // { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
void foo() {
for (class C {};;)
;
- C c; // ERROR -
+ C c; // { dg-error "" }
}
void bar() {
for (enum E {num};;)
;
- E e; // ERROR -
+ E e; // { dg-error "" }
}
void bee () {
int i = 0;
- for (int fun() = 0; i != 2; ++i) { // ERROR -
+ for (int fun() = 0; i != 2; ++i) { // { dg-error "" }
}
}
-// Special g++ Options: -Wshadow
+// { dg-do assemble }
+// { dg-options "-Wshadow" }
int
-main(int i) { // WARNING - shadowed decl
- for(int i=1; i < 3; i++); // WARNING - declaration of
- for(int i=1; i < 3; i++); // WARNING - declaration of
+main(int i) { // { dg-warning "" } shadowed decl
+ for(int i=1; i < 3; i++); // { dg-warning "" } declaration of
+ for(int i=1; i < 3; i++); // { dg-warning "" } declaration of
for(int j=1; j < 3; j++);
for(int j=1; j < 3; j++);
}
-// Build don't link:
+// { dg-do assemble }
// This is a Fresco found bug.
+// { dg-do run }
class dummy { public: void operator++(void) {}
};
class dummy_000 : private virtual dummy { public: void operator++(void) {
+// { dg-do run }
int count;
extern "C" void _exit(int);
-// Build don't link:
+// { dg-do assemble }
struct Foo {
Foo (int);
+// { dg-do run }
int count = 0;
class T {
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
// Make sure the typedef name is used in name mangling, not some random
// anonymous name
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
typedef struct {
} color;
+// { dg-do run }
struct ZZ {
int p;
};
-// Build don't link:
-// Special g++ Options: -fsave-memoized
+// { dg-do assemble }
+// { dg-options "-fsave-memoized" }
#include <iostream>
-// Special g++ Options: -w
+// { dg-do run }
+// { dg-options "-w" }
class A {
public:
+// { dg-do run }
class A {
char a;
public:
+// { dg-do run }
// GROUPS passed construct-destruct
/* g++ constructs j 13 times, and destructs it once. */
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed pt coredump
template<class T> class A;
void f () { A<int> *a; }
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed
struct A { virtual void f(); };
struct B { virtual void f() ; };
+// { dg-do run }
// GROUPS passed vtable
extern "C" int printf (const char *, ...);
enum { vf_request, vf_event } want;
+// { dg-do run }
// GROUPS passed
extern "C" int printf (const char *, ...);
extern "C" void exit(int);
-// Build don't link:
-// Special g++ Options: -ansi -pedantic
+// { dg-do assemble }
+// { dg-options "-ansi -pedantic" }
// GROUPS passed
/* -ansi -pedantic-errors should catch this. */
class C {
public:
- extern inline int A() {// ERROR - .*
+ extern inline int A() {// { dg-error "" } .*
return 1;
}
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS uncaught
-int a;// ERROR - .*
-int a;// ERROR - .*
+int a;// { dg-error "" } .*
+int a;// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
// GROUPS uncaught
// Cfront bug A.3 (See Language System Release Notes for the
// SPARCompiler C++ version 3.0)
struct S1 {
- static int S1; // ERROR - uses same name 9.3
+ static int S1; // { dg-error "" } uses same name 9.3
};
struct S2 {
- union { int ii; float S2; }; // ERROR - uses same name 9.3
+ union { int ii; float S2; }; // { dg-error "" } uses same name 9.3
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS uncaught
// Cfront bug A.4 (See Language System Release Notes for the
// SPARCompiler C++ version 3.0)
assign& operator = (const assign&);
};
union U {
- assign a; // ERROR - member of union cannot have op= 9.4// ERROR - .*
+ assign a; // { dg-error "" } member of union cannot have op= 9.4// ERROR - .*
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed MI
struct S1 { };
void foobar ()
{
- p1 = p4; // ERROR - this is illegal// ERROR - .*
+ p1 = p4; // { dg-error "" } this is illegal// ERROR - .*
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed vtable
class T { public: virtual ~T() {} };
template<class P> class X : public virtual T {};
-// Build don't link:
-// Special g++ Options: -Wall -pedantic
+// { dg-do assemble }
+// { dg-options "-Wall -pedantic" }
// GROUPS passed qualifiers
class bee {
public:
- int bee::bar; // WARNING - there is an extra bee:: here
+ int bee::bar; // { dg-warning "" } there is an extra bee:: here
};
class foo {
public:
- int bee::bar; // ERROR - you cannot do this
+ int bee::bar; // { dg-error "" } you cannot do this
int me();
};
-// Build don't link:
+// { dg-do assemble }
// Here is a net bug
class ivAllocation {
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
const int ci=10, *pc = &ci, *const cpc = pc, **ppc;
int i, *p, *const cp = &i;
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
struct Foo {
char *p;
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
struct Foo {
char *p;
void m() const;
};
-void other(char &x); // ERROR - reference below
+void other(char &x); // { dg-error "" } reference below
void
Foo::m() const
{
- other(*q); // ERROR - this is bad
+ other(*q); // { dg-error "" } this is bad
}
-// Build don't link:
+// { dg-do assemble }
// make sure extern "C" friends work.
-// Build don't link:
+// { dg-do assemble }
// this probably does not have correct debugging info generated.
typedef struct Thing {
+// { dg-do run }
// InterViews (ibuild) requires this to work.
extern "C" void exit(int);
+// { dg-do run }
// On an i386, this core dumps because the reg-stack.c code is wrong, and
// pops an fp register that it thinks is not used, but it is.
+// { dg-do run }
// example from the ARM page 292 and 293
extern "C" int printf(const char *, ...);
-// Build don't link:
+// { dg-do assemble }
class ClassA {
public:
+// { dg-do assemble }
// Test to make sure &<incomplete record type> works in c++
-// Build don't link:
struct FILE {
int _flags;
-// Build don't link:
+// { dg-do assemble }
// Here is another program from the net.
class B;
-class A { // ERROR - copy ctor candidate
+class A { // { dg-error "" } copy ctor candidate
private:
- A(B *); // ERROR -
+ A(B *); // { dg-error "" }
public:
- A(long); // ERROR -
+ A(long); // { dg-error "" }
};
-A a(0); // ERROR - should be ambigious
+A a(0); // { dg-error "" } should be ambigious
-// Build don't link:
+// { dg-do assemble }
// A pointer to member function test case.
struct X
+// { dg-do run }
// Make sure we can initialize complex (MI ambiguous) vtables.
extern "C" int printf(const char *, ...);
+// { dg-do assemble }
class Parent {
public:
Parent() {}
Parent( char *s ) {}
};
-class Child : public Parent { // ERROR - called
+class Child : public Parent { // { dg-error "" } called
};
int main() {
- Child c( "String initializer" ); // ERROR - bad
+ Child c( "String initializer" ); // { dg-error "" } bad
return 0;
}
-// Build don't link:
+// { dg-do assemble }
class environment {
public:
-// Build don't link:
+// { dg-do assemble }
char HexDigit(unsigned char ch) { return ch < 'f'; }
-// Build don't link:
+// { dg-do assemble }
void shake_zero()
{
+// { dg-do run }
// A test case found by InterViews testing...
extern "C" int printf(const char *, ...);
-// Build don't link:
+// { dg-do assemble }
class path {
public:
+// { dg-do assemble }
// From reinhard@ifki50.informatik.fh-muenchen.de against gcc 2.5.0.
// shows an InterViews problem on RS6000 and i386. Doesn't happen on
// SPARC.
// From fbrowser.c.
-// Build don't link:
class test {
};
+// { dg-do assemble }
// This is a test case for the recent libg++ make check problem.
-// Build don't link:
class SubString {
public:
-// Build don't link:
+// { dg-do assemble }
// Here is another program from the net.
class BOOL {
-// Build don't link:
+// { dg-do assemble }
class X {
public:
-// Build don't link:
+// { dg-do assemble }
class foo_a {
protected:
static foo_b retval(m);
retval.bar_a(m);
for (register int i = 0; i < m; i++)
- retval(i) = (*(operator()(i)))(x); // ERROR -
+ retval(i) = (*(operator()(i)))(x); // { dg-error "" }
return retval;
}
};
void foo_e::setfoo_c() {
- bar_b(0) = func; // ERROR -
+ bar_b(0) = func; // { dg-error "" }
}
template class foo_c<foo_a>;
-// Build don't link:
+// { dg-do assemble }
class Co_obj {
public:
-// Special g++ Options:
+// { dg-do run }
+// { dg-options "" }
#include <iostream>
+// { dg-do run }
extern "C" int printf(const char *, ...);
class A {
-// Build don't link:
+// { dg-do assemble }
class X;
class B {
public:
- void setHandler(handler); // ERROR - candidate
+ void setHandler(handler); // { dg-error "" } candidate
};
void f(B* b) {
- b->setHandler(A::handlerFn); // ERROR -
+ b->setHandler(A::handlerFn); // { dg-error "" }
}
+// { dg-do run }
class B {
public:
int bi;
+// { dg-do run }
struct A {
virtual int a () { return 0; }
};
+// { dg-do run }
void *vp;
class silly {
+// { dg-do assemble }
// Message-Id: <m0lLuUK-0000fRC@nix.appli.se>
// Date: Wed, 4 Mar 92 12:50 MET
// From: niklas@appli.se (Niklas Hallqvist)
// a patch enclosed below is needed. I'm not sure if it causes any
// unanticipated side-effects, but it seem to work well for me.
-// Build don't link:
struct O {
struct M {
+// { dg-do run }
#include <stddef.h>
#include <stdlib.h>
+// { dg-do run }
int main() {
int i = ~ false;
}
-// Build don't link:
+// { dg-do assemble }
typedef void (*__sighandler_t)(int);
-// Build don't link:
+// { dg-do assemble }
class foo {
public:
+// { dg-do assemble }
// Make sure we don't dump core
-enum request { q, w, e}; // ERROR -
+enum request { q, w, e}; // { dg-error "" }
-class request { // ERROR -
+class request { // { dg-error "" }
public:
int a;
request( int b) {
-// Build don't link:
+// { dg-do assemble }
template <class T1, class T2>
struct pair {
+// { dg-do run }
#include <iostream>
#include <cstdlib>
#include <cstddef>
-// Build don't link:
-// Special g++ Options: -w -fpermissive
+// { dg-do assemble }
+// { dg-options "-w -fpermissive" }
class foo {};
class bar : foo {
-// Build don't link:
+// { dg-do assemble }
char *a="aê";
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
struct X {};
-X x = X(); // gets bogus error
+X x = X(); // { dg-bogus "" }
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
// This should compile.
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
class Base {
public:
int bar;
};
-void func(Base&); // ERROR -
+void func(Base&); // { dg-error "" }
void func2(const Derived& d) {
- func(d); // ERROR - this is bad
+ func(d); // { dg-error "" } this is bad
}
void
foo (int& a)
-{ // ERROR -
+{ // { dg-error "" }
}
int main ()
{
int b;
const int*const a = &b;
- *a = 10; // ERROR - it's const
- foo (*a); // ERROR - it's const
+ *a = 10; // { dg-error "" } it's const
+ foo (*a); // { dg-error "" } it's const
return 0;
}
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
const int ci=10, *pc = &ci, *const cpc = pc, **ppc;
int i, *p, *const cp = &i;
int main()
{
- ci = 1; // ERROR - bad
- ci++; // ERROR - bad
- *pc = 2; // ERROR - bad
- cp = &ci; // ERROR - bad
- cpc++; // ERROR - bad
- p = pc; // ERROR - bad
+ ci = 1; // { dg-error "" } bad
+ ci++; // { dg-error "" } bad
+ *pc = 2; // { dg-error "" } bad
+ cp = &ci; // { dg-error "" } bad
+ cpc++; // { dg-error "" } bad
+ p = pc; // { dg-error "" } bad
}
+// { dg-do run }
namespace Foo {
int bar() {
return 0;
+// { dg-do run }
namespace Foo {
int bar() {
return 0;
+// { dg-do run }
class Foo {
};
+// { dg-do run }
namespace {
int i = 10;
enum fish { one = 1, two = 2, red = 3, blue = 4 };
-// Build don't link:
+// { dg-do assemble }
namespace N {
struct C {
-// Build don't link:
+// { dg-do assemble }
namespace Jazz {
int horn( int h ) { return 1; }
-// Build don't link:
-// excess errors test - XFAIL xstormy16-*-*
+// { dg-do assemble { xfail xstormy16-*-* } }
#include <stdio.h>
#include <stdlib.h>
+// { dg-do run }
namespace N {
int i;
}
-int i; // ERROR -
+// { dg-do assemble }
+int i; // { dg-error "" }
-namespace i { // ERROR -
+namespace i { // { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
namespace i {
}
+// { dg-do assemble }
namespace A {
int i = 1;
}
-int j = i; // ERROR -
+int j = i; // { dg-error "" }
-// Build don't link:
+// { dg-do assemble }
namespace A {
int i = 1;
-// Build don't link:
+// { dg-do assemble }
namespace A {
int i = 1;
}
namespace B {
- int j = i; // ERROR -
+ int j = i; // { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
namespace A {
int i = 1;
+// { dg-do run }
namespace Foo {
int bar() {
return 0;
+// { dg-do run }
extern "C" int printf(const char *, ...);
void *vp;
int fail = 0;
+// { dg-do run }
// Shows a problem with the default op= not being an implementation...
class C {
-// Build don't link:
+// { dg-do assemble }
typedef struct base1 {
int x;
+// { dg-do run }
// prms-id: 10148
int fail = 1;
+// { dg-do assemble }
// prms-id: 10247
class a {
public:
- int operator++(int) { return operator()++ ; } // ERROR -
+ int operator++(int) { return operator()++ ; } // { dg-error "" }
};
-// Build don't link:
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do assemble { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
// prms-id: 10416
class not_ok {
-// Build don't link:
+// { dg-do assemble }
// prms-id: 10511
class S {
-// Special g++ Options: -Wno-pmf-conversions
+// { dg-do run }
+// { dg-options "-Wno-pmf-conversions" }
// prms-id: 10769
#define PMF2PF(PMF) ((void (*)())(PMF))
void (A::*mPtr)() = &A::f1a;
(*(void (*)(A*))PMF2PF(mPtr))(&a);
- (*(void (*)(A*))PMF2PF(f2a))(&a); // gets bogus error XFAIL *-*-*
+ (*(void (*)(A*))PMF2PF(f2a))(&a); // { dg-bogus "" "" { xfail *-*-* } }
}
int main() {
void (A::*mPtr)() = &A::f1b;
(*(void (*)(A*))PMF2PF(a.*mPtr))(&a);
- (*(void (*)(A*))PMF2PF(a.f2a))(&a); // gets bogus error XFAIL *-*-*
+ (*(void (*)(A*))PMF2PF(a.f2a))(&a); // { dg-bogus "" "" { xfail *-*-* } }
return ok != 3+3+5+5+7+7;
}
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
// prms-id: 10769
#define PMF2PF(PMF) ((void (*)())(PMF))
void A::main() {
void (B::*mPtrB)(B*);
- (*(void (*)(A*))PMF2PF(mPtrB))(&b); // ERROR -
+ (*(void (*)(A*))PMF2PF(mPtrB))(&b); // { dg-error "" }
}
int main() {
void (A::*mPtr)() = &A::f1a;
- (*(void (*)(A*))PMF2PF(mPtr))(&a); // ERROR -
+ (*(void (*)(A*))PMF2PF(mPtr))(&a); // { dg-error "" }
}
+// { dg-do run }
// prms-id: 10849
struct A
-// Build don't link:
+// { dg-do assemble }
// prms-id: 10951
inline int m1(const int& a) {
-// Build don't link:
-// Special g++ Options: -Wno-pmf-conversions
+// { dg-do assemble }
+// { dg-options "-Wno-pmf-conversions" }
// prms-id: 11012
class Foo {
+// { dg-do assemble }
// prms-id: 11110
class data;
class conatiner {
public:
virtual void* first ();
- virtual data* contents (void* i); // ERROR - candidates
+ virtual data* contents (void* i); // { dg-error "" } candidates
};
class user {
};
data* user::data1() const {
- return (_c.contents (_c.first)); // ERROR -
+ return (_c.contents (_c.first)); // { dg-error "" }
}
-// Build don't link:
-// Special g++ Options: -fexceptions -O -g
+// { dg-do assemble }
+// { dg-options "-fexceptions -O -g" }
// prms-id: 11142
class RWxmsg {
-// Special g++ Options: -O
+// { dg-do run }
+// { dg-options "-O" }
// prms-id: 11144
class Id {
-// Build don't link:
+// { dg-do assemble }
// prms-id: 11482
void *vp;
enum E { bad, ok } e;
void foo() {
- e = (E)vp; // ERROR -
+ e = (E)vp; // { dg-error "" }
}
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
// prms-id: 11667
extern "C" int printf(const char *,...);
+// { dg-do run }
// prms-id: 12306
void *ptr1, *ptr2;
+// { dg-do run }
// prms-id: 12306
// a net report of the same problem as 12306
+// { dg-do run }
// GROUPS passed pure-virt
extern "C" int printf (const char *, ...);
class Base {
+// { dg-do run }
// GROUPS passed vtable
extern "C" int printf (const char *, ...);
extern "C" void exit(int);
+// { dg-do run }
// prms-id: 16146
extern "C" int printf (const char *, ...);
+// { dg-do run }
// GROUPS vtable
extern "C" int printf (const char *, ...);
-// Build don't link:
+// { dg-do assemble }
// prms-id: 1989
#define TRUE true
List_DLS<T>::search(const T& item) const
{
for (Pix x=first(); 0 != x; next(x)) {
- if (item == operator()(x)) // ERROR - const subversion
+ if (item == operator()(x)) // { dg-error "" } const subversion
return x;
}
return 0;
T item;
List_DL<vertex<T> *> fanout;
- vertex(): item(), fanout() // gets bogus error
+ vertex(): item(), fanout() // { dg-bogus "" }
{ };
- vertex(const T& i): item(), fanout() // gets bogus error
+ vertex(const T& i): item(), fanout() // { dg-bogus "" }
{ };
};
char buf[10];
};
-extern int operator==(vertex<STRLIdentifier*>&, vertex<STRLIdentifier*>&); // ERROR - const subversion
-extern int operator==(STRLIdentifier&, STRLIdentifier&); // ERROR - fn ref in err msg
+extern int operator==(vertex<STRLIdentifier*>&, vertex<STRLIdentifier*>&); // { dg-error "" } const subversion
+extern int operator==(STRLIdentifier&, STRLIdentifier&); // { dg-error "" } fn ref in err msg
extern int x(List_DLSp<STRLIdentifier *>);
+// { dg-do run }
// prms-id: 2394
class Foo {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed infinite_loop
class A
{
public:
- A(A &); // ERROR - candidates are
+ A(A &); // { dg-error "" } candidates are
};
class B
C()
{
B b;
- A a = b;// ERROR -
+ A a = b;// { dg-error "" }
}
};
+// { dg-do assemble }
// prms-id: 2573
class X {
};
char *X::add() {
- char *f1 = (char *) &key; // ERROR -
- char *f2 = (char *) &vkey; // ERROR -
+ char *f1 = (char *) &key; // { dg-error "" }
+ char *f2 = (char *) &vkey; // { dg-error "" }
return f1;
}
+// { dg-do run }
// This is a poor test case, it is meant to ensure that function local
// statics are destroyed at the right time. See PR 2736 for details.
// prms-id: 2736
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed scope pt
class Link {
public:
-// Build don't link:
+// { dg-do assemble }
// prms-id: 2793
-void f(char&) { // ERROR - referenced by error below
- f('c'); // ERROR -
+void f(char&) { // { dg-error "" } referenced by error below
+ f('c'); // { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed
template<class T>
class List
+// { dg-do run }
// prms-id: 2846
extern "C" int printf(const char *, ...);
+// { dg-do run }
// Shows that problem of initializing one object's vtable pointer from
// another object's vtable pointer when doing a default copy of it
// and the vtable pointer involved is the main one.
+// { dg-do run }
// Shows that problem of initializing one object's secondary base from
// another object via a user defined copy constructor for that base,
// the pointer for the secondary vtable is not set after implicit
-// Build don't link:
-// Special g++ Options: -Wcast-qual
+// { dg-do assemble }
+// { dg-options "-Wcast-qual" }
// prms-id: 2855
class Ctest {
int main()
{
Ctest obj;
- char* temp = (char *)obj; // WARNING -
+ char* temp = (char *)obj; // { dg-warning "" }
temp[0] = '\0';
}
+// { dg-do run }
// prms-id: 2960
extern "C" int printf(const char *, ...);
+// { dg-do run }
// prms-id: 3041
class A {
+// { dg-do assemble }
// A new problem with my pointer to member function work.
-// Build don't link:
// prms-id: 3060
class Foo
operator int ();
};
-int Foo::operator int() { return x; } // WARNING - can't specify return type
+int Foo::operator int() { return x; } // { dg-warning "" } can't specify return type
Foo foo(10, 11);
+// { dg-do run }
// This is a test case to make sure the explicit cast on a pointer to
// a member function works ok.
// prms-id: 3060
+// { dg-do run }
// prms-id: 3068
extern "C" int printf(const char *, ...);
-// Build don't link:
+// { dg-do assemble }
// Caused an Internal Compiler Error. Works now.
// prms-id: 3070
+// { dg-do run }
// prms-id: 3139
extern "C" int printf(const char *, ...);
+// { dg-do assemble }
// Make sure we can initialize a reference to a templated type, that
// requires a conversion from a derived type to a base type.
-// Build don't link:
// prms-id: 3524
struct cc2Vector
+// { dg-do assemble }
// Make sure we can cast to a templated type, that requires a conversion by
// constructor, from a derived type to a base type.
-// Build don't link:
// prms-id: 3524
template <class T>
+// { dg-do assemble }
// Make sure we can cast to a templated type, that requires a conversion by
// constructor, from a non-aggregate type.
-// Build don't link:
// prms-id: 3524
template <class T>
-// Build don't link:
+// { dg-do assemble }
// This tests for the compiler_error in binfo_value.
// prms-id: 3538
{};
class cc_CircleHdl : public virtual ccHandleBase, public ccObjectInfo
-{ // WARNING -
+{ // { dg-warning "" }
public:
virtual const ccObjectInfo& ri (int);
};
-// Build don't link:
+// { dg-do assemble }
// prms-id: 3538
// This tests for an ambiguous conversion of the this pointer (going
{};
class cc_CircleHdl : public virtual ccHandleBase, public ccObjectInfo
-{ // WARNING -
+{ // { dg-warning "" }
public:
virtual const ccObjectInfo& repInvariant (int);
};
+// { dg-do run }
// prms-id: 3570
extern "C" int printf(const char *, ...);
+// { dg-do run }
// prms-id: 3579
extern "C" int printf(const char *, ...);
+// { dg-do run }
// prms-id: 3708
extern "C" int printf (const char *, ...);
+// { dg-do run }
// prms-id: 3708
extern "C" int printf (const char *, ...);
+// { dg-do run }
// prms-id: 3708
extern "C" int printf (const char *, ...);
-// Build don't link:
+// { dg-do assemble }
// prms-id: 3764
class Menu;
+// { dg-do assemble }
// prms-id: 3836
-void f(int &i) { // ERROR - ref line
+void f(int &i) { // { dg-error "" } ref line
i = 10;
}
{
int i=1, j=2;
f(i);
- f((int)j); // ERROR - passing in to non-const
+ f((int)j); // { dg-error "" } passing in to non-const
if (j != 2)
return 1;
}
+// { dg-do run }
// prms-id: 4068
struct A {
+// { dg-do run }
// prms-id: 4104
template <class T>
+// { dg-do assemble }
+// { dg-options "-Wall -ansi -pedantic-errors" }
// This error happens because lvalue is not done well in the C++ front-end.
// NOPs should be lvalues if their arguments are.
// NON_LVALUE_EXPRs shouldn't be.
-// Special g++ Options: -Wall -ansi -pedantic-errors
-// Build don't link:
// prms-id: 4173
enum TypeKind {
int
main() {
a.kind = b.kind = c;
- (a.kind = c) = b.kind; // gets bogus error
+ (a.kind = c) = b.kind; // { dg-bogus "" }
}
-// Build don't link:
+// { dg-do assemble }
// prms-id: 418
class Base {
int bar;
};
-void func(Base&); // ERROR - referenced by error below
+void func(Base&); // { dg-error "" } referenced by error below
void func2(const Derived& d) {
- func(d); // ERROR - should be error because of const
+ func(d); // { dg-error "" } should be error because of const
}
+// { dg-do assemble }
// This showed a problem with default op=
-// Build don't link:
// prms-id: 4238
struct sigcontext {
int sc_wbuf[31][25];
-}; // gets bogus error - default op= seems broken
+}; // { dg-bogus "" } default op= seems broken
+// { dg-do run }
// prms-id: 4246
extern "C" void abort ();
+// { dg-do assemble }
// prms-id: 4263
enum OT {A_type, B_Type};
enum AT {A, B};
/* These are not ok. */
-OT t = A; // ERROR -
-OT e2 = 1; // ERROR -
-OT e3 = 1.1; // ERROR -
+OT t = A; // { dg-error "" }
+OT e2 = 1; // { dg-error "" }
+OT e3 = 1.1; // { dg-error "" }
/* These are ok. */
int i = A;
-// Build don't link:
+// { dg-do assemble }
// prms-id: 438
class D;
class D
{
public:
- void a(C& b); // ERROR - referenced below
+ void a(C& b); // { dg-error "" } referenced below
};
void C::test() const
{
D d;
- d.a(*this); // ERROR - *this is const, so should get error
+ d.a(*this); // { dg-error "" } *this is const, so should get error
}
-// Build don't link:
+// { dg-do assemble }
// prms-id: 4484
class A {
+// { dg-do run }
// prms-id: 4511
int bad;
-// Build don't link:
+// { dg-do assemble }
// prms-id: 4619
int main() {
+// { dg-do run }
// prms-id: 4623
class base {
+// { dg-do run }
// prms-id: 4667
int counter = 0;
-// Build don't link:
+// { dg-do assemble }
// prms-id: 4671
class ccUnwind {
-// Build don't link:
+// { dg-do assemble }
// prms-id: 4677
struct A {
A(double d) { }
};
-struct B { B(A) { } } bad = 1; // ERROR -
+struct B { B(A) { } } bad = 1; // { dg-error "" }
B good (1);
-// Build don't link:
+// { dg-do assemble }
// prms-id: 4693
class a {
+// { dg-do run }
// prms-id: 4736
int did_fail = 1;
+// { dg-do run }
// prms-id: 4736
class Rep {
+// { dg-do run }
// prms-id: 4736
int did_fail;
-// Build don't link:
-// Skip if not native
-// Special g++ Options: -fpic -pedantic-errors -S
+// { dg-do assemble { target native } }
+// { dg-options "-fpic -pedantic-errors -S" }
// prms-id: 4750
extern const int FRAME_VEC_MAX;
+// { dg-do run }
// prms-id: 5469
int count;
+// { dg-do run }
// prms-id: 5469
int count;
+// { dg-do run }
// prms-id: 5571
int err = 0;
+// { dg-do run }
// prms-id: 5611
int main(void)
+// { dg-do run }
// prms-id: 5673
class A {
+// { dg-do run }
// prms-id: 5718
class Base {
testFunct(Derived * arg) {
Mixin temp;
- (Mixin &)(*arg) = temp; // gets bogus error
+ (Mixin &)(*arg) = temp; // { dg-bogus "" }
}
-// Build don't link:
+// { dg-do assemble }
// prms-id: 5793
class temp_string {
+// { dg-do run }
// prms-id: 5840
class Signal {
-// Special g++ Options: -ansi
+// { dg-do run }
+// { dg-options "-ansi" }
// prms-id: 5958
class A { };
-// Special g++ Options:
+// { dg-do run }
+// { dg-options "" }
// prms-id: 6004
class A {
-// Build don't link:
-// Special g++ Options: -fexceptions -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-fexceptions -pedantic-errors" }
// prms-id: 6058
-void bar(struct s1 { } a) { (void)a; } // ERROR -
+void bar(struct s1 { } a) { (void)a; } // { dg-error "" }
struct s2*fooey()
{
try {
- static_cast<struct s3 { } *>(0); // ERROR -
- const_cast<struct s4 { } *>((s4*)0); // ERROR -
- reinterpret_cast<struct s5 { } *>((s3*)0); // ERROR -
- dynamic_cast<struct s6 { } *>((s6*)0); // ERROR -
- (struct s7 { } *)(int*)0xffedec; // ERROR -
- } catch (struct s8 { } s) { // ERROR -
+ static_cast<struct s3 { } *>(0); // { dg-error "" }
+ const_cast<struct s4 { } *>((s4*)0); // { dg-error "" }
+ reinterpret_cast<struct s5 { } *>((s3*)0); // { dg-error "" }
+ dynamic_cast<struct s6 { } *>((s6*)0); // { dg-error "" }
+ (struct s7 { } *)(int*)0xffedec; // { dg-error "" }
+ } catch (struct s8 { } s) { // { dg-error "" }
}
return 0;
}
-// Build don't link:
+// { dg-do assemble }
// prms-id: 6149
-int a[3 - sizeof(double)]; // ERROR -
+int a[3 - sizeof(double)]; // { dg-error "" }
+// { dg-do run }
// prms-id: 6311
struct Foo {
+// { dg-do assemble }
+// { dg-options "-Wno-deprecated -Wreturn-type" }
// GROUPS passed i960
/*
Bug Id: bnr
*/
-// Special g++ Options: -Wno-deprecated -Wreturn-type
extern "C"
{
{
foo f;
printf ("returning 1\n");
-} // WARNING - control reaches end
+} // { dg-warning "" } control reaches end
int
warn_return_arg (int arg)
foo f;
printf ("returning %d\n", arg);
arg;
-} // WARNING - control reaches end
+} // { dg-warning "" } control reaches end
int
warn_return_sum (int x, int y)
foo f;
printf ("returning %d+%d\n", x, y);
x + y;
-} // WARNING - control reaches end
+} // { dg-warning "" } control reaches end
foo
warn_return_foo ()
{
foo f;
printf ("returning foo\n");
-} // WARNING - control reaches end
+} // { dg-warning "" } control reaches end
foo
warn_foo_parm_returns_foo (foo f)
{
f;
-} // WARNING - control reaches end
+} // { dg-warning "" } control reaches end
main ()
-{ // WARNING - no type
+{ // { dg-warning "" } no type
int ii = return_1 ();
if (ii != 1)
abort_because ("wrong value returned");
-// Build don't link:
+// { dg-do assemble }
// prms-id: 6578
struct A {
+// { dg-do run }
// prms-id: 658
#include <iostream>
+// { dg-do run }
// prms-id: 6610
// There is a bug in vtable thunks with multiple/virtual inheritance.
+// { dg-do run }
// prms-id: 6610
int fail = 1;
+// { dg-do run }
// prms-id: 6611
class COMPLEX {
-// Build don't link:
+// { dg-do assemble }
// prms-id: 6746
class call_trace {
-// Build don't link:
+// { dg-do assemble }
// prms-id: 6901
void green() {
+// { dg-do run }
// prms-id: 6927
class Object {
-// Special g++ Options: -Wno-deprecated
+// { dg-do assemble }
+// { dg-options "-Wno-deprecated" }
// prms-id: 700
//# 1 "../../../../libg++/etc/benchmarks/dhrystone.cc"
inline int& operator = (int& a, const Int & b)
-{ a = b.Int::val(); return a;} // WARNING -
+{ a = b.Int::val(); return a;} // { dg-warning "" }
inline int& operator += (int& a, const Int & b)
{ a += b.Int::val(); return a; }
inline int& operator -= (int& a, const Int & b)
//# 289 "../../../../libg++/etc/benchmarks/Int.h"
-inline Int operator - (const Int & a) return r(a) // ERROR -
-{ r.negate(); } // ERROR -
-inline Int operator ~ (const Int & a) return r(a) // ERROR -
-{ r.complement(); } // ERROR -
-
-inline Int operator + (const Int & a, const Int & b) return r(a) // ERROR -
-{ r += b.Int::val(); } // ERROR -
-inline Int operator - (const Int & a, const Int & b) return r(a) // ERROR -
-{ r -= b.Int::val(); } // ERROR -
-inline Int operator * (const Int & a, const Int & b) return r(a) // ERROR -
-{ r *= b.Int::val(); } // ERROR -
-inline Int operator / (const Int & a, const Int & b) return r(a) // ERROR -
-{ r /= b.Int::val(); } // ERROR -
-inline Int operator % (const Int & a, const Int & b) return r(a) // ERROR -
-{ r %= b.Int::val(); } // ERROR -
-inline Int operator << (const Int & a, const Int & b) return r(a) // ERROR -
-{ r <<= b.Int::val(); } // ERROR -
-inline Int operator >> (const Int & a, const Int & b) return r(a) // ERROR -
-{ r >>= b.Int::val(); } // ERROR -
-inline Int operator & (const Int & a, const Int & b) return r(a) // ERROR -
-{ r &= b.Int::val(); } // ERROR -
-inline Int operator | (const Int & a, const Int & b) return r(a) // ERROR -
-{ r |= b.Int::val(); } // ERROR -
-inline Int operator ^ (const Int & a, const Int & b) return r(a) // ERROR -
-{ r ^= b.Int::val(); } // ERROR -
-
-inline Int operator + (const Int & a, const int b) return r(a) // ERROR -
-{ r += b; } // ERROR -
-inline Int operator - (const Int & a, const int b) return r(a) // ERROR -
-{ r -= b; } // ERROR -
-inline Int operator * (const Int & a, const int b) return r(a) // ERROR -
-{ r *= b; } // ERROR -
-inline Int operator / (const Int & a, const int b) return r(a) // ERROR -
-{ r /= b; } // ERROR -
-inline Int operator % (const Int & a, const int b) return r(a) // ERROR -
-{ r %= b; } // ERROR -
-inline Int operator << (const Int & a, const int b) return r(a) // ERROR -
-{ r <<= b; } // ERROR -
-inline Int operator >> (const Int & a, const int b) return r(a) // ERROR -
-{ r >>= b; } // ERROR -
-inline Int operator & (const Int & a, const int b) return r(a) // ERROR -
-{ r &= b; } // ERROR -
-inline Int operator | (const Int & a, const int b) return r(a) // ERROR -
-{ r |= b; } // ERROR -
-inline Int operator ^ (const Int & a, const int b) return r(a) // ERROR -
-{ r ^= b; } // ERROR -
-
-inline Int operator + (const int a, const Int & b) return r(a) // ERROR -
-{ r += b.Int::val(); } // ERROR -
-inline Int operator - (const int a, const Int & b) return r(a) // ERROR -
-{ r -= b.Int::val(); } // ERROR -
-inline Int operator * (const int a, const Int & b) return r(a) // ERROR -
-{ r *= b.Int::val(); } // ERROR -
-inline Int operator / (const int a, const Int & b) return r(a) // ERROR -
-{ r /= b.Int::val(); } // ERROR -
-inline Int operator % (const int a, const Int & b) return r(a) // ERROR -
-{ r %= b.Int::val(); } // ERROR -
-inline Int operator << (const int a, const Int & b) return r(a) // ERROR -
-{ r <<= b.Int::val(); } // ERROR -
-inline Int operator >> (const int a, const Int & b) return r(a) // ERROR -
-{ r >>= b.Int::val(); } // ERROR -
-inline Int operator & (const int a, const Int & b) return r(a) // ERROR -
-{ r &= b.Int::val(); } // ERROR -
-inline Int operator | (const int a, const Int & b) return r(a) // ERROR -
-{ r |= b.Int::val(); } // ERROR -
-inline Int operator ^ (const int a, const Int & b) return r(a) // ERROR -
-{ r ^= b.Int::val(); } // ERROR -
+inline Int operator - (const Int & a) return r(a) // { dg-error "" }
+{ r.negate(); } // { dg-error "" }
+inline Int operator ~ (const Int & a) return r(a) // { dg-error "" }
+{ r.complement(); } // { dg-error "" }
+
+inline Int operator + (const Int & a, const Int & b) return r(a) // { dg-error "" }
+{ r += b.Int::val(); } // { dg-error "" }
+inline Int operator - (const Int & a, const Int & b) return r(a) // { dg-error "" }
+{ r -= b.Int::val(); } // { dg-error "" }
+inline Int operator * (const Int & a, const Int & b) return r(a) // { dg-error "" }
+{ r *= b.Int::val(); } // { dg-error "" }
+inline Int operator / (const Int & a, const Int & b) return r(a) // { dg-error "" }
+{ r /= b.Int::val(); } // { dg-error "" }
+inline Int operator % (const Int & a, const Int & b) return r(a) // { dg-error "" }
+{ r %= b.Int::val(); } // { dg-error "" }
+inline Int operator << (const Int & a, const Int & b) return r(a) // { dg-error "" }
+{ r <<= b.Int::val(); } // { dg-error "" }
+inline Int operator >> (const Int & a, const Int & b) return r(a) // { dg-error "" }
+{ r >>= b.Int::val(); } // { dg-error "" }
+inline Int operator & (const Int & a, const Int & b) return r(a) // { dg-error "" }
+{ r &= b.Int::val(); } // { dg-error "" }
+inline Int operator | (const Int & a, const Int & b) return r(a) // { dg-error "" }
+{ r |= b.Int::val(); } // { dg-error "" }
+inline Int operator ^ (const Int & a, const Int & b) return r(a) // { dg-error "" }
+{ r ^= b.Int::val(); } // { dg-error "" }
+
+inline Int operator + (const Int & a, const int b) return r(a) // { dg-error "" }
+{ r += b; } // { dg-error "" }
+inline Int operator - (const Int & a, const int b) return r(a) // { dg-error "" }
+{ r -= b; } // { dg-error "" }
+inline Int operator * (const Int & a, const int b) return r(a) // { dg-error "" }
+{ r *= b; } // { dg-error "" }
+inline Int operator / (const Int & a, const int b) return r(a) // { dg-error "" }
+{ r /= b; } // { dg-error "" }
+inline Int operator % (const Int & a, const int b) return r(a) // { dg-error "" }
+{ r %= b; } // { dg-error "" }
+inline Int operator << (const Int & a, const int b) return r(a) // { dg-error "" }
+{ r <<= b; } // { dg-error "" }
+inline Int operator >> (const Int & a, const int b) return r(a) // { dg-error "" }
+{ r >>= b; } // { dg-error "" }
+inline Int operator & (const Int & a, const int b) return r(a) // { dg-error "" }
+{ r &= b; } // { dg-error "" }
+inline Int operator | (const Int & a, const int b) return r(a) // { dg-error "" }
+{ r |= b; } // { dg-error "" }
+inline Int operator ^ (const Int & a, const int b) return r(a) // { dg-error "" }
+{ r ^= b; } // { dg-error "" }
+
+inline Int operator + (const int a, const Int & b) return r(a) // { dg-error "" }
+{ r += b.Int::val(); } // { dg-error "" }
+inline Int operator - (const int a, const Int & b) return r(a) // { dg-error "" }
+{ r -= b.Int::val(); } // { dg-error "" }
+inline Int operator * (const int a, const Int & b) return r(a) // { dg-error "" }
+{ r *= b.Int::val(); } // { dg-error "" }
+inline Int operator / (const int a, const Int & b) return r(a) // { dg-error "" }
+{ r /= b.Int::val(); } // { dg-error "" }
+inline Int operator % (const int a, const Int & b) return r(a) // { dg-error "" }
+{ r %= b.Int::val(); } // { dg-error "" }
+inline Int operator << (const int a, const Int & b) return r(a) // { dg-error "" }
+{ r <<= b.Int::val(); } // { dg-error "" }
+inline Int operator >> (const int a, const Int & b) return r(a) // { dg-error "" }
+{ r >>= b.Int::val(); } // { dg-error "" }
+inline Int operator & (const int a, const Int & b) return r(a) // { dg-error "" }
+{ r &= b.Int::val(); } // { dg-error "" }
+inline Int operator | (const int a, const Int & b) return r(a) // { dg-error "" }
+{ r |= b.Int::val(); } // { dg-error "" }
+inline Int operator ^ (const int a, const Int & b) return r(a) // { dg-error "" }
+{ r ^= b.Int::val(); } // { dg-error "" }
inline char& operator = (char& a, const Char & b)
-{ a = b.Char::val(); return a;} // WARNING -
+{ a = b.Char::val(); return a;} // { dg-warning "" }
inline char& operator += (char& a, const Char & b)
{ a += b.Char::val(); return a; }
inline char& operator -= (char& a, const Char & b)
//# 291 "../../../../libg++/etc/benchmarks/Char.h"
-inline Char operator - (const Char & a) return r(a) // ERROR -
-{ r.negate(); } // ERROR -
-inline Char operator ~ (const Char & a) return r(a) // ERROR -
-{ r.complement(); } // ERROR -
-
-inline Char operator + (const Char & a, const Char & b) return r(a) // ERROR -
-{ r += b.Char::val(); } // ERROR -
-inline Char operator - (const Char & a, const Char & b) return r(a) // ERROR -
-{ r -= b.Char::val(); } // ERROR -
-inline Char operator * (const Char & a, const Char & b) return r(a) // ERROR -
-{ r *= b.Char::val(); } // ERROR -
-inline Char operator / (const Char & a, const Char & b) return r(a) // ERROR -
-{ r /= b.Char::val(); } // ERROR -
-inline Char operator % (const Char & a, const Char & b) return r(a) // ERROR -
-{ r %= b.Char::val(); } // ERROR -
-inline Char operator << (const Char & a, const Char & b) return r(a) // ERROR -
-{ r <<= b.Char::val(); } // ERROR -
-inline Char operator >> (const Char & a, const Char & b) return r(a) // ERROR -
-{ r >>= b.Char::val(); } // ERROR -
-inline Char operator & (const Char & a, const Char & b) return r(a) // ERROR -
-{ r &= b.Char::val(); } // ERROR -
-inline Char operator | (const Char & a, const Char & b) return r(a) // ERROR -
-{ r |= b.Char::val(); } // ERROR -
-inline Char operator ^ (const Char & a, const Char & b) return r(a) // ERROR -
-{ r ^= b.Char::val(); } // ERROR -
-
-inline Char operator + (const Char & a, const char b) return r(a) // ERROR -
-{ r += b; } // ERROR -
-inline Char operator - (const Char & a, const char b) return r(a) // ERROR -
-{ r -= b; } // ERROR -
-inline Char operator * (const Char & a, const char b) return r(a) // ERROR -
-{ r *= b; } // ERROR -
-inline Char operator / (const Char & a, const char b) return r(a) // ERROR -
-{ r /= b; } // ERROR -
-inline Char operator % (const Char & a, const char b) return r(a) // ERROR -
-{ r %= b; } // ERROR -
-inline Char operator << (const Char & a, const char b) return r(a) // ERROR -
-{ r <<= b; } // ERROR -
-inline Char operator >> (const Char & a, const char b) return r(a) // ERROR -
-{ r >>= b; } // ERROR -
-inline Char operator & (const Char & a, const char b) return r(a) // ERROR -
-{ r &= b; } // ERROR -
-inline Char operator | (const Char & a, const char b) return r(a) // ERROR -
-{ r |= b; } // ERROR -
-inline Char operator ^ (const Char & a, const char b) return r(a) // ERROR -
-{ r ^= b; } // ERROR -
-
-inline Char operator + (const char a, const Char & b) return r(a) // ERROR -
-{ r += b.Char::val(); } // ERROR -
-inline Char operator - (const char a, const Char & b) return r(a) // ERROR -
-{ r -= b.Char::val(); } // ERROR -
-inline Char operator * (const char a, const Char & b) return r(a) // ERROR -
-{ r *= b.Char::val(); } // ERROR -
-inline Char operator / (const char a, const Char & b) return r(a) // ERROR -
-{ r /= b.Char::val(); } // ERROR -
-inline Char operator % (const char a, const Char & b) return r(a) // ERROR -
-{ r %= b.Char::val(); } // ERROR -
-inline Char operator << (const char a, const Char & b) return r(a) // ERROR -
-{ r <<= b.Char::val(); } // ERROR -
-inline Char operator >> (const char a, const Char & b) return r(a) // ERROR -
-{ r >>= b.Char::val(); } // ERROR -
-inline Char operator & (const char a, const Char & b) return r(a) // ERROR -
-{ r &= b.Char::val(); } // ERROR -
-inline Char operator | (const char a, const Char & b) return r(a) // ERROR -
-{ r |= b.Char::val(); } // ERROR -
-inline Char operator ^ (const char a, const Char & b) return r(a) // ERROR -
-{ r ^= b.Char::val(); } // ERROR -
+inline Char operator - (const Char & a) return r(a) // { dg-error "" }
+{ r.negate(); } // { dg-error "" }
+inline Char operator ~ (const Char & a) return r(a) // { dg-error "" }
+{ r.complement(); } // { dg-error "" }
+
+inline Char operator + (const Char & a, const Char & b) return r(a) // { dg-error "" }
+{ r += b.Char::val(); } // { dg-error "" }
+inline Char operator - (const Char & a, const Char & b) return r(a) // { dg-error "" }
+{ r -= b.Char::val(); } // { dg-error "" }
+inline Char operator * (const Char & a, const Char & b) return r(a) // { dg-error "" }
+{ r *= b.Char::val(); } // { dg-error "" }
+inline Char operator / (const Char & a, const Char & b) return r(a) // { dg-error "" }
+{ r /= b.Char::val(); } // { dg-error "" }
+inline Char operator % (const Char & a, const Char & b) return r(a) // { dg-error "" }
+{ r %= b.Char::val(); } // { dg-error "" }
+inline Char operator << (const Char & a, const Char & b) return r(a) // { dg-error "" }
+{ r <<= b.Char::val(); } // { dg-error "" }
+inline Char operator >> (const Char & a, const Char & b) return r(a) // { dg-error "" }
+{ r >>= b.Char::val(); } // { dg-error "" }
+inline Char operator & (const Char & a, const Char & b) return r(a) // { dg-error "" }
+{ r &= b.Char::val(); } // { dg-error "" }
+inline Char operator | (const Char & a, const Char & b) return r(a) // { dg-error "" }
+{ r |= b.Char::val(); } // { dg-error "" }
+inline Char operator ^ (const Char & a, const Char & b) return r(a) // { dg-error "" }
+{ r ^= b.Char::val(); } // { dg-error "" }
+
+inline Char operator + (const Char & a, const char b) return r(a) // { dg-error "" }
+{ r += b; } // { dg-error "" }
+inline Char operator - (const Char & a, const char b) return r(a) // { dg-error "" }
+{ r -= b; } // { dg-error "" }
+inline Char operator * (const Char & a, const char b) return r(a) // { dg-error "" }
+{ r *= b; } // { dg-error "" }
+inline Char operator / (const Char & a, const char b) return r(a) // { dg-error "" }
+{ r /= b; } // { dg-error "" }
+inline Char operator % (const Char & a, const char b) return r(a) // { dg-error "" }
+{ r %= b; } // { dg-error "" }
+inline Char operator << (const Char & a, const char b) return r(a) // { dg-error "" }
+{ r <<= b; } // { dg-error "" }
+inline Char operator >> (const Char & a, const char b) return r(a) // { dg-error "" }
+{ r >>= b; } // { dg-error "" }
+inline Char operator & (const Char & a, const char b) return r(a) // { dg-error "" }
+{ r &= b; } // { dg-error "" }
+inline Char operator | (const Char & a, const char b) return r(a) // { dg-error "" }
+{ r |= b; } // { dg-error "" }
+inline Char operator ^ (const Char & a, const char b) return r(a) // { dg-error "" }
+{ r ^= b; } // { dg-error "" }
+
+inline Char operator + (const char a, const Char & b) return r(a) // { dg-error "" }
+{ r += b.Char::val(); } // { dg-error "" }
+inline Char operator - (const char a, const Char & b) return r(a) // { dg-error "" }
+{ r -= b.Char::val(); } // { dg-error "" }
+inline Char operator * (const char a, const Char & b) return r(a) // { dg-error "" }
+{ r *= b.Char::val(); } // { dg-error "" }
+inline Char operator / (const char a, const Char & b) return r(a) // { dg-error "" }
+{ r /= b.Char::val(); } // { dg-error "" }
+inline Char operator % (const char a, const Char & b) return r(a) // { dg-error "" }
+{ r %= b.Char::val(); } // { dg-error "" }
+inline Char operator << (const char a, const Char & b) return r(a) // { dg-error "" }
+{ r <<= b.Char::val(); } // { dg-error "" }
+inline Char operator >> (const char a, const Char & b) return r(a) // { dg-error "" }
+{ r >>= b.Char::val(); } // { dg-error "" }
+inline Char operator & (const char a, const Char & b) return r(a) // { dg-error "" }
+{ r &= b.Char::val(); } // { dg-error "" }
+inline Char operator | (const char a, const Char & b) return r(a) // { dg-error "" }
+{ r |= b.Char::val(); } // { dg-error "" }
+inline Char operator ^ (const char a, const Char & b) return r(a) // { dg-error "" }
+{ r ^= b.Char::val(); } // { dg-error "" }
-// Build don't link:
+// { dg-do assemble }
// prms-id: 701
extern "C"
void Munge(int& x)
-{ // ERROR - referenced below
+{ // { dg-error "" } referenced below
x = 2;
}
void
A::Safe() const
{
- Munge(i); // ERROR - should not be able to modify a const object
+ Munge(i); // { dg-error "" } should not be able to modify a const object
}
int main()
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed delete
/*
Bug Id:
+// { dg-do run }
// prms-id: 7180
class String {
+// { dg-do run { xfail *-*-* } }
// I hate this type of test case. I'm not sure how to code it better.
// See the PR for what this tests.
// prms-id: 7325
-// execution test - XFAIL *-*-*
int fail = 0;
-// Build don't link:
+// { dg-do assemble }
// prms-id: 7476
class HeapTracked {
void HeapTracked::isObjectAllocation(const HeapTracked *ptr)
{
const_cast<void*>(dynamic_cast<const void*>(ptr));
- dynamic_cast<void*>(ptr); // ERROR -
+ dynamic_cast<void*>(ptr); // { dg-error "" }
}
+// { dg-do run }
// It checks to see if you can define your own global new operator.
// prms-id: 755
+// { dg-do run }
// It checks to see if you can define your own global delete operator.
// prms-id: 755
-// Build don't link:
+// { dg-do assemble }
// prms-id: 7626
int fail;
+// { dg-do assemble }
// prms-id: 7635
class DaycountBasis {
mutable const int * p;
- mutable int * const q; // ERROR -
+ mutable int * const q; // { dg-error "" }
};
+// { dg-do run }
// prms-id: 7651
int fail = 0;
+// { dg-do run }
// prms-id: 783
extern "C" int printf (const char *, ...);
+// { dg-do run }
// Copying into an object directly is a lose according to tiemann.
// Deleting an object many times is a lose.
// prms-id: 783
+// { dg-do run }
// This one check for objects being destroyed twice. The bug it is
// looking for is the extra dtor call on C() even though it is never
// built.
-// Build don't link:
-// Special g++ Options: -w
+// { dg-do assemble }
+// { dg-options "-w" }
// prms-id: 784
//# 1 "GctSymbol.GctSymbol.CHMap.cc"
-inline String operator + (const String& x, const String& y) return r; // ERROR -
+inline String operator + (const String& x, const String& y) return r; // { dg-error "" }
{
- cat(x, y, r); // ERROR -
+ cat(x, y, r); // { dg-error "" }
}
-inline String operator + (const String& x, const SubString& y) return r; // ERROR -
+inline String operator + (const String& x, const SubString& y) return r; // { dg-error "" }
{
- cat(x, y, r); // ERROR -
+ cat(x, y, r); // { dg-error "" }
}
-inline String operator + (const String& x, const char* y) return r; // ERROR -
+inline String operator + (const String& x, const char* y) return r; // { dg-error "" }
{
- cat(x, y, r); // ERROR -
+ cat(x, y, r); // { dg-error "" }
}
-inline String operator + (const String& x, char y) return r; // ERROR -
+inline String operator + (const String& x, char y) return r; // { dg-error "" }
{
- cat(x, y, r); // ERROR -
+ cat(x, y, r); // { dg-error "" }
}
-inline String operator + (const SubString& x, const String& y) return r; // ERROR -
+inline String operator + (const SubString& x, const String& y) return r; // { dg-error "" }
{
- cat(x, y, r); // ERROR -
+ cat(x, y, r); // { dg-error "" }
}
-inline String operator + (const SubString& x, const SubString& y) return r; // ERROR -
+inline String operator + (const SubString& x, const SubString& y) return r; // { dg-error "" }
{
- cat(x, y, r); // ERROR -
+ cat(x, y, r); // { dg-error "" }
}
-inline String operator + (const SubString& x, const char* y) return r; // ERROR -
+inline String operator + (const SubString& x, const char* y) return r; // { dg-error "" }
{
- cat(x, y, r); // ERROR -
+ cat(x, y, r); // { dg-error "" }
}
-inline String operator + (const SubString& x, char y) return r; // ERROR -
+inline String operator + (const SubString& x, char y) return r; // { dg-error "" }
{
- cat(x, y, r); // ERROR -
+ cat(x, y, r); // { dg-error "" }
}
-inline String operator + (const char* x, const String& y) return r; // ERROR -
+inline String operator + (const char* x, const String& y) return r; // { dg-error "" }
{
- cat(x, y, r); // ERROR -
+ cat(x, y, r); // { dg-error "" }
}
-inline String operator + (const char* x, const SubString& y) return r; // ERROR -
+inline String operator + (const char* x, const SubString& y) return r; // { dg-error "" }
{
- cat(x, y, r); // ERROR -
+ cat(x, y, r); // { dg-error "" }
}
-inline String reverse(const String& x) return r; // ERROR -
+inline String reverse(const String& x) return r; // { dg-error "" }
{
- r.rep = Sreverse(x.rep, r.rep); // ERROR -
+ r.rep = Sreverse(x.rep, r.rep); // { dg-error "" }
}
-inline String upcase(const String& x) return r; // ERROR -
+inline String upcase(const String& x) return r; // { dg-error "" }
{
- r.rep = Supcase(x.rep, r.rep); // ERROR -
+ r.rep = Supcase(x.rep, r.rep); // { dg-error "" }
}
-inline String downcase(const String& x) return r; // ERROR -
+inline String downcase(const String& x) return r; // { dg-error "" }
{
- r.rep = Sdowncase(x.rep, r.rep); // ERROR -
+ r.rep = Sdowncase(x.rep, r.rep); // { dg-error "" }
}
-inline String capitalize(const String& x) return r; // ERROR -
+inline String capitalize(const String& x) return r; // { dg-error "" }
{
- r.rep = Scapitalize(x.rep, r.rep); // ERROR -
+ r.rep = Scapitalize(x.rep, r.rep); // { dg-error "" }
}
//# 883 "/projects/gnu-cygnus/gnu-cygnus-8/common/g++-include/String.h"
// This constructor defines cp as the buffer to use for the
// stream (instead of one of its own devising); it does NOT
// initialize the ostrstream to contain cp (of length n).
- tostrstream(char *cp, int n, int mode=ios::out): ostrtream(cp, n, mode) // ERROR -
+ tostrstream(char *cp, int n, int mode=ios::out): ostrtream(cp, n, mode) // { dg-error "" }
{ }
char *str()
{
tab = (GctSymbolGctSymbolCHNode**)(new GctSymbolGctSymbolCHNodePtr[size = a.size]);
for (unsigned int i = 0; i < size; ++i) tab[i] = index_to_CHptr(i+1);
count = 0;
- for (Pix p = a.first(); p; a.next(p)) (*this)[a.key(p)] = a.contents(p); // gets bogus error - type `GctSymbol' is derived from private `String'
+ for (Pix p = a.first(); p; a.next(p)) (*this)[a.key(p)] = a.contents(p); // { dg-bogus "" } type `GctSymbol' is derived from private `String'
}
+// { dg-do run }
// prms-id: 786
extern "C" int printf (const char *, ...);
+// { dg-do run }
// prms-id: 7865
int count;
-// Build don't link:
+// { dg-do assemble }
// prms-id: 7868
struct DIAGTYP {
};
struct DIAGTYP1 {
- struct DIAGTYP; // ERROR - forward declaration
- void bar() { new struct DIAGTYP; } // ERROR - undefined
+ struct DIAGTYP; // { dg-error "" } forward declaration
+ void bar() { new struct DIAGTYP; } // { dg-error "" } undefined
void foo() { new struct DIAGTYP1; }
};
int main () {
- struct DIAGTYP; // ERROR - forward declaration
+ struct DIAGTYP; // { dg-error "" } forward declaration
struct DIAGTYP *lerror_desc;
- lerror_desc= new struct DIAGTYP; // ERROR - undefined
+ lerror_desc= new struct DIAGTYP; // { dg-error "" } undefined
}
void foo () {
+// { dg-do run }
// prms-id: 789
extern "C" int printf (const char *, ...);
+// { dg-do run }
// global and local multidimensional array objects are not getting
// constructors called on any dimension, other than the first. Also,
// the destructors are not being called. Seems odd, they probably
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
// prms-id: 7912
int count = 0;
+// { dg-do assemble }
// prms-id: 8009
class A {
B();
};
-B::B() : i (-1) {} // ERROR -
+B::B() : i (-1) {} // { dg-error "" }
+// { dg-do run }
// prms-id: 8018
class RefCount {
+// { dg-do assemble }
// prms-id: 8039
class C {
int main()
{
int (C::*mfp)() = &C::func;
- bar((int*)mfp); // ERROR - no clear semantics
+ bar((int*)mfp); // { dg-error "" } no clear semantics
}
+// { dg-do assemble }
// prms-id: 807
extern "C" int printf(const char*, ...);
};
-int foo(B& b); // ERROR - referenced below
+int foo(B& b); // { dg-error "" } referenced below
int main()
{
AX a;
- foo(a); // ERROR - Ambiguous B(a) or a.operator B() // See ARM 12.3.2
+ foo(a); // { dg-error "" } Ambiguous B(a) or a.operator B() // See ARM 12.3.2
}
-// Build don't link:
+// { dg-do assemble }
// prms-id: 807
// See ARM page 275 Section 12.3.2
class A {
public:
- A(B&); // ERROR - fn ref in err msg
+ A(B&); // { dg-error "" } fn ref in err msg
};
class B {
public:
- operator A(); // ERROR - fn ref in err msg
+ operator A(); // { dg-error "" } fn ref in err msg
};
B b;
-A a = b; // ERROR - should fail as it is ambigious.
+A a = b; // { dg-error "" } should fail as it is ambigious.
+// { dg-do assemble }
+// { dg-options "" }
// This test case caused the compiler to abort at one point in time.
-// Build don't link:
-// Special g++ Options:
// prms-id: 811
class ostream; class streambuf;
public:
Y() {}
virtual const char *stringify() = 0;
- virtual char *stringify2() const = 0; // ERROR -
+ virtual char *stringify2() const = 0; // { dg-error "" }
};
class X: public Y {
public:
X(): Y() {}
- char *stringify(); // ERROR - ok
- const char *stringify2() const; // ERROR - ok
+ char *stringify(); // { dg-error "" } ok
+ const char *stringify2() const; // { dg-error "" } ok
};
char *
X::stringify() const
-{ // ERROR - ok
+{ // { dg-error "" } ok
return "stringify";
}
const char *
X::stringify2()
-{ // ERROR - ok
+{ // { dg-error "" } ok
return "stringify2";
}
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
// prms-id: 8154
class QvFieldData;
+// { dg-do run }
// prms-id: 8155
int fail = 1;
+// { dg-do assemble }
// prms-id: 8175
class AtoBoolC {
AtoBoolC is_call_on_unack;
};
-static TestCase the_cases[] = { { 0 } }; // ERROR -
+static TestCase the_cases[] = { { 0 } }; // { dg-error "" }
-// Build don't link:
+// { dg-do assemble }
// prms-id: 8269
typedef char* const char_ptr;
-// Build don't link:
+// { dg-do assemble }
// prms-id: 8460
class A {
{
A a;
- a.A(1); // ERROR - cannot find name this way
+ a.A(1); // { dg-error "" } cannot find name this way
}
+// { dg-do run }
// prms-id: 8483
int count;
-// Build don't link:
+// { dg-do assemble }
// prms-id: 8620
struct S {
-// Build don't link:
-// Special g++ Options: -O
+// { dg-do assemble }
+// { dg-options "-O" }
// prms-id: 8786
class B {
+// { dg-do run }
// prms-id: 8804
extern "C" int printf (const char *, ...);
-// Build don't link:
+// { dg-do assemble }
// prms-id: 8825
class A {
+// { dg-do assemble }
// prms-id: 9068
struct ostream {
- void operator<< (int); // ERROR - fn ref in err msg
+ void operator<< (int); // { dg-error "" } fn ref in err msg
};
class C {
void foo (ostream& lhs, const C& rhs)
{
- lhs << rhs.i; // ERROR - no such i for any opr << ()
+ lhs << rhs.i; // { dg-error "" } no such i for any opr << ()
}
int& C::i () {
-// Build don't link:
-// Special g++ Options: -ansi -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-ansi -pedantic-errors" }
// prms-id: 9129
class Foo {
};
int (Foo::*pA)() = { &Foo::DoSomething };
-int (Foo::*X[1])(int) = { { &Foo::DoSomething } }; // ERROR -
-int (Foo::*Y[])(int) = { { &Foo::DoSomething, &Foo::DoSomething, 0 } }; // ERROR -
+int (Foo::*X[1])(int) = { { &Foo::DoSomething } }; // { dg-error "" }
+int (Foo::*Y[])(int) = { { &Foo::DoSomething, &Foo::DoSomething, 0 } }; // { dg-error "" }
+// { dg-do run }
// prms-id: 9206
class X {
-// Build don't link:
+// { dg-do assemble }
// prms-id: 9506
char * volatile p;
-// Special g++ Options: -fexceptions
-// excess errors test - XFAIL sparc64-*-elf arm-*-pe
+// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
+// { dg-options "-fexceptions" }
// prms-id: 9706
#include <stdlib.h>
+// { dg-do run }
// prms-id: 9732
class A {
+// { dg-do run }
// prms-id: 9732
int count;
-// Build don't link:
+// { dg-do assemble }
// prms-id: 9732
struct foo {};
-foo& x() { return foo(); } // WARNING -
+foo& x() { return foo(); } // { dg-warning "" }
-// Build don't link:
+// { dg-do assemble }
// prms-id: 991
class Complex {
-// Build don't link:
+// { dg-do assemble }
enum { name1 };
struct name0 { };
-// Build don't link:
+// { dg-do assemble }
class A;
struct XX { int A::*py; };
+// { dg-do run }
// extern "C" printf(const char *, ...);
class X
+// { dg-do run }
extern "C" int printf(const char *, ...);
class A_table {
+// { dg-do assemble }
struct Fooey {
void f(char* pX);
void f(int in);
void h(double dx);
};
-void Fooey::f(char*) { } // ERROR - candidate
-void Fooey::f(int) { } // ERROR - candidate
-void Fooey::f(float) { } // ERROR - candidate
+void Fooey::f(char*) { } // { dg-error "" } candidate
+void Fooey::f(int) { } // { dg-error "" } candidate
+void Fooey::f(float) { } // { dg-error "" } candidate
void Fooey::h(double zahl) { }
int main() {
Fooey Blah;
void (Fooey::*pointer)(double);
- pointer = &Fooey::f; // ERROR - don't call Fooey::h
+ pointer = &Fooey::f; // { dg-error "" } don't call Fooey::h
(Blah.*pointer)(42.5);
return 0;
}
-// Build don't link:
+// { dg-do assemble }
class NF { };
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
class S {
public:
void (S::*pmf)();
void foo() {
- pmf(); // WARNING -
+ pmf(); // { dg-warning "" }
}
static void foo1(S* sp) {
- (sp->pmf)(); // ERROR -
+ (sp->pmf)(); // { dg-error "" }
}
};
+// { dg-do run }
class A;
typedef int (A::*f_ptr) (void);
+// { dg-do run }
int fail;
class A *ptr_a;
+// { dg-do run }
class K {
public:
int f(int i) { return i; }
+// { dg-do run }
template <class T, class V>
class A {
public:
};
template <class T, class V>
-B<T, V>::B (T at, V av) : A<T, V> (at, av) { } // gets bogus error -
+B<T, V>::B (T at, V av) : A<T, V> (at, av) { } // { dg-bogus "" }
int main () {
int i = 2;
+// { dg-do run }
class A {
public:
};
-// Build don't link:
+// { dg-do assemble }
template<class Repr>
class syHandle
-// Build don't link:
+// { dg-do assemble }
template <char* c> struct B { B() { } };
-B<0> bnull; // ERROR - could not convert template argument
+B<0> bnull; // { dg-error "" } could not convert template argument
+// { dg-do run }
int count;
struct base {
-// Build don't link:
+// { dg-do assemble }
#include <typeinfo>
#include <iostream>
+// { dg-do run }
#include <typeinfo>
int main() {
+// { dg-do run }
class base {
public:
virtual ~base() {}
-// Build don't link:
+// { dg-do assemble }
class A;
public:
B();
private:
- A a; // ERROR -
+ A a; // { dg-error "" }
};
class A { };
-// Build don't link:
+// { dg-do assemble }
static void kbdNormal() { }
void (*keyHandler)() = kbdNormal;
-// Build don't link:
+// { dg-do assemble }
class A {
protected:
+// { dg-do assemble }
class A {};
class C {};
int main() {
A* a = 0;
- C* c = static_cast<C*>(a); // ERROR - bad static cast
+ C* c = static_cast<C*>(a); // { dg-error "" } bad static cast
}
+// { dg-do run }
extern "C" int printf(const char *, ...);
extern "C" const char *getenv(const char *);
-// Build don't link:
+// { dg-do assemble }
struct C1
{
+// { dg-do run }
#include <typeinfo>
int state;
+// { dg-do run }
int state;
int fail;
-// Build don't link:
-// Special g++ Options: -g -O -funroll-loops
+// { dg-do assemble }
+// { dg-options "-g -O -funroll-loops" }
struct A {
inline ~A() { }
-// Build don't link:
+// { dg-do assemble }
struct S0 { virtual void f1 () { } };
+// { dg-do run }
struct S0 {
virtual int is_kind_of_S1 () const { return 0; }
virtual void dummy () { }
-// Build don't link:
+// { dg-do assemble }
class B {
public:
int Di;
};
-class E : public virtual D, public B { // WARNING - direct base inaccessible due to ambiguity
+class E : public virtual D, public B { // { dg-warning "" } direct base inaccessible due to ambiguity
int Ei;
};
-// Special g++ Options:
+// { dg-do run }
+// { dg-options "" }
void Foo () {}
+// { dg-do run }
// Ensure that virtual base upcast and downcasting works on this
// conversions during virtual function dispatch at ctor/dtor time
// when dynamic vtable fixups for deltas are needed.
+// { dg-do run }
// This testcase ensures that we can build vtable names for complex MI
// classes.
-// Build don't run:
-// Special g++ Options: -fno-implement-inlines
+// { dg-do link }
+// { dg-options "-fno-implement-inlines " }
struct type {
virtual void m1();
virtual void m2() { }
-// Build don't link:
-// Special g++ Options: -Wall
+// { dg-do assemble }
+// { dg-options "-Wall" }
typedef char * charptr;
typedef __SIZE_TYPE__ size_t;
void foo() { }
int main()
{
- charptr(*pp)++; // WARNING -
+ charptr(*pp)++; // { dg-warning "" }
return 0;
}
-// Build don't link:
-// Special g++ Options: -Wall
+// { dg-do assemble }
+// { dg-options "-Wall" }
enum Boolean {
Ok = 0,
int
main () {
- if (fn1() == Ok) { // WARNING -
+ if (fn1() == Ok) { // { dg-warning "" }
foo();
}
}
-// Build don't link:
-// Special g++ Options: -Wall
+// { dg-do assemble }
+// { dg-options "-Wall" }
class B {
public:
};
class D : public B {
- int member; // WARNING - reordered
- D() : member(0), B(member) { } // WARNING - reordered
+ int member; // { dg-warning "" } reordered
+ D() : member(0), B(member) { } // { dg-warning "" } reordered
};
-void foo (int a, int a) { } // ERROR -
+// { dg-do assemble }
+void foo (int a, int a) { } // { dg-error "" }
-// Build don't link:
-// Special g++ Options: -Wpointer-arith
+// { dg-do assemble }
+// { dg-options "-Wpointer-arith" }
double X(const double x) { return x; }
double Y() { return 1.0; }
typedef void (A::*pmf)();
-static int mememe = &A::foo - &A::bar; // WARNING -
-pmf b = &A::foo-1; // WARNING -
+static int mememe = &A::foo - &A::bar; // { dg-warning "" }
+pmf b = &A::foo-1; // { dg-warning "" }
int main() {
double y;
- y=X(Y-Z); // WARNING -
+ y=X(Y-Z); // { dg-warning "" }
}
-// Build don't link:
-// Special g++ Options: -Woverloaded-virtual
+// { dg-do assemble }
+// { dg-options "-Woverloaded-virtual" }
struct B4 {
- virtual void bothfardiff(float); // WARNING - was hidden
+ virtual void bothfardiff(float); // { dg-warning "" } was hidden
};
struct B3 : public B4 {
virtual void bothsame(int);
- virtual void bothdiff(float); // WARNING - was hidden
+ virtual void bothdiff(float); // { dg-warning "" } was hidden
virtual void both2same(int);
virtual void both2same(float);
virtual void both12diff(int);
- virtual void both12diff(float); // WARNING - was hidden
+ virtual void both12diff(float); // { dg-warning "" } was hidden
};
struct D : public B, public B2, public B3 {
virtual void bothsame(int);
- virtual void bothdiff(int); // WARNING -
+ virtual void bothdiff(int); // { dg-warning "" }
virtual void both2same(int);
virtual void both2same(float);
- virtual void both12diff(int); // WARNING -
+ virtual void both12diff(int); // { dg-warning "" }
- virtual void bothfardiff(int); // WARNING -
+ virtual void bothfardiff(int); // { dg-warning "" }
};
-// Build don't link:
-// Special g++ Options: -Wall
+// { dg-do assemble }
+// { dg-options "-Wall" }
const int& foo() {
extern int bar;
-// Build don't link:
+// { dg-do assemble }
struct foo {
bool test();
bool (foo::* pmf)() = &foo::test;
bool (*pf)() = func;
- if (A.test) ; // ERROR -
- if (func) ; // WARNING -
- if (bool(A.test)) ; // ERROR -
- if (bool(func)) ; // WARNING -
+ if (A.test) ; // { dg-error "" }
+ if (func) ; // { dg-warning "" }
+ if (bool(A.test)) ; // { dg-error "" }
+ if (bool(func)) ; // { dg-warning "" }
if (pmf) ;
if (pf) ;
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas explicit-construct virtual-base
struct A {};
struct B : virtual A { B(); };
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas explicit-construct
struct A { A(); };
struct B { B(A&); };
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas virtual-base
struct A { A(); virtual void f(); };
struct B : virtual A { B(); };
-// Build don't link:
+// { dg-do assemble }
// GROUPS niklas pt
template <class T> class C1 {};
class C1<int> C1_int_object;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas i386
unsigned long foo(unsigned long x)
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas ellipsis
typedef void (*T) (...);
void f ();
-struct S { void g (T); void h() { g(f); } };// ERROR -
+struct S { void g (T); void h() { g(f); } };// { dg-error "" }
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas ellipsis
void f ();
-void g1 (void (*) (...)); void h1 () { g1 (f); }// ERROR - .*
-struct S { void g2 (void (*) (...)); void h2 () { g2 (f); } };// ERROR -
+void g1 (void (*) (...)); void h1 () { g1 (f); }// { dg-error "" } .*
+struct S { void g2 (void (*) (...)); void h2 () { g2 (f); } };// { dg-error "" }
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas dwarf
struct S { S(); };
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas dwarf
struct S { S(); };
void f(S) {}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas nested-types static-members
struct A
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas nested-types static-members
struct A
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas nested-types static-members
struct A
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas nested-types
struct A { struct B { ~B (); }; };
A::B::~B () {}
-// Build don't link:
+// { dg-do assemble }
// GROUPS niklas uncaught default-construct
struct A { A (int); };
-struct B : A {}; // ERROR - without ctor // ERROR - candidates
-void f () { B (0); }// ERROR - .*
+struct B : A {}; // { dg-error "" } without ctor // ERROR - candidates
+void f () { B (0); }// { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas nested-types
struct X {
struct A { A (int); };
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas nested-types
struct A;
struct B { struct A { A(int); }; struct C : A { C() : A (0) {} }; };
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas static-members
struct A { static A a; };
A f () { return A::a; }
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas construct-destruct
struct S { S (); ~S (); };
void f () { while (1) S s; }
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas nested-types
struct A { struct B { void operator = (const B&); }; };
void A::B::operator = (const B&) {}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas static-members
extern "C" int f ();
struct A { static void f () {} };
-// Build don't link:
+// { dg-do assemble }
// GROUPS niklas pt friend
-// excess errors test - XFAIL *-*-*
template <class T> class C1
-{
+{ // { dg-error "" }
public:
void diddle_C2 ();
};
class C2
{
- int data_member;
- friend class C1;
+ int data_member; // { dg-error "" }
+ friend class C1; // { dg-error "" }
};
class C2 C2_object;
template <class T> void C1<T>::diddle_C2 ()
{
- C2_object.data_member = 99;
+ C2_object.data_member = 99; // { dg-error "" }
}
C1<int> C1_int_object;
-// Build don't link:
+// { dg-do assemble }
// GROUPS niklas overloading
extern "C" void f (char*);
void f (const char*) {}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas nested-types
struct A {
struct B { void f (); };
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed niklas hiding
struct A;
void f (A*);
+// { dg-do assemble }
+// { dg-options "-w" }
// GROUPS passed niklas hiding ARM
-// Build don't link:
-// Special g++ Options: -w
struct stat {};
stat gstat;
int stat (struct stat*);
+// { dg-do run }
// GROUPS passed niklas hiding local-types
extern "C" int printf (const char*, ...);
int val = 1;
-// Build don't link:
-// Special g++ Options: -Wshadow
+// { dg-do assemble }
+// { dg-options "-Wshadow" }
// GROUPS passed niklas scoping ARM
class X { X (int); };
-void X (int);// ERROR - .*hides constructor.*
+void X (int);// { dg-error "" } .*hides constructor.*
void f () { X (1); }
+// { dg-do run }
namespace foo{
int eine_funktion(int)
{
-//Build don't link:
+// { dg-do assemble }
namespace NS1
{
int a;
}
-namespace NS2 = NonExistant; //ERROR -
+namespace NS2 = NonExistant; //{ dg-error "" }
+// { dg-do run }
namespace A{
struct X{};
void f(X&);
-namespace A = B; // ERROR - unknown namespace
+// { dg-do assemble }
+namespace A = B; // { dg-error "" } unknown namespace
namespace C{}
namespace D = C;
-namespace D { // ERROR - reopening namespace with alias
+namespace D { // { dg-error "" } reopening namespace with alias
void f();
}
-void C::f(){} // ERROR - previous definition
+void C::f(){} // { dg-error "" } previous definition
-void D::f(){} // ERROR - redefinition
+void D::f(){} // { dg-error "" } redefinition
-namespace E = C::F; // ERROR - unknown namespace
+namespace E = C::F; // { dg-error "" } unknown namespace
+// { dg-do run }
namespace foo{
int eine_funktion(int)
{
+// { dg-do run }
// Check namespace aliases inside blocks
namespace A {
int i;
-//Build don't link:
+// { dg-do assemble }
namespace A{
namespace B{int i;}
using namespace B;
+// { dg-do run }
namespace{
void f();
}
-// Build don't link:
+// { dg-do assemble }
namespace N {}
-void f(int N::k); // ERROR -
+void f(int N::k); // { dg-error "" }
class Foo
{
- int N::j; // ERROR - invalid use of `::'
+ int N::j; // { dg-error "" } invalid use of `::'
};
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S1 {};
struct S2
{
- typedef N::S1<int> S2_T; // ERROR - parse error
+ typedef N::S1<int> S2_T; // { dg-error "" } parse error
};
-// Build don't link:
+// { dg-do assemble { xfail *-*-* } }
// Submitted by bjornw@fairplay.no
-// crash test - XFAIL *-*-*
namespace hei {
class CSomeClass {};
extern CSomeClass SomeClass;
}
-hei::CSomeClass hei::CSomeClass; // ERROR - should be hei::SomeClass - XFAIL *-*-*
+hei::CSomeClass hei::CSomeClass; // { dg-error "" "" { xfail *-*-* } } should be hei::SomeClass -
-// Build don't link:
+// { dg-do assemble }
namespace N {
template <class T> struct S;
void f()
{
- N::S(); // ERROR - invalid use of template
+ N::S(); // { dg-error "" } invalid use of template
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Geoffrey Furnish <furnish@actel.com>
namespace N {
-// Build don't run:
+// { dg-do link }
// Based on a testcase by eyal.ben-david@aks.com
-// Build don't link:
+// { dg-do assemble }
namespace A{
void f(int);
}
-//Build don't link:
+// { dg-do assemble }
namespace A{
void foo();
}
-//Build don't link:
+// { dg-do assemble }
namespace x { }
void f(int);
int main()
{
- x(); // ERROR - calling a namespace
- x=4; // ERROR - assigning to a namespace
- f(x); // ERROR - passing a namespace as parameter
+ x(); // { dg-error "" } calling a namespace
+ x=4; // { dg-error "" } assigning to a namespace
+ f(x); // { dg-error "" } passing a namespace as parameter
}
-// Build don't link:
+// { dg-do assemble }
class ostream;
extern ostream cout;
namespace foo
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// Check association of {error} for Koenig lookup
-// Special g++ Options:
struct QString { operator void * (); };
int foo()
+// { dg-do run }
//Check association of member pointer in overload resolution.
struct A {
int m_val;
+// { dg-do run }
void f();
void f(int);
+// { dg-do assemble }
// To find function pointers in Koenig lookup is ok as long as we only find one.
namespace A{
- void foo(); // ERROR -
+ void foo(); // { dg-error "" }
struct X{};
void (*bar)(X*)=0;
}
using A::X;
-void (*foo)(X*)=0; // ERROR -
+void (*foo)(X*)=0; // { dg-error "" }
void g()
{
- foo(new X); // ERROR - both objects and functions found
+ foo(new X); // { dg-error "" } both objects and functions found
bar(new X); // ok
}
+// { dg-do assemble }
namespace A{
struct X{};
int main()
{
A::X x;
- bar(&foo(x)); // WARNING - address of temporary
+ bar(&foo(x)); // { dg-warning "" } address of temporary
}
+// { dg-do run }
// Test for Koenig lookup involving overloaded functions.
namespace N1 {
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 15 Dec 1999 <nathan@acm.org>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Theodore.Papadopoulo 23 Jun 2000 <Theodore.Papadopoulo@sophia.inria.fr>
inline void
bar() {
- foo("",count); // ERROR - multiple overloaded count functions
+ foo("",count); // { dg-error "" } multiple overloaded count functions
}
-// Build don't link:
+// { dg-do assemble }
typedef int __quad_t;
typedef __quad_t __qaddr_t;
-// Build don't link:
+// { dg-do assemble }
template <class charT>
struct basic_string
{
+// { dg-do run }
namespace A{
int i;
int f();
-//Build don't link:
+// { dg-do assemble }
namespace X{
typedef int foo;
const int bar=2;
-// Build don't link:
+// { dg-do assemble }
namespace A{
void f();
}
namespace B{
using namespace A;
- void f(int); // ERROR - referenced below
+ void f(int); // { dg-error "" } referenced below
}
using namespace B;
void g()
{
- ::f(); // ERROR - A::f is not found
+ ::f(); // { dg-error "" } A::f is not found
}
using namespace A;
-// Build don't link:
+// { dg-do assemble }
// main is only reserved in the global namespace [basic.start.main]/3
+// { dg-do run }
// Test whether N::operator new is different from ::operator new
#include <new>
#include <cstdlib>
+// { dg-do run }
namespace foo{
int eine_funktion(int)
{
-//Build don't link:
+// { dg-do assemble }
namespace bb
{
int f(int);
{
void foo(int bar)
{
- int i=bb:f(bar); // ERROR - namespace
+ int i=bb:f(bar); // { dg-error "" } namespace
}
}
}
+// { dg-do assemble }
// Build don't link
// Check [namespace.memdef]/2
namespace A{
void f(int);
void f(int,int);
- int i; // ERROR - .*
+ int i; // { dg-error "" } .*
}
-void A::f(){} // ERROR - should have been declared before
+void A::f(){} // { dg-error "" } should have been declared before
namespace B{
- void A::f(int){} // ERROR - B does not surround A
+ void A::f(int){} // { dg-error "" } B does not surround A
}
-int A::i; // ERROR - redefinition
+int A::i; // { dg-error "" } redefinition
void A::f(int,int){} // ok
+// { dg-do run }
namespace fred
{
int barney();
+// { dg-do run }
namespace std{
void f(){}
void g();
+// { dg-do run }
namespace std{
int f(){
-//Build don't link:
+// { dg-do assemble }
namespace std {}
-// Build don't link:
+// { dg-do assemble }
class Y {
public:
-//Build don't link:
+// { dg-do assemble }
namespace foo
{
class c
}
int
-foo::c:fn () // ERROR - syntax error
+foo::c:fn () // { dg-error "" } syntax error
{
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Theo Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
namespace Bname {
-// Build don't link:
+// { dg-do assemble }
// Origin: Chip Salzenberg <chip@valinux.com>
namespace N {
+// { dg-do run }
namespace foo{
struct X{
int i;
-// Build don't link:
+// { dg-do assemble }
namespace foo{
void eine_funktion(int)
{}
-// Build don't link:
+// { dg-do assemble }
namespace A{
enum foo{a,b,c};
}
-// Build don't link:
+// { dg-do assemble }
namespace X{
class Y{};
}
+// { dg-do run }
namespace A{
int i;
namespace B{
-// Build don't link:
+// { dg-do assemble }
namespace A{
struct X{
int i;
-// Build don't link:
+// { dg-do assemble }
namespace B{
void f();
}
-// Build don't link:
+// { dg-do assemble }
namespace bb
{
int f(int);
{
void foo(int bar)
{
- return bb:f(bar); //ERROR - syntax error
+ return bb:f(bar); //{ dg-error "" } syntax error
}
}
}
+// { dg-do run }
// Unqualified lookup should find all functions.
// Duplicates are ignored as long as they lose during overload resolution.
namespace A{
+// { dg-do assemble }
namespace A{
- void f(); // ERROR - .*
+ void f(); // { dg-error "" } .*
}
using namespace A;
-void f(); // ERROR - .*
+void f(); // { dg-error "" } .*
void g()
{
- f(); // ERROR - ambiguous, ::f or A::f ?
+ f(); // { dg-error "" } ambiguous, ::f or A::f ?
}
-// Build don't link:
+// { dg-do assemble }
namespace A{
void f();
-// Build don't link:
+// { dg-do assemble }
namespace A{
void f();
}
using A::f;
-void f(); // ERROR - duplicate declaration
+void f(); // { dg-error "" } duplicate declaration
-// Build don't link:
+// { dg-do assemble }
namespace A{
void f(){}
}
using A::f;
void f(int);
-void f(){} // ERROR - conflict
+void f(){} // { dg-error "" } conflict
void g()
{
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 10 Aug 2000 <nathan@codesourcery.com>
ref.mlp::base::reset ();
ref.base::reset ();
ref.reset ();
- ref.mlp::reset (); // ERROR - not an aggregate type
+ ref.mlp::reset (); // { dg-error "" } not an aggregate type
}
-// Build don't link:
+// { dg-do assemble }
namespace foo {
template <class T>
-// Build don't link:
+// { dg-do assemble }
// Origin: Manuel Menezes de Sequeira <mms@torga.iscte.pt>
namespace N {
+// { dg-do run }
void foo(){}
namespace Bar{
-// Build don't link:
+// { dg-do assemble }
// Templates can be defined outside of the namespace if the have been declared
// inside
namespace bar
-// Build don't link:
+// { dg-do assemble { xfail *-*-* } }
// Templates defined outside must be declared inside
-// crash test - XFAIL *-*-*
namespace bar
{
template<class T>
void foo(); // trick it to provide some prior declaration
- template<class T>class X; // ERROR - previous declaration
+ template<class T>class X; // { dg-error "" } previous declaration
}
template <typename T>
T const
bar::foo(T const &a)
-{ // ERROR - not declared in bar - XFAIL *-*-*
+{ // { dg-error "" "" { xfail *-*-* } } not declared in bar -
return a;
}
template<> void bar::foo<int>()
-{ // ERROR - not declared in bar - XFAIL *-*-*
+{ // { dg-error "" "" { xfail *-*-* } } not declared in bar -
}
template<class T,class U>
-class bar::X{}; // ERROR - does not match declaration
+class bar::X{}; // { dg-error "" } does not match declaration
-// Build don't link:
+// { dg-do assemble }
// Origin: Alex Samuel <samuel@codesourcery.com>
namespace Outer
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
namespace X { template <class T> void f () {} }
+// { dg-do assemble }
// Test that pushing into a namespace for a definition doesn't affect
// template instantiations.
-// Build don't link:
namespace N {
template <class T> void f () { }
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Apr 2001 <nathan@codesourcery.com>
-// Build don't run:
+// { dg-do link }
// Origin: Andrey Slepuhin <pooh@msu.ru>
namespace A
-//Build don't link:
+// { dg-do assemble }
//Inheritance from templates which are namespace members
namespace foo {
+// { dg-do run }
//Check instantiation of templates outside their namespace
namespace A{
template <class T>void g(){}
+// { dg-do run }
namespace NS
{
template <typename T>
+// { dg-do run }
//Check whether namespace-scoped template instantiations
//are mangled differently.
-//Build don't link:
+// { dg-do assemble }
//reported by Theodore Papadopoulo (Theodore.Papadopoulo@sophia.inria.fr)
namespace A {
};
template <>
- const unsigned B<int,int>::count = 2; // ERROR - duplicate init
+ const unsigned B<int,int>::count = 2; // { dg-error "" } duplicate init
}
}
int
main()
{
- unsigned kk = A::B<int,int>::count; // ERROR - not a template: syntax error
+ unsigned kk = A::B<int,int>::count; // { dg-error "" } not a template: syntax error
}
-// Build don't link:
+// { dg-do assemble { xfail *-*-* } }
-// crash test - XFAIL *-*-*
// Based on bug report by Eric NICOLAS <nicolas@bnp-eng.remcomp.com>
}
void baz() {
- foo::bar(); // ERROR - template used as expression
+ foo::bar(); // { dg-error "" } template used as expression
}
-// Build don't link:
+// { dg-do assemble }
namespace X {
template <class T> class foo;
}
+// { dg-do run }
// Produces ICE 980519.
// Test case from Dirk Engelmann <Dirk.Engelmann@IWR.Uni-Heidelberg.De>
+// { dg-do assemble }
// Test that using an elaborated-type-specifier in a namespace to refer
// to a class outside the namespace does not cause its name to be considered
// declared in the namespace.
// Contributed by Jason Merrill <jason@cygnus.com>
-// Build don't link:
struct A { };
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 11 April 2001 <nathan@codesourcery.com>
-//Build don't link:
+// { dg-do assemble }
namespace A{
}
-struct Y: A::S<int>{}; //ERROR - no such type
+struct Y: A::S<int>{}; //{ dg-error "" } no such type
-// Build don't link:
-using namespace bb; // ERROR - .*
+// { dg-do assemble }
+using namespace bb; // { dg-error "" } .*
-//Build don't link:
+// { dg-do assemble }
//Based on a report by Helmut Jarausch <jarausch@IGPM.Rwth-Aachen.DE>
template<class>
class foo{};
-// Build don't link:
+// { dg-do assemble }
class joey {
public:
typedef int SVec;
};
-using joey::SVec; // ERROR - joey is not a namespace
+using joey::SVec; // { dg-error "" } joey is not a namespace
-// Build don't link:
+// { dg-do assemble }
// Origin: Brendan Kehoe <brendan@cygnus.com>
namespace foo
{
- void x (bool); // ERROR - candidates
- void x (char); // ERROR - candidates
- void x (int); // ERROR - candidates
- void x (double); // ERROR - candidates
+ void x (bool); // { dg-error "" } candidates
+ void x (char); // { dg-error "" } candidates
+ void x (int); // { dg-error "" } candidates
+ void x (double); // { dg-error "" } candidates
}
-namespace baz { void x (int); } // ERROR - candidates
+namespace baz { void x (int); } // { dg-error "" } candidates
void fn (int i)
{
using foo::x;
using baz::x;
- x(i); // ERROR - ambiguous
+ x(i); // { dg-error "" } ambiguous
}
+// { dg-do run }
namespace A{
void foo(int){}
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
extern "C" void f ();
-// Build don't link:
+// { dg-do assemble }
void f();
namespace A{
using ::f;
-// Build don't link:
+// { dg-do assemble }
typedef unsigned int atypedef;
struct astruct{};
+// { dg-do assemble }
//Build don't link
#include <vector>
namespace csp {
-using namespace std::vector; // ERROR - vector is not a namespace
+using namespace std::vector; // { dg-error "" } vector is not a namespace
}
-// Build don't link:
+// { dg-do assemble }
namespace a {
class b {
- using std::c; //ERROR - namespace using on class level
+ using std::c; //{ dg-error "" } namespace using on class level
};
}
-//Build don't link:
+// { dg-do assemble }
#include <vector>
namespace csp {
+// { dg-do run }
namespace X{
void f(int){}
}
-// Build don't link:
+// { dg-do assemble }
namespace M {
int i;
}
+// { dg-do assemble }
// Test for proper merging of functions from multiple using directives.
-// Build don't link:
namespace standard
{ void print(int) {}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
// based on bug report by Harri Porten <porten@tu-harburg.de>
struct A {
- A() : x; // ERROR - missing body
+ A() : x; // { dg-error "" } missing body
};
struct B {
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999, 2001 Free Software Foundation
struct foo {
foo() {}
private:
- void operator delete(void *) {} // ERROR - private
+ void operator delete(void *) {} // { dg-error "" } private
} foo_;
struct bar : foo {
~bar() {
- delete this; // ERROR - delete is private
+ delete this; // { dg-error "" } delete is private
// An implicit invocation of delete is emitted in destructors, but
// it should only be checked in virtual destructors
- } // gets bogus error - not virtual
+ } // { dg-bogus "" } not virtual
} bar_;
struct baz : foo {
- virtual ~baz() {} // ERROR - delete is private in vdtor
+ virtual ~baz() {} // { dg-error "" } delete is private in vdtor
} baz_;
-struct bad : baz {} bad_; // ERROR - delete is private in vdtor
+struct bad : baz {} bad_; // { dg-error "" } delete is private in vdtor
+// { dg-do run }
// Copyright (C) 1999 Free Software Foundation
// by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
+// { dg-do run }
// Copyright (C) 1999 Free Software Foundation
// by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
+// { dg-do run }
// Copyright (C) 1999 Free Software Foundation
// by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
+// { dg-do run }
// Copyright (C) 1999 Free Software Foundation
// by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
// based on bug report by Chris McKay <chris.mckay@solipsys.com>
// Used to fail with dwarf debugging.
-// crash test
template <class T = void>
struct foo {
-// Build don't link:
+// { dg-do assemble { xfail i386-pc-solaris* } }
// Copyright (C) 1999 Free Software Foundation
// by Alexandre Oliva <oliva@dcc.unicamp.br>
// Fails with dwarf debugging.
-// crash test - XFAIL i386-pc-solaris*
typedef __java_boolean jboolean;
void foo() {}
-// Build don't link:
+// { dg-do assemble { xfail i386-pc-solaris* } }
// Copyright (C) 1999 Free Software Foundation
// based on bug report by Andreas Stolcke <stolcke@speech.sri.com>
// Fails with dwarf debugging.
-// crash test - XFAIL i386-pc-solaris*
template <class T = void> struct foo {
int data[1];
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
// invalid operands `foo' and `int' to binary `operator !='
class foo {} bar;
-int i = void(bar) ? 1 : 0; // gets bogus error - operator!= - XFAIL *-*-*
+int i = void(bar) ? 1 : 0; // { dg-bogus "" "" { xfail *-*-* } } - operator!= -
+// { dg-do run { xfail *-*-* } }
+
// Copyright (C) 2000 Free Software Foundation
// by Alexandre Oliva <aoliva@cygnus.com>
-// execution test - XFAIL *-*-*
-
int i, j;
const int &f(const int& I, const int& J) {
+// { dg-do run }
+// { dg-options "" }
// Copyright (C) 1999 Free Software Foundation
// by Alexandre Oliva <oliva@dcc.unicamp.br>
// simplified from bug report by Michael Rosenbruch <Rosenbruch@bfw-online.de>
-// Special g++ Options:
extern "C" void abort();
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2001 Free Software Foundation
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
// by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
// Derived from GNU lilypond.
-// crash test
struct foo {
foo();
+// { dg-do link }
+// { dg-gpp-additional-sources " linkage1-main.cc" }
+
// Copyright 2002 Free Software Foundation
// Derived by Alexandre Oliva <aoliva@redhat.com> from code posted by
// Mark Mitchell <mark@codesourcery.com>
-// Build don't run:
-
-// Additional sources: linkage1-main.cc
-
// Verify that a member of a class is given global linkage when it's a
// member of a function whose name is taken from a typedef, by
// checking that another translation unit can call it. We don't do
// the right things on functions, but we do on data members.
-// excess errors test - XFAIL *-*-*
+// { dg-bogus "" "" { xfail *-*-* } 0 }
typedef struct {
void f();
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-Wno-deprecated" }
// Copyright (C) 1999, 2000, 2002 Free Software Foundation
// by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
// distilled from libg++'s Rational.cc
-// Special g++ Options: -Wno-deprecated
-inline int bar () return r {} // ERROR -
+inline int bar () return r {} // { dg-error "" }
int foo () {
return bar ();
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O1 -Wno-deprecated" }
// Copyright (C) 1999, 2000, 2002 Free Software Foundation
// by Alexandre Oliva <oliva@lsd.ic.unicamp.br>
// distilled from libg++'s Integer.cc
-// Special g++ Options: -O1 -Wno-deprecated
-inline int bar () return r {} // ERROR -
+inline int bar () return r {} // { dg-error "" }
int& foo (int& x) {
bar ();
+// { dg-do run }
// Copyright (C) 1999 Free Software Foundation
// by Alexandre Oliva <oliva@dcc.unicamp.br>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999, 2000 Free Software Foundation
void foo();
namespace bar {
class baz {
- friend void ::foo(); // gets bogus error - parse error
+ friend void ::foo(); // { dg-bogus "" } parse error
};
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
namespace bar {
using ::foo;
class baz {
- friend void foo(); // gets bogus error - conflict - XFAIL *-*-*
+ friend void foo(); // { dg-bogus "" "" { xfail *-*-* } } - conflict -
};
}
-// Build don't link:
+// { dg-do assemble { xfail *-*-* } }
// Copyright (C) 1999 Free Software Foundation
// by Alexandre Oliva <oliva@dcc.unicamp.br>
// based on bug report by Ovidiu Toader <ovi@physics.utoronto.ca>
-// crash test - XFAIL *-*-*
namespace N {
template <typename T> class A {
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
// Based on bug report by JDonner <jdonner@schedsys.com>
struct foo {
- static int bar(); // ERROR - candidate
- void bar(int); // ERROR - candidate
+ static int bar(); // { dg-error "" } candidate
+ void bar(int); // { dg-error "" } candidate
};
/* gcc emits a hard error without -pedantic, and a warning with
-pedantic, even in bad1. */
int (*ok1)() = foo::bar;
-void (foo::*bad1)(int) = foo::bar; // ERROR - missing &
+void (foo::*bad1)(int) = foo::bar; // { dg-error "" } missing &
int (*ok2)() = &foo::bar; // ok
-void (*bad2)(int) = foo::bar; // ERROR - overload resolution fails
+void (*bad2)(int) = foo::bar; // { dg-error "" } overload resolution fails
void (foo::*ok3)(int) = &foo::bar; // ok
-int (foo::*bad3)() = foo::bar; // ERROR - overload resolution fails
+int (foo::*bad3)() = foo::bar; // { dg-error "" } overload resolution fails
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
template <typename T> class bar {
private:
- int i; // ERROR - this variable
+ int i; // { dg-error "" } this variable
friend void foo<T>(T);
};
bar<T>().i = 0; // ok, I'm a friend
}
template <typename T> void foo(T*) {
- bar<T*>().i = 1; // ERROR - not a friend
+ bar<T*>().i = 1; // { dg-error "" } not a friend
}
int main() {
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
-// Build don't link:
+// { dg-do assemble { xfail i*86-*-* } }
// Copyright (C) 2000 Free Software Foundation
// by Alexandre Oliva <aoliva@cygnus.com>
// distilled from libg++'s Fix.cc
-// crash test - XFAIL i*86-*-*
struct Integer {
~Integer () {}
-// Build don't link:
+// { dg-do assemble }
-// Copyright (C) 1999 Free Software Foundation
+// Copyright (C) 1999, 2003 Free Software Foundation
// by Alexandre Oliva <oliva@dcc.unicamp.br>
// based on bug report by Stefan Wetzel <Stefan_Wetzel@Physik.TU-Muenchen.DE>
-// crash test - XFAIL *-*-*
template<int P = 0> struct foo {
- static void bar(double (*)[dim]) {} // ERROR - dim not declared
+ static void bar(double (*)[dim]) {} // { dg-error "" } dim not declared
};
void bar() {
- foo<>::bar(0); // ERROR - instantiated from here
+ foo<>::bar(0); // { dg-error "" "" { xfail *-*-* } } instantiated from here
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
};
bool A<int>::a = true; // ok
-template<> bool A<int>::b = false; // ERROR - XFAIL *-*-*
+template<> bool A<int>::b = false; // { dg-error "" "" { xfail *-*-* } }
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
};
template <template <typename> class C, typename T> foo<C,T>::foo(bar)
-{} // gets bogus error - C<T> not a class
+{} // { dg-bogus "" } C<T> not a class
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
// based on bug report by Ulf Larsson <ulf.larsson@mbow337.swipnet.se>
template <class T> class C {};
-class foo {} bar = bar.C(); // ERROR - call to template
+class foo {} bar = bar.C(); // { dg-error "" } call to template
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
X<a> x; // ok, a has external linkage
const int b = 2;
-X<b> y; // ERROR - const b has internal linkage
+X<b> y; // { dg-error "" } const b has internal linkage
extern const int c;
X<c> z; // ok, c has external linkage
extern const int c = 3;
-X<c> z_; // gets bogus error - using c as constant
+X<c> z_; // { dg-bogus "" } using c as constant
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
// simplified from bug report by Meenaradchagan Vishnu <mvishnu@fore.com>
template <typename> struct foo {};
-template <> void foo(); // ERROR - bad specialization
+template <> void foo(); // { dg-error "" } bad specialization
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999, 2000 Free Software Foundation
template<class> struct A {};
template<template<class> class T> struct B {
B() {
- T<B>(); // gets bogus error - conversion from int to non-scalar
+ T<B>(); // { dg-bogus "" } conversion from int to non-scalar
}
};
B<A> foo;
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
} b;
template <class T> void foo() {
- b.bar<T>(); // no longer gets bogus error - bar undeclared
- b.template bar<T>(); // no longer gets bogus error - ditto
+ b.bar<T>(); // no longer { dg-bogus "" } bar undeclared
+ b.template bar<T>(); // no longer { dg-bogus "" } ditto
b.B::bar<T>(); // ok
}
-template void foo<void>(); // no longer gets bogus error
+template void foo<void>(); // no longer { dg-bogus "" }
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
struct foo {
template <class>
- void bar() = 0; // ERROR - invalid initializer - XFAIL *-*-*
+ void bar() = 0; // { dg-error "" "" { xfail *-*-* } } invalid initializer -
};
+// { dg-do run }
// Copyright (C) 1999 Free Software Foundation
// by Alexandre Oliva <oliva@dcc.unicamp.br>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
};
template <class T> struct baz {
- typedef bar<T>::foo foo; // ERROR - missing typename
+ typedef bar<T>::foo foo; // { dg-error "" } missing typename
};
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
// Copyright (C) 1999 Free Software Foundation
};
template <class T> struct baz {
- typedef bar<T>::foo foo; // ERROR - implicit typename
+ typedef bar<T>::foo foo; // { dg-error "" } implicit typename
void m(foo);
};
-// Build don't link:
+// { dg-do assemble { xfail *-*-* } }
// Copyright (C) 1999 Free Software Foundation
typedef T t1;
b.t1::i; // ok
typedef __typeof__(b) t2;
- b.t2::i; // crash test - XFAIL *-*-*
}
template void foo(B); // not needed for the crash
+// { dg-do assemble }
// GROUPS passed abort
-// Build don't link:
// 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; // ERROR - causes abort
+ unsigned int foo:0; // { dg-error "" } causes abort
unsigned int field;
};
+// { dg-do assemble }
// GROUPS abort
-// Build don't link:
// g++ 1.37.1 bug 900519_12
// The following erroneous code causes g++ to segfault.
// keywords: segfault, typedef, pointer type, function type
-typedef eek void (*)(); // ERROR -
+typedef eek void (*)(); // { dg-error "" }
-// Build don't link:
+// { dg-do assemble }
class X{
unsigned int i;
+// { dg-do assemble }
// Test that defining a static member of private type with the () syntax works.
-// Build don't link:
class A {
private:
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-w" }
// Origin: r.spatschek@fz-juelich.de
-// Special g++ Options: -w
class A
{
};
template <>
-void A::g<int>(int t) { i = 1; } // ERROR - private
+void A::g<int>(int t) { i = 1; } // { dg-error "" } private
int main()
{
A a;
- a.g<int>(0); // ERROR - private
+ a.g<int>(0); // { dg-error "" } private
}
-// Build don't link:
+// { dg-do assemble }
// Based on a test-case in the Standard, submitted by several people
class Outer {
typedef int T;
struct Inner {
- T i; // ERROR - not accessible - XFAIL *-*-*
+ T i; // { dg-error "" "" { xfail *-*-* } } not accessible -
void f() {
- T j; // ERROR - not accessible - XFAIL *-*-*
+ T j; // { dg-error "" "" { xfail *-*-* } } not accessible -
}
};
};
-// Build don't link:
+// { 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.
-// Build don't link:
+// { dg-do assemble }
-struct A { // ERROR - inaccessible
+struct A { // { dg-error "" } inaccessible
static int i;
};
struct B : private A { };
struct C : public B {
- int f () { return A::i; } // ERROR - context
+ int f () { return A::i; } // { dg-error "" } context
};
-// Build don't link:
+// { dg-do assemble }
class A
{
-// Build don't link:
+// { dg-do assemble }
template <int I>
struct S {
};
class C {
- static const int i = 3; // gets bogus error - private
+ static const int i = 3; // { dg-bogus "" } private
public:
- S<C::i>* f(); // gets bogus error - redeclared
+ S<C::i>* f(); // { dg-bogus "" } redeclared
};
-S<C::i>* C::f() { // gets bogus error - private
+S<C::i>* C::f() { // { dg-bogus "" } private
return 0;
}
+// { dg-do assemble }
// Test that access control for types and statics works properly
// with nested types.
-// Build don't link:
class A {
- static int I1; // ERROR - private
- struct B1 { }; // ERROR - private
+ static int I1; // { dg-error "" } private
+ struct B1 { }; // { dg-error "" } private
public:
static int I2;
struct B2 { };
void D::E::f ()
{
- int i = I1; // ERROR - within this context
- B1 b1; // ERROR - within this context
+ int i = I1; // { dg-error "" } within this context
+ B1 b1; // { dg-error "" } within this context
i = I2;
B2 b2;
}
void f ()
{
- A::B1 b1; // ERROR - within this context
- new A::B1; // ERROR - within this context
- (A::B1) b1; // ERROR - within this context
+ A::B1 b1; // { dg-error "" } within this context
+ new A::B1; // { dg-error "" } within this context
+ (A::B1) b1; // { dg-error "" } within this context
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 10 Feb 2000 <nathan@acm.org>
+// { dg-do assemble }
// Test that g++ allows friends to use private types in their declarations.
-// Build don't link:
class A {
typedef int I;
+// { dg-do run }
extern "C" void abort ();
-// Build don't link:
+// { dg-do assemble }
#include <string.h>
class bar {
-// Build don't link:
+// { dg-do assemble }
struct A {
- int operator ++(); // ERROR - candidates
- void operator ()(); // ERROR - candidates
- void operator delete(void*); // ERROR - candidates
+ int operator ++(); // { dg-error "" } candidates
+ void operator ()(); // { dg-error "" } candidates
+ void operator delete(void*); // { dg-error "" } candidates
};
struct B {
- int operator ++(int); // ERROR - candidates
- void operator ()(); // ERROR - candidates
- void operator delete(void*); // ERROR - candidates
+ int operator ++(int); // { dg-error "" } candidates
+ void operator ()(); // { dg-error "" } candidates
+ void operator delete(void*); // { dg-error "" } candidates
void f();
};
C c;
C* cp;
- delete cp; // ERROR - ambiguous
- c(); // ERROR - ambiguous
- c++; // ERROR - ambiguous
+ delete cp; // { dg-error "" } ambiguous
+ c(); // { dg-error "" } ambiguous
+ c++; // { dg-error "" } ambiguous
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Aug 1999 <nathan@acm.org>
void fn(D0 *d0, D1 *d1, D2 *d2, D3 *d3)
{
- A *a0 = d0; // ERROR - A is an ambiguous base
- A *a1 = d1; // ERROR - A is an ambiguous base
- A *a2 = d2; // ERROR - A is an ambiguous base
- A *a3 = d3; // ERROR - A is an ambiguous base
+ 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
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 23 June 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
static union {
union {
};
-}; // WARNING - anonymous union with no members
+}; // { dg-warning "" } anonymous union with no members
+// { dg-do run }
extern "C" void abort (void);
static union {
+// { dg-do run }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 20 May 1999 <nathan@acm.org>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 20 May 1999 <nathan@acm.org>
struct A
{
union
- { // ERROR - anon union cannot have member fns
+ { // { dg-error "" } anon union cannot have member fns
void bad();
};
};
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Nov 2000 <nathan@codesourcery.com>
+// { dg-do run }
extern "C" void abort ();
struct A {
-// Build don't link:
+// { dg-do assemble }
struct A {
union {
- int a; // ERROR - conflicts with previous declaration
+ int a; // { dg-error "" } conflicts with previous declaration
};
- int a; // ERROR -
+ int a; // { dg-error "" }
};
struct B {
- int b; // ERROR - conflicts with previous declaration
+ int b; // { dg-error "" } conflicts with previous declaration
union {
- int b; // ERROR - duplicate member
- }; // ERROR - declaration of
+ int b; // { dg-error "" } duplicate member
+ }; // { dg-error "" } declaration of
};
struct C {
union {
- int c; // ERROR - conflicts with previous declaration
+ int c; // { dg-error "" } conflicts with previous declaration
};
union {
- int c; // ERROR - duplicate member
- }; // ERROR - declaration of
+ int c; // { dg-error "" } duplicate member
+ }; // { dg-error "" } declaration of
};
-// Build don't link:
+// { dg-do assemble }
struct B
{
+// { 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; // ERROR - referenced below
-void f (T* t); // ERROR - uses unnamed type
+typedef const struct { int i; } T; // { dg-error "" } referenced below
+void f (T* t); // { dg-error "" } uses unnamed type
+// { dg-do run }
int i;
struct S {
+// { dg-do run }
int i;
struct S {
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 10 Aug 2000 <nathan@codesourcery.com>
B::B (const A a[])
: ary(a)
-{ // ERROR - bad array initializer
+{ // { dg-error "" } bad array initializer
}
-// Build don't link:
+// { dg-do assemble }
// Origin: j_bouis@hotmail.com
enum { FOO = 3 };
-// Build don't link:
+// { dg-do assemble }
// We tried to create a temporary of unknown size and crashed.
extern int a1[];
-// Special g++ Options: -O1
+// { dg-do run }
+// { dg-options "-O1" }
int count = 0;
-// Build don't link:
+// { dg-do assemble }
template <class T> class A {
T *d;
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S {
- int i asm ("abc"); // ERROR - `asm' specifier not permitted
+ int i asm ("abc"); // { dg-error "" } `asm' specifier not permitted
};
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct C
void C::f ()
{
- asm ("" : : "m" (f)); // ERROR - type could not be determined
+ asm ("" : : "m" (f)); // { dg-error "" } type could not be determined
}
-// Build don't link:
-// Skip if not target: i?86-*-* x86_64-*-*
-// Special g++ Options: -O2
+// { dg-do assemble { target i?86-*-* x86_64-*-* } }
+// { dg-options "-O2" }
typedef unsigned long long uint64;
uint64 fstps(void)
-// Build don't link:
+// { dg-do assemble }
struct S {
int i;
void f()
{
- s->i = 3; // ERROR - base operand
+ s->i = 3; // { dg-error "" } base operand
}
+// { dg-do run }
+// { dg-options "-O2" }
// Based on a testcase by Bryan Weston <bryanw@bluemoon.sps.mot.com>
// egcs 1.1 fails to increment count
-// Special g++ Options: -O2
struct Base { Base() {} }; // removing the constructor fixes the problem
struct Derived : Base {}; // so does removing the base class
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 25 Nov 2000 <nathan@codesourcery.com>
typedef const A cA;
typedef A pA;
-struct B : I {}; // ERROR - not an aggregate
-struct C : cI {}; // ERROR - not an aggregate
-struct D : cA {}; // ERROR - cv qualified
+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 {};
-// Build don't link:
+// { dg-do assemble }
// Based on a bug report by Stephen Vavasis <vavasis@CS.Cornell.EDU>
// declares template operator!=
+// { dg-do assemble }
+// { dg-options "-funsigned-bitfields" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options: -funsigned-bitfields
typedef int i[4];
struct S {
- i j:12; // ERROR - array type as bitfield
+ i j:12; // { dg-error "" } array type as bitfield
};
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 Jun 1999 <nathan@acm.org>
-// Build don't link:
+// { dg-do assemble }
// Origin: "Chen, Wen-Ke" <chwk@cs.arizona.edu>
template <class T>
-// Build don't link:
-// Special g++ Options: -w
+// { dg-do assemble }
+// { dg-options "-w" }
struct S
{
+// { 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.
//
-// Special g++ Options: -O2
namespace std
{
-// Build don't link:
+// { 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.
+// { 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.
//
-// Special g++ Options: -O2
namespace std
{
+// { 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.
//
-// Special g++ Options: -O2
namespace std
{
+// { 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.
//
-// Special g++ Options: -O2
namespace std
{
-// Build don't link:
+// { 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"); // ERROR - undeclared
+ return (int) ::strlen ("foo"); // { dg-error "" } undeclared
}
int
bar ()
{
- return (int) std::strlen ("bar"); // ERROR - undeclared
+ return (int) std::strlen ("bar"); // { dg-error "" } undeclared
}
+// { 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.
//
-// Special g++ Options: -O2
typedef __SIZE_TYPE__ size_t;
extern "C" size_t strlen (const char*);
+// { 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.
//
-// Special g++ Options: -O2
extern "C" void link_error (void);
+// { 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.
//
-// Special g++ Options: -O2
extern "C" void link_error (void);
+// { dg-do run }
// Test that inline redeclarations of builtins are emitted.
// Origin: Roger Sayle Mar 28, 2002
// Copyright (C) 2002 Free Software Foundation.
+// { dg-do run }
// Test that various calls to non-functions work.
void f () { }
-// Build don't link:
+// { dg-do assemble }
struct S0 { };
struct S1 : virtual public S0 { };
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct A {
typedef void (A::*F)();
F p;
- const_cast<const A>(a); // ERROR - const_cast requires pointer/ref types
- const_cast<F>(p); // ERROR - const_cast requires pointer/ref types
- const_cast<int (*)()>(&main); // ERROR - function type in const_cast
- const_cast<int (&)()>(main); // ERROR - function type in const_cast
+ const_cast<const A>(a); // { dg-error "" } const_cast requires pointer/ref types
+ const_cast<F>(p); // { dg-error "" } const_cast requires pointer/ref types
+ const_cast<int (*)()>(&main); // { dg-error "" } function type in const_cast
+ const_cast<int (&)()>(main); // { dg-error "" } function type in const_cast
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 12 Dec 1999 <nathan@acm.org>
static_cast <int *const *> (p);
static_cast <int const *const *> (p);
- static_cast <X *> (cp); // ERROR - lose const
+ static_cast <X *> (cp); // { dg-error "" } lose const
static_cast <X const *> (cp);
- static_cast <int *> (cp); // ERROR - lose const
+ static_cast <int *> (cp); // { dg-error "" } lose const
static_cast <int const *> (cp);
- static_cast <int **> (cp); // ERROR - lose const
- static_cast <int const **> (cp); // ERROR - lose const
+ static_cast <int **> (cp); // { dg-error "" } lose const
+ static_cast <int const **> (cp); // { dg-error "" } lose const
static_cast <int *const *> (cp);
static_cast <int const *const *> (cp);
static_cast <Z *> (yp);
static_cast <Z const *> (yp);
- static_cast <Z *> (ycp); // ERROR - lose const
+ static_cast <Z *> (ycp); // { dg-error "" } lose const
static_cast <Z const *> (ycp);
static_cast <Y *> (zp);
static_cast <Y const *> (zp);
- static_cast <Y *> (zcp); // ERROR - lose const
+ static_cast <Y *> (zcp); // { dg-error "" } lose const
static_cast <Y const *> (zcp);
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 3 Jan 2000 <nathan@acm.org>
static_cast <char *> (a);
static_cast <char *> (b);
- static_cast <char *> (c); // ERROR - static cast
- static_cast <char *> (d); // ERROR - static cast
+ static_cast <char *> (c); // { dg-error "" } static cast
+ static_cast <char *> (d); // { dg-error "" } static cast
}
void f1 ()
C const c = C ();
D const d = D ();
- static_cast <char *> (a); // ERROR - static cast
+ static_cast <char *> (a); // { dg-error "" } static cast
static_cast <char *> (b);
- static_cast <char *> (c); // ERROR - static cast
- static_cast <char *> (d); // ERROR - static cast
+ static_cast <char *> (c); // { dg-error "" } static cast
+ static_cast <char *> (d); // { dg-error "" } static cast
}
void f3 ()
C const c = C ();
D const d = D ();
- static_cast <const char *> (a); // ERROR - static cast
+ static_cast <const char *> (a); // { dg-error "" } static cast
static_cast <const char *> (b);
- static_cast <const char *> (c); // ERROR - static cast
+ static_cast <const char *> (c); // { dg-error "" } static cast
static_cast <const char *> (d);
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 Feb 2000 <nathan@acm.org>
void f0 (ary_t const *const &ary)
{
static_cast <void const *> (ary);
- static_cast <void *> (ary); // ERROR - casts away const
+ static_cast <void *> (ary); // { dg-error "" } casts away const
(void const *) (ary);
}
void f2 (ary_t const *&ary)
{
static_cast <void const *> (ary);
- static_cast <void *> (ary); // ERROR - casts away const
+ static_cast <void *> (ary); // { dg-error "" } casts away const
(void const *) (ary);
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 28 Nov 2000 <nathan@codesourcery.com>
{
{
foofPtr fp = &foo::b;
- barfPtr bp = static_cast <barfPtr> (fp); // ERROR - invalid static_cast
- foofPtr fp2 = static_cast <foofPtr> (bp); // ERROR - invalid static_cast
- foofPtr fp3 = bp; // ERROR - cannot convert
- fp3 = (foofPtr)bp; // WARNING - via virtual base
+ barfPtr bp = static_cast <barfPtr> (fp); // { dg-error "" } invalid static_cast
+ foofPtr fp2 = static_cast <foofPtr> (bp); // { dg-error "" } invalid static_cast
+ foofPtr fp3 = bp; // { dg-error "" } cannot convert
+ fp3 = (foofPtr)bp; // { dg-warning "" } via virtual base
foomPtr fmp = &foo::m;
- barmPtr bmp = static_cast <barmPtr> (fmp); // ERROR - invalid static_cast
- foomPtr fmp2 = static_cast <foomPtr> (bmp); // ERROR - invalid static_cast
- foomPtr fmp3 = bmp; // ERROR - cannot convert
- fmp3 = (foomPtr)bmp; // WARNING - via virtual base
+ barmPtr bmp = static_cast <barmPtr> (fmp); // { dg-error "" } invalid static_cast
+ foomPtr fmp2 = static_cast <foomPtr> (bmp); // { dg-error "" } invalid static_cast
+ foomPtr fmp3 = bmp; // { dg-error "" } cannot convert
+ fmp3 = (foomPtr)bmp; // { dg-warning "" } via virtual base
}
return 0;
+// { dg-do run }
// Test that we can add cv-quals in a static cast to a pointer-to-base type.
struct A { int i; };
+// { dg-do run }
// Bug: fold is too eager about pushing down CLEANUP_POINT_EXPR.
int d;
+// { dg-do run }
+// { dg-options "-O -fno-exceptions -w" }
// Origin: Bryan Scattergood <bryan@fsel.com>
-// Special g++ Options: -O -fno-exceptions -w
extern "C" void abort();
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O2 -fno-exceptions" }
// Origin: Jakub Jelinek <jakub@redhat.com>
-// Special g++ Options: -O2 -fno-exceptions
class foo
{
+// { dg-do run }
+// { dg-gpp-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.
-// Special g++ Options: -O
-
-// Additional sources: comdat1-aux.cc
-
inline int f ()
{
static int i;
+// { dg-do run }
+// { dg-gpp-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.
-// Special g++ Options: -O
-
-// Additional sources: comdat2-aux.cc
-
template <class T>
struct S {
static int f ()
+// { dg-do run }
+// { dg-gpp-additional-sources " comdat3-aux.cc" }
// Test that duplicate elimination of implicit instantiations of static
// data members works properly.
-// Additional sources: comdat3-aux.cc
// Additional files: comdat3.h
#include "comdat3.h"
-// Build don't run:
+// { dg-do link }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
// Origin: Loring Holden <lsh@cs.brown.edu>
class Wpt {};
-// Build don't link:
+// { dg-do assemble }
// Origin: Loring Holden <lsh@cs.brown.edu>
class Wtransf {};
-// Build don't link:
+// { dg-do assemble }
// Origin: Loring Holden <lsh@cs.brown.edu>
template <class V>
-// Build don't link:
-// Special g++ Options: -W -pedantic -ansi
+// { dg-do assemble }
+// { dg-options "-W -pedantic -ansi" }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 1 Sep 1999 <nathan@acm.org>
double d;
int j;
- j = (i ? e1 : e2); // WARNING - mismatch
- d = (i ? e1 : 1.0); // WARNING - mismatch
- d = (i ? 1.0 : e2); // WARNING - mismatch
+ j = (i ? e1 : e2); // { dg-warning "" } mismatch
+ d = (i ? e1 : 1.0); // { dg-warning "" } mismatch
+ d = (i ? 1.0 : e2); // { dg-warning "" } mismatch
E1 e = (i ? e1 : e1); // ok
j = (i ? 1 : e2); // ok
j = (i ? e1 : 1); // ok
(i ? throw X() : throw X()); // ok, void
(i ? i : j) = 1; // ok, int &
- (i ? throw X() : j) = 1; // ERROR - non lvalue
- (i ? j : throw X()) = 1; // ERROR - non lvalue
- (i ? throw X() : throw X()) = 1; // ERROR - invalid use of void
+ (i ? throw X() : j) = 1; // { dg-error "" } non lvalue
+ (i ? j : throw X()) = 1; // { dg-error "" } non lvalue
+ (i ? throw X() : throw X()) = 1; // { dg-error "" } invalid use of void
- (i ? (void)1 : i++); // WARNING - not a throw
- (i ? i++ : (void)1); // WARNING - not a throw
+ (i ? (void)1 : i++); // { dg-warning "" } not a throw
+ (i ? i++ : (void)1); // { dg-warning "" } not a throw
}
+// { dg-do assemble }
// Test that the result of `x ? const E : E' is an E rvalue.
// Contributed by Jason Merrill <jason@cygnus.com>
E e1 = a;
const E &er = e1;
E e2 = b ? er : a; // OK
- const E* ep = &(b ? er : a); // ERROR - non-lvalue
+ const E* ep = &(b ? er : a); // { dg-error "" } non-lvalue
}
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 Jul 2001 <nathan@codesourcery.com>
void foo (bool a)
{
- x << (a ? OVL1 : OVL2); // ERROR - incomplete type
- a ? OVL1 : OVL2; // ERROR - incomplete type
+ x << (a ? OVL1 : OVL2); // { dg-error "" } incomplete type
+ a ? OVL1 : OVL2; // { dg-error "" } incomplete type
}
-// Build don't link:
+// { dg-do assemble }
struct S
{
void f()
{
- const int i; // ERROR - uninitialized const
+ const int i; // { dg-error "" } uninitialized const
}
};
-// Build don't link:
+// { dg-do assemble }
struct S {
- static const char* cp = "abc"; // ERROR - initialization of non-const
+ static const char* cp = "abc"; // { dg-error "" } initialization of non-const
};
-// Build don't link:
+// { dg-do assemble }
class X {
public:
- const operator int (); // ERROR - invalid declaration.
+ const operator int (); // { dg-error "" } invalid declaration.
};
-// Build don't link:
-// Special g++ Options: -pedantic-errors
+// { dg-do assemble }
+// { dg-options "-pedantic-errors" }
void cheat( int* i ) { ++(*i); }
int main()
{
- void (t::*member)( const int& ) = &t::cheat; // ERROR - conversion
- void (*cheater)( const int* ) = &cheat; // ERROR - converting
+ 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;
-// Build don't link:
+// { dg-do assemble }
// submitted by David C Binderman <dcb@pncl.co.uk>
void
f()
{
- int * ip = var; // ERROR - requires const_cast
+ int * ip = var; // { dg-error "" } requires const_cast
}
+// { dg-do run }
// Testcase for proper hiding of base conversion ops.
struct A
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// Based on bug report by Thomas Kunert <kunert@physik.tu-dresden.de>
-// Special g++ Options:
int foo();
-const int (*bar)() = foo; // ERROR - adding const
+const int (*bar)() = foo; // { dg-error "" } adding const
+// { dg-do run }
// Test for composite pointer types, as defined in [expr.rel],
// and common pointer to member types, as defined in [expr.eq].
// The composite type is `A const *'
A* ap = &b;
const B* bp = &b;
- if (ap != bp) // gets bogus error - distinct types
+ 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) // gets bogus error - distinct types
+ 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) // gets bogus error - distinct types
+ if (apm != bpm) // { dg-bogus "" } distinct types
return 1;
}
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 5 May 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
// Origin: Jakub Jelinek <jakub@redhat.com>
class bar
{
typedef void(foo::*t)();
t c = & foo::b;
- d = (T) c; // WARNING - pointer to member cast
+ d = (T) c; // { dg-warning "" } pointer to member cast
}
-// Build don't link:
+// { dg-do assemble }
struct
Foo
+// { dg-do run }
// Bug: expand_vec_init doesn't copy arrays of builtin types.
struct B {
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
int i;
-// Build don't run:
+// { dg-do link }
// Origin: ericp@mit.edu
class bar {
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
struct A {
+// { dg-do assemble }
class A
{
- enum B { ONE, TWO, THREE }; // ERROR - private
+ enum B { ONE, TWO, THREE }; // { dg-error "" } private
};
-class A::B; // ERROR - A::B is not a class type, context
+class A::B; // { dg-error "" } A::B is not a class type, context
-// Build don't link:
+// { dg-do assemble }
// Origin: Loring Holden <lsh@cs.brown.edu>
template <class T>
+// { dg-do assemble }
// Origin: Alfred Minarik <a8601248@unet.univie.ac.at>
-// Build don't link:
template <typename T>
struct allocator
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// Origin: Alfred Minarik <a8601248@unet.univie.ac.at>
-// Special g++ Options:
template<typename T>
struct S
-// Build don't link:
+// { dg-do assemble }
struct Base_bitset {
unsigned M_w[2];
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S
+// { 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.
-// Special g++ Options: -O2
-// Build don't link:
class AA {};
-// Build don't link:
-// Special g++ Options: -O2
+// { dg-do assemble { xfail *-*-* } }
+// { dg-options "-O2" }
// Origin: scott snyder <snyder@fnal.gov>
-// crash test - XFAIL *-*-*
void _S_initialize();
-// Build don't link:
+// { dg-do assemble }
// Origin: Dima Volodin <dvv@dvv.org>
class C {
- static int const N (1000); // ERROR - invalid declaration
+ static int const N (1000); // { dg-error "" } invalid declaration
};
-// Build don't link:
-// Special g++ Options: -fvtable-gc -S
+// { dg-do assemble }
+// { dg-options "-fvtable-gc -S" }
// Origin: Mark Mitchell <mitchell@codesourcery.com>
struct S {
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
struct A {
int rep;
- static const A a(0); // ERROR - initialization
- static const A b = 3; // ERROR - initialization
- static const A& c = 2; // ERROR - initialization
+ 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) {}
};
-// Build don't link:
+// { dg-do assemble }
#include <typeinfo>
-// Build don't link:
+// { dg-do assemble }
// Origin: Gabriel Dos Reis <gdr@codesourcery.com>
struct A {
int x;
};
-void B::f(int& t) { // ERROR - undeclared method
+void B::f(int& t) { // { dg-error "" } undeclared method
x = t;
}
-// Build don't run:
-// Special g++ Options: -O2
+// { dg-do link }
+// { dg-options "-O2" }
class foo
{
-// Build don't link:
+// { dg-do assemble }
// Origin: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
class T;
-inline void operator<(T&, T&) { } // ERROR - previous definition
-inline void operator<(T&, T&) { } // ERROR - duplicate definition
+inline void operator<(T&, T&) { } // { dg-error "" } previous definition
+inline void operator<(T&, T&) { } // { dg-error "" } duplicate definition
-// Build don't link:
+// { dg-do assemble }
// Origin: Jakub Jelinek <jakub@redhat.com>
class foo {
friend class __iterator;
typedef __iterator const_iterator;
virtual ~foo() { }
- __iterator begin(); // ERROR -
+ __iterator begin(); // { dg-error "" }
};
static void iteratorTest(const foo &x)
{
- foo::const_iterator i = x.begin(); // ERROR -
+ foo::const_iterator i = x.begin(); // { dg-error "" }
for (; i; ++i)
*i;
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Jakub Jelinek <jakub@redhat.com>
class X {
}
X::x()
-{ // ERROR -
+{ // { dg-error "" }
}
-X::~x() // ERROR -
+X::~x() // { dg-error "" }
{
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Jakub Jelinek <jakub@redhat.com>
class foo {
void bar(bool x)
{
if(x)
- foo *a = new foo(foo::not); // ERROR -
+ foo *a = new foo(foo::not); // { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Jakub Jelinek <jakub@redhat.com>
-X(Y(long, Type, CLink)); break; default: break; } } } // ERROR -
+X(Y(long, Type, CLink)); break; default: break; } } } // { dg-error "" }
struct A {
inline A ();
-// Build don't link:
+// { dg-do assemble }
// Origin: Jakub Jelinek <jakub@redhat.com>
namespace N
};
void foo::x() throw(bar)
{
- if (!b) throw bar (static_cast<::N::X*>(this)); // ERROR - parse error
+ if (!b) throw bar (static_cast<::N::X*>(this)); // { dg-error "" } parse error
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Jakub Jelinek <jakub@redhat.com>
class bar
};
void bar::foo ()
{
- baz x(); // ERROR -
+ baz x(); // { dg-error "" }
}
-// Build don't link:
-// Special g++ Options: -g -O2
+// { dg-do assemble }
+// { dg-options "-g -O2" }
inline void f() {
struct S {};
-// Build don't link:
+// { dg-do assemble }
// Origin: Jakub Jelinek <jakub@redhat.com>
struct foo
void x();
};
-void foo::x() throw(bar) // ERROR - parse error
+void foo::x() throw(bar) // { dg-error "" } parse error
{
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Jakub Jelinek <jakub@redhat.com>
-// excess errors test - XFAIL *-*-*
+// { dg-bogus "" "" { xfail *-*-* } 13 }
namespace bar
{
{
foo();
};
- // ERROR - parse error XFAIL *-*-*
+ // { dg-error "" "" { xfail *-*-* } }
-// Build don't link:
+// { dg-do assemble }
// Origin: Jakub Jelinek <jakub@redhat.com>
-// excess errors test - XFAIL *-*-*
-
struct foo
{
enum e
{
- not // ERROR -
- };
- ~foo();
+ not // { dg-error "" }
+ }; // { dg-bogus "" "" { xfail *-*-* } }
+ ~foo(); // { dg-bogus "" "" { xfail *-*-* } }
void x (foo *&a, bool b = (unsigned char)0);
-};
+}; // { dg-bogus "" "" { xfail *-*-* } }
namespace N
{
typedef baz<bar> c;
}
-struct z // crash test - XFAIL *-*-*
{
int a;
};
-// Build don't link:
+// { dg-do assemble }
// Origin: Jakub Jelinek <jakub@redhat.com>
template <class T>
-// Build don't link:
+// { dg-do assemble { xfail *-*-* } }
// Origin: Jakub Jelinek <jakub@redhat.com>
-// crash test - XFAIL *-*-*
class v
{
-// Build don't link:
+// { dg-do assemble }
// Origin: Jakub Jelinek <jakub@redhat.com>
void foo()
{
- if [ // ERROR - parse error
+ if [ // { dg-error "" } parse error
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 7 Nov 2000 <nathan@codesourcery.com>
// to the standard's expectation.
void *operator new (__SIZE_TYPE__); // ok
-void operator new (__SIZE_TYPE__); // ERROR - must return void *
-void *operator new (); // ERROR - must take size_t
-void *operator new (char); // ERROR - must take size_t
+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 (); // ERROR - must return void
-void operator delete () throw (); // ERROR - must take void *
-void operator delete (int *) throw (); // ERROR - must take void *
+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 (); // ERROR - must take void *
+void operator delete (...) throw (); // { dg-error "" } must take void *
void operator delete (void *, ...) throw (); // ok
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 23 Nov 2000 <nathan@codesourcery.com>
int main()
{
- bifstream bifs; // ERROR - incomplete type
+ bifstream bifs; // { dg-error "" } incomplete type
if (!bifs)
{
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 28 Nov 2000 <nathan@codesourcery.com>
// Bug 611. We ICEd when calling a member function returning an incomplete
// type by value.
-struct X; // ERROR - forward ref
+struct X; // { dg-error "" } forward ref
struct Y
{
void baz (Y *p)
{
- p->foo (); // ERROR - incomplete
+ p->foo (); // { dg-error "" } incomplete
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 10 Jan 2001 <nathan@codesourcery.com>
{
~X ();
};
-struct S { X a; }; // ERROR - previous defn
-struct S { X a; }; // ERROR - redefinition
+struct S { X a; }; // { dg-error "" } previous defn
+struct S { X a; }; // { dg-error "" } redefinition
void c1(S s)
{
-// Build don't link:
+// { dg-do assemble }
struct T {
- struct S __attribute__ ((packed)) { // ERROR - parse error
+ struct S __attribute__ ((packed)) { // { dg-error "" } parse error
int i;
};
};
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 11 April 2001 <nathan@codesourcery.com>
// Origin: Theo Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 8 May 2001 <nathan@codesourcery.com>
// Bug 2744. We ICE'd on strange characters
-@ // ERROR - parse error
-int a; #// ERROR - parse error
-## // ERROR - parse error
-$ // ERROR - parse error
-£ // ERROR - parse error
-` // ERROR - parse error
+@ // { 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
-// Build don't link:
-// Special g++ Options: -g
+// { dg-do assemble }
+// { dg-options "-g" }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 25 Jul 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
class TecMesh {};
-// Build don't link:
-// Special g++ Options: -O2
+// { dg-do assemble }
+// { dg-options "-O2" }
struct E
{
-// Build don't link:
+// { dg-do assemble }
void foo ()
{
int e;
- e := e; // ERROR - parse error
+ e := e; // { dg-error "" } parse error
}
-// Build don't link:
+// { dg-do assemble }
void f()
{
union {
private:
- int i; // ERROR - private
+ int i; // { dg-error "" } private
} u;
- u.i = 3; // ERROR - within this context
+ u.i = 3; // { dg-error "" } within this context
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
int main()
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
struct A { };
-// Additional sources: ctor1-aux.cc
+// { dg-do run }
+// { dg-gpp-additional-sources " ctor1-aux.cc" }
+
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
int i = 3;
-// Build don't link:
+// { dg-do assemble }
typedef int Array_T[2];
-// Build don't link:
+// { dg-do assemble }
class C {
public:
void f ()
{
- dynamic_cast<void*>(cp); // ERROR - cannot dynamic_cast
- dynamic_cast<C&>(cr); // ERROR - cannot dynamic_cast
+ dynamic_cast<void*>(cp); // { dg-error "" } cannot dynamic_cast
+ dynamic_cast<C&>(cr); // { dg-error "" } cannot dynamic_cast
}
-// Build don't link:
+// { dg-do assemble }
// Based on a testcase by Ruslan Shevchenko <Ruslan@Shevchenko.Kiev.UA>
void foo() {
B x;
- dynamic_cast<D*>(&x); // WARNING - will never succeed
+ dynamic_cast<D*>(&x); // { dg-warning "" } will never succeed
B* p = &x;
dynamic_cast<D*>(p);
}
-// Build don't link:
-// Special g++ Options: -g
+// { dg-do assemble }
+// { dg-options "-g" }
typedef unsigned int size_t;
-// Build don't link:
-// Special g++ Options: -funroll-loops -O2 -g
+// { dg-do assemble }
+// { dg-options "-funroll-loops -O2 -g" }
inline void f()
{
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O2" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options: -O2
struct S
{
-// Build don't link:
-// Special g++ Options: -g
+// { dg-do assemble }
+// { dg-options "-g" }
typedef volatile struct {
int i;
-// Build don't link:
-// Special g++ Options: -g
+// { dg-do assemble }
+// { dg-options "-g" }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S
-// Build don't link:
-// Special g++ Options: -g -O2
+// { dg-do assemble }
+// { dg-options "-g -O2" }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>
-// Build don't run:
+// { dg-do link }
+// { dg-options "-g -O2" }
// Origin: Loren James Rittle <rittle@latour.rsch.comm.mot.com>
-// Special g++ Options: -g -O2
namespace std {
const int __stl_chunk_size = 7;
-// Build don't link:
-// Special g++ Options: -g
+// { dg-do assemble }
+// { dg-options "-g" }
struct X {
const int x[4];
-// Build don't link:
-// Special g++ Options: -g
+// { dg-do assemble }
+// { dg-options "-g" }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Jeffrey D. Oldham 2001 May 17 <oldham@codesourcery.com>.
-// Build don't link:
+// { dg-do assemble }
// Based on a test case by Phil Blecker <tmwg@inxservices.com>
-// excess errors test
int foo(int);
int bar() {
-// Build don't link:
+// { dg-do assemble }
// Based on a test-case by Maciej Radziejewski <maciejr@iws.uni-stuttgart.de>
-int i(0)(1); // ERROR - multiple initialization
-int j(2) = 3; // ERROR - multiple initialization
-int k(4)(5)(6); // ERROR - multiple initialization
-int m, n(7)(8); // ERROR - multiple initialization
+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
-// Build don't link:
+// { dg-do assemble }
// Origin: Adapted by Nathan Sidwell 29 Apr 1999 <nathan@acm.org>
// from a test case submitted by Corey Kosak <kosak@cs.cmu.edu>
// We should not allow arrays of abstract type. [class.abstract/2]
struct cow_t {
- virtual void f()=0; // ERROR - abstract
+ virtual void f()=0; // { dg-error "" } abstract
};
int main()
{
- cow_t cow[2]; // ERROR - abstract class
+ cow_t cow[2]; // { dg-error "" } abstract class
cow[0].f();
return 0;
}
-// Build don't link:
+// { dg-do assemble }
// Reported by Harri Porten <porten@tu-harburg.de>
// Simplified for testsuite by Alexandre Oliva
-// Build don't link:
+// { dg-do assemble }
-// Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+// Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 22 Apr 1999 <nathan@acm.org>
// derived from a bug report by <rch@larissa.sd.bi.ruhr-uni-bochum.de>
// http://gcc.gnu.org/ml/gcc-bugs/1999-04n/msg00631.html
struct A {
- int A::fn(); // WARNING - extra qualification
- int A::m; // WARNING - extra qualification
+ int A::fn(); // { dg-warning "" } extra qualification
+ int A::m; // { dg-warning "" } extra qualification
struct e;
struct A::e {int i;};
- struct A::expand { // WARNING - extra qualification
+ struct A::expand { // { dg-warning "" } extra qualification
int m;
};
struct Z;
expand me;
void foo(struct A::e);
- void foo(struct A::z); // WARNING - extra qualification
+ void foo(struct A::z); // { dg-warning "" } extra qualification
};
struct Q;
struct B {
- struct A::fink { // ERROR - no such member
+ struct A::fink { // { dg-error "" } no such member
int m;
};
- struct A::Z { // ERROR - A::Z not a member of B
+ struct A::Z { // { dg-error "" } A::Z not a member of B
int m;
};
int m;
int n;
- struct ::Q { // ERROR - ::Q not a member of B
+ struct ::Q { // { dg-error "" } ::Q not a member of B
int m;
};
- int A::fn() { // ERROR - A::fn not a member of B
+ int A::fn() { // { dg-error "" } A::fn not a member of B
return 0;
}
void fn(struct ::Q &);
- void foo(struct A::y); // ERROR - no such member
+ void foo(struct A::y); // { dg-error "" } no such member
};
-struct ::C { // WARNING - extra qualification
+struct ::C { // { dg-warning "" } extra qualification
int i;
};
namespace NMS
{
- void NMS::fn(); // WARNING - extra qualification XFAIL
- int NMS::i; // WARNING - extra qualification XFAIL
- struct NMS::D { // WARNING - extra qualification
+ void NMS::fn(); // { dg-warning "" "" { xfail *-*-* } } extra qualification
+ int NMS::i; // { dg-warning "" "" { xfail *-*-* } } extra qualification
+ struct NMS::D { // { dg-warning "" } extra qualification
int i;
};
- struct N::E { // ERROR - no such type
+ struct N::E { // { dg-error "" } no such type
int i;
};
- struct ::F { // ERROR - no such type
+ struct ::F { // { dg-error "" } no such type
int i;
};
- int N::fn() { // ERROR - N::fn not a member of NMS
+ int N::fn() { // { dg-error "" } N::fn not a member of NMS
return 0;
}
- struct N::F { // ERROR - N::F not a member of NMS
+ struct N::F { // { dg-error "" } N::F not a member of NMS
int i;
};
}
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 27 Sep 1999 <nathan@acm.org>
struct B {};
struct A
{
- friend explicit int j(); // ERROR - only ctor decls can be explicit
- friend explicit B::B (); // ERROR - only ctor decls can be explicit
- int f(const); // ERROR - ansi forbids no type
- const k; // ERROR - ansi forbids no type
- mutable friend int j1 (); // ERROR - non-member cannot be mutable
- mutable typedef int d; // ERROR - non-object cannot be mutable
- mutable int fn (); // ERROR - non-object cannot be mutable
- void fn (mutable int); // ERROR - non-member cannot be mutable
- mutable static int s; // ERROR - static cannot be mutable
- mutable const int s1; // ERROR - const cannot be mutable
+ 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; // ERROR - const cannot be mutable
+ mutable int *const s3; // { dg-error "" } const cannot be mutable
explicit A (); // ok
};
-mutable int g; // ERROR - non-member cannot be mutable
-explicit A::A () {} // ERROR - only ctor decls can be explicit
+mutable int g; // { dg-error "" } non-member cannot be mutable
+explicit A::A () {} // { dg-error "" } only ctor decls can be explicit
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S
-// Build don't link:
+// { dg-do assemble }
// Origin: Sergei Organov <osv@javad.ru>
void foo(void)
{
- extern int i; // ERROR - previous declaration
- extern double i; // ERROR - conflicting type
+ extern int i; // { dg-error "" } previous declaration
+ extern double i; // { dg-error "" } conflicting type
extern int j;
extern int j;
}
+// { dg-do assemble }
// Build don't link
// Origin: batali@cogsci.ucsd.edu
// Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
typedef struct { } S; // OK
-typedef struct { }; // ERROR - Missing type-name
+typedef struct { }; // { dg-error "" } Missing type-name
typedef union { } U; // OK
-typedef union { }; // ERROR - Missing type-name
+typedef union { }; // { dg-error "" } Missing type-name
-// Build don't link:
+// { dg-do assemble }
int f (int x)
{
- extern void g (int i = f (x)); // ERROR - default argument uses local
+ extern void g (int i = f (x)); // { dg-error "" } default argument uses local
g();
int f (void);
int h1 (int (*)(int) = f);
-int h2 (int (*)(double) = f); // ERROR - no matching f
+int h2 (int (*)(double) = f); // { dg-error "" } no matching f
template <class T>
int j (T t)
{
- extern void k (int i = j (t)); // ERROR - default argument uses local
+ extern void k (int i = j (t)); // { dg-error "" } default argument uses local
k ();
+// { dg-do run }
// Test that default args don't mess up pmf type comparisons.
// Contributed by Jason Merrill <jason@cygnus.com>.
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
int* hp;
-// Build don't link:
+// { dg-do assemble }
// Origin: scott snyder <snyder@fnal.gov>
class complex
+// { dg-do assemble }
// Bug: the SAVE_EXPR in the new expression remembers that it's in g(),
// causing the compiler to crash in h().
-// Build don't link:
struct A {
A ();
-// Build don't link:
+// { dg-do assemble }
// Origin: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
#include <vector>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 7 Jan 2001 <nathan@codesourcery.com>
struct A
{
- static int Foo (int = Baz ()); // ERROR -
+ static int Foo (int = Baz ()); // { dg-error "" }
static int Baz (int = Foo ());
};
struct B
{
static int Bar (int = Foo (1));
- static int Foo (int = Baz ()); // ERROR -
+ static int Foo (int = Baz ()); // { dg-error "" }
static int Baz (int = Foo (1));
};
-// Build don't link:
-// Special g++ options: -pedantic-errors -ansi -w
+// { dg-do assemble }
+// { dg-options "-pedantic-errors -ansi -w" }
-// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 7 Jan 2001 <nathan@codesourcery.com>
// As of G++ 3.4, we no longer attempt to detect dependencies; the
struct AA
{
- static int Foo (int = Baz ()); // ERROR - not yet been parsed
+ static int Foo (int = Baz ()); // { dg-error "" } not yet been parsed
static int Baz (int = Foo ());
};
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 April 2001 <nathan@codesourcery.com>
-//Build don't link:
+// { dg-do assemble }
struct cl_heap_ring{
void operator delete (void* ptr) { }
cl_heap_ring ()
-// Build don't link:
+// { dg-do assemble }
struct foo {
operator char*() const;
delete a; // should be accepted
delete[] a; // should be accepted
char b[1];
- delete b; // ERROR - expecting pointer type
- delete[] b; // ERROR - expecting pointer type
+ delete b; // { dg-error "" } expecting pointer type
+ delete[] b; // { dg-error "" } expecting pointer type
}
+// { dg-do run }
#include <new>
int i;
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 15 Apr 1999 <nathan@acm.org>
void *operator new(size_t)
{
- return 0; // ERROR - cannot return NULL
+ return 0; // { dg-error "" } cannot return NULL
}
void *operator new[](size_t)
{
- return 0; // ERROR - cannot return NULL
+ return 0; // { dg-error "" } cannot return NULL
}
struct X
{
void *operator new(size_t)
{
- return 0; // ERROR - cannot return NULL
+ return 0; // { dg-error "" } cannot return NULL
}
void *operator new[](size_t)
{
- return 0; // ERROR - cannot return NULL
+ return 0; // { dg-error "" } cannot return NULL
}
};
void fn(double *d, void *v)
{
delete d; // ok
- delete v; // WARNING - deleting void
+ delete v; // { dg-warning "" } deleting void
delete[] d; // ok
- delete[] v; // WARNING - deleting void
+ delete[] v; // { dg-warning "" } deleting void
}
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 15 Apr 1999 <nathan@acm.org>
X():i(){}
void *operator new(size_t)
{
- return 0; // WARNING - cannot return NULL
+ return 0; // { dg-warning "" } cannot return NULL
}
void *operator new[](size_t)
{
- return 0; // WARNING - cannot return NULL
+ return 0; // { dg-warning "" } cannot return NULL
}
};
+// { dg-do run }
// Origin: Alexander Schiemann (aschiem@count.math.uni-sb.de)
typedef __SIZE_TYPE__ size_t;
+// { dg-do run }
// Test that we call a class-specific vector op delete.
#include <new>
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
#include <stdlib.h>
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 1 Sep 1999 <nathan@acm.org>
void fn (void *vp, volatile void *vvp)
{
- *vp; // ERROR - not a pointer to object
- *vvp; // ERROR - not a pointer to object
- &*vp; // ERROR - not a pointer to object
- &*vvp; // ERROR - not a pointer to object
+ *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
}
-// Build don't link:
-// Special g++ Options: -mno-nop-fun-dllimport
-// Skip if not target: arm-*pe
+// { 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"
-// Skip if not target: arm-*pe
-// Build don't link:
+// { 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.
//
__declspec (dllimport) int bar1;
__declspec (dllexport) int bar1;
-__declspec (dllexport) int bar2; // ERROR - previously declared
-__declspec (dllimport) int bar2; // ERROR - redefinition
+__declspec (dllexport) int bar2; // { dg-error "" } previously declared
+__declspec (dllimport) int bar2; // { dg-error "" } redefinition
-// Build don't link:
-// Skip if not target: arm-*pe
-// Special g++ Options: -mno-nop-fun-dllimport
+// { 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"
-// Build don't link:
-// Skip if not target: arm-*pe
+// { 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)"
-// Build don't link:
-// Skip if not target: arm-*pe
+// { dg-do assemble { target arm-*-*pe } }
// dllimport is "sorta like" to "extern".
// set compiler_result "(\nfoo1:.*\nfoo2:|\nfoo2:.*\nfoo1:)"
// set not_compiler_result "__imp_"
-// Build don't link:
-// Skip if not target: arm-*pe
+// { dg-do assemble { target arm-*-*pe } }
// set not_compiler_result "__imp_"
// dll.h
class aClass
+// { dg-do run }
// Test for use of typedef in explicit destructor call.
#include <new>
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
extern "C" void abort ();
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
extern "C" void abort ();
+// { dg-do run }
// Test that we don't complain about calling a destructor on a const object.
#include <new>
int main()
{
a.~A();
- a.A::~A(); // gets bogus error - const violation
+ a.A::~A(); // { dg-bogus "" } const violation
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T> struct S { ~S(); };
void f ()
{
- i.~S(); // ERROR - invalid destructor call.
+ i.~S(); // { dg-error "" } invalid destructor call.
}
-// Build don't link:
+// { dg-do assemble }
class K {
public:
-// Build don't link:
+// { dg-do assemble }
struct S1
{
- ~S1(int); // ERROR - destructors may not have parameters
+ ~S1(int); // { dg-error "" } destructors may not have parameters
};
template <class T>
struct S2
{
- ~S2(int); // ERROR - destructors may not have parameters
+ ~S2(int); // { dg-error "" } destructors may not have parameters
};
struct S3
{
- ~S3(double) {} // ERROR - destructors may not have parameters
+ ~S3(double) {} // { dg-error "" } destructors may not have parameters
};
template <class T>
struct S4
{
- ~S4(double) {} // ERROR - destructors may not have parameters
+ ~S4(double) {} // { dg-error "" } destructors may not have parameters
};
};
S5::~S5(float)
-{ // ERROR - destructors may not have parameters
+{ // { dg-error "" } destructors may not have parameters
}
template <class T>
S6<T>::~S6(float)
-{ // ERROR - destructors may not have parameters
+{ // { dg-error "" } destructors may not have parameters
}
-// Build don't link:
+// { dg-do assemble }
struct S1 {
- ~S1(); // ERROR - candidate
+ ~S1(); // { dg-error "" } candidate
};
S1::~S1() const
-{ // ERROR - prototype does not match
+{ // { dg-error "" } prototype does not match
}
struct S2 {
- ~S2() volatile; // ERROR - destructors may not be volatile
+ ~S2() volatile; // { dg-error "" } destructors may not be volatile
};
template <class T>
struct S3 {
- ~S3(); // ERROR - candidate
+ ~S3(); // { dg-error "" } candidate
};
template <class T>
S3<T>::~S3() volatile
-{ // ERROR - prototype does not match
+{ // { dg-error "" } prototype does not match
}
template <class T>
struct S4 {
- ~S4() const; // ERROR - destructors may not be const
+ ~S4() const; // { dg-error "" } destructors may not be const
};
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
extern "C" void abort ();
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
extern "C" void abort ();
+// { dg-do run }
+// { dg-options "-O2" }
// Origin: Mark Mitchell <mitchell@codesourcery.com>
-// Special g++ Options: -O2
int i;
int j;
-// Special g++ Options: -O1
+// { dg-do run }
+// { dg-options "-O1" }
// Origin: Mark Mitchell <mark@codesourcery.com>
int result;
+// { dg-do run }
int i;
struct CC
+// { dg-do run }
// Author: Alfred Miniarik <a8601248@unet.univie.ac.at>
// test of dynamic_cast
// runtime detecting of nonpublic
+// { dg-do run }
// Author: Alfred Miniarik <a8601248@unet.univie.ac.at>
// test of dynamic_cast
// runtime detecting of valid
+// { dg-do run }
// Author: Alfred Miniarik <a8601248@unet.univie.ac.at>
// test of dynamic_cast
// runtime detecting of nonpublic
+// { dg-do run }
// Author: Alfred Miniarik <a8601248@unet.univie.ac.at>
// Even in a derived class, a private base cannot be dynamically downcasted
+// { dg-do run }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 Jun 1999 <nathan@acm.org>
-// Special g++ Options: -w -ansi -pedantic-errors
+// { dg-do run }
+// { dg-options "-w -ansi -pedantic-errors" }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 20 June 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
class foo {
public:
-// Build don't link:
+// { dg-do assemble }
class C2 {
public:
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O2" }
// Origin: Jakub Jelinek <jakub@redhat.com>
-// Special g++ Options: -O2
class a {
public:
-// Special g++ Options: -O
+// { dg-do run }
+// { dg-options "-O" }
typedef struct { } e;
char *p;
+// { dg-do assemble }
// Origin: Jean-Marc Bourguet <bourguet@cadence.com>
-// Build don't link:
class foo {
public:
foo() {};
void throwMe () {
- throw *this; // ERROR - cannot be used in throw-expression
+ throw *this; // { dg-error "" } cannot be used in throw-expression
};
virtual void test () = 0;
};
-// Build don't link:
-// Special g++ Options: -O2
+// { dg-do assemble }
+// { dg-options "-O2" }
struct X {};
+// { dg-do assemble }
typedef struct {} S;
S s1;
-struct S* s2; // ERROR - S is a typedef name
+struct S* s2; // { dg-error "" } S is a typedef name
template <class T>
struct X {
- friend class T; // ERROR - T is a template type parameter
+ friend class T; // { dg-error "" } T is a template type parameter
};
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
// This test case checks that the return value optimization works for
// empty classes.
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct E {};
+// { dg-do run }
extern "C" void abort();
struct A
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 3 Jun 1999 <nathan@acm.org>
// We'd like the enum location to be its open brace.
enum thing
-{ // ERROR - previous def
+{ // { dg-error "" } previous def
val1
};
enum thing
-{ // ERROR - multiple def
+{ // { dg-error "" } multiple def
val2
};
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 28 Feb 2001 <nathan@codesourcery.com>
+// { dg-do run }
+// { dg-options "-fshort-enums" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options: -fshort-enums
enum E {
a = -312
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// { dg-do run }
+// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
// Contributed by Ben Elliston <bje@redhat.com>
// PR 80: Packed enums use minimum required storage.
-// excess errors test - XFAIL *-*-*
extern "C" void abort();
-enum numbers { one, two, three } __attribute__ ((packed)) nums;
-enum colours { red = 1000, green, blue } __attribute__ ((packed)) cols;
-enum __attribute__ ((packed)) conditions { fine, rain, cloudy } forecast;
+enum numbers { one, two, three } __attribute__ ((packed)) nums; // { dg-bogus "" "" { xfail *-*-* } }
+enum colours { red = 1000, green, blue } __attribute__ ((packed)) cols; // { dg-bogus "" "" { xfail *-*-* } }
+enum __attribute__ ((packed)) conditions { fine, rain, cloudy } forecast; // { dg-bogus "" "" { xfail *-*-* } }
int
main()
if (sizeof (cols) != 2)
abort ();
- if (sizeof (forecast) != 1)
+ if (sizeof (forecast) != 1) // { dg-bogus "" "" { xfail *-*-* } }
abort ();
return 0;
+// { dg-do assemble }
// Origin: Jason Merrill <jason@redhat.com>
struct A
int main ()
{
- const A& r = 1; // ERROR - no suitable constructor
+ const A& r = 1; // { dg-error "" } no suitable constructor
}
-// Build don't link:
+// { dg-do assemble }
// Simplified from bug report by Trevor Taylor <ttaylor@powerup.com.au>
struct T {
- int operator()(int) { } // ERROR - candidate
+ int operator()(int) { } // { dg-error "" } candidate
};
int main() {
- T()(); // ERROR - no such operator
+ T()(); // { dg-error "" } no such operator
}
-// Special g++ Options: -O
+// { dg-do run }
+// { dg-options "-O" }
int main()
{
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mitchell@codesourcery.com>
extern "C"
-// Build don't link:
+// { dg-do assemble }
// Origin: Boris Zentner <boris@m2b.de>
extern "C"
+// { dg-do run }
// Test that two extern "C" declarations of the same name in different
// namespaces are treated as declaring the same function.
-// Build don't link:
+// { dg-do assemble }
// Origin: Neil Booth, from PR #66
extern "C"
-// Build don't link:
+// { dg-do assemble }
// Origin: schmid@snake.iap.physik.tu-darmstadt.de
extern "C" int rand (void) throw ();
-// Build don't link:
+// { dg-do assemble }
struct X
{
+// { dg-do run }
// Test for proper handling of field calls.
// Contributed by Jason Merrill <jason@cygnus.com>
-// Build don't run:
+// { dg-do link }
+// { dg-options "-g" }
// Origin: Loren James Rittle <rittle@latour.rsch.comm.mot.com>
-// Special g++ Options: -g
int main ()
{
-// Build don't link:
+// { dg-do assemble }
int i;
int j;
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 Jul 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { 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
class B {
protected:
- int i; // ERROR - in this context
+ int i; // { dg-error "" } in this context
static int j;
};
void f()
{
- b.i = 3; // ERROR - protected
+ b.i = 3; // { dg-error "" } protected
d.i = 4;
B::j = 5;
D::j = 6;
template <typename T>
void g()
{
- b.i = 3; // ERROR - protected
+ b.i = 3; // { dg-error "" } protected
d.i = 4;
B::j = 5;
D::j = 6;
void S::h()
{
- b.i = 3; // ERROR - protected
+ b.i = 3; // { dg-error "" } protected
d.i = 4;
B::j = 5;
D::j = 6;
template <typename T>
void R<T>::h()
{
- b.i = 3; // ERROR - protected
+ b.i = 3; // { dg-error "" } protected
d.i = 4;
B::j = 5;
D::j = 6;
-// Build don't link:
+// { dg-do assemble }
// Origin: Neil Booth, from PR #78
namespace MySpace
-// Build don't link:
+// { dg-do assemble }
// Origin: robt@flyingpig.com
class Outer
-// Build don't link:
+// { dg-do assemble }
void
f()
-// Build don't link:
+// { dg-do assemble }
class foo {
public:
-// Build don't link:
+// { dg-do assemble }
// by Alexandre Oliva <oliva@dcc.unicamp.br>
template <class A, class B> void foo();
template <class C> class bar {
- int i; // ERROR - private
- template <class B> friend void foo<C,B>(); // ERROR - bogus declaration
+ int i; // { dg-error "" } private
+ template <class B> friend void foo<C,B>(); // { dg-error "" } bogus declaration
};
template <class A, class B> void foo() {
- bar<A> baz; baz.i = 1; // ERROR - foo cannot access bar<int>::i
- bar<int> buz; buz.i = 1; // ERROR - foo cannot access bar<int>::i
+ bar<A> baz; baz.i = 1; // { dg-error "" } foo cannot access bar<int>::i
+ bar<int> buz; buz.i = 1; // { dg-error "" } foo cannot access bar<int>::i
}
int main() {
foo<void,void>();
+// { dg-do assemble }
// submitted by David C Binderman <dcb@pncl.co.uk>
struct A {
- friend bool(); // ERROR - invalid declaration
+ friend bool(); // { dg-error "" } invalid declaration
};
+// { dg-do assemble }
// Origin: Martin v. Löwis <loewis@informatik.hu-berlin.de>
// Test for resolution of core issue 125.
-// Build don't link:
struct A{
struct B{};
class Test{
friend A (::B::C)(); // Ok
friend A::B (::C)(); // Ok
- friend A::B::C(); // ERROR - no A::B::C
+ friend A::B::C(); // { dg-error "" } no A::B::C
};
+// { dg-do assemble }
// Origin: Martin v. Löwis <loewis@informatik.hu-berlin.de>
// Test that a friend declaration with an explicit :: finds the right fn.
-// Build don't link:
namespace M {
class S;
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Aug 2000 <nathan@codesourcery.com>
struct X
{
friend class Z;
- friend Y; // ERROR - friend must use aggr tag
+ friend Y; // { dg-error "" } friend must use aggr tag
};
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 Nov 2000 <nathan@codesourcery.com>
class F
{
- class Internal; // ERROR - is private
+ class Internal; // { dg-error "" } is private
};
class C
{
- friend class F::Internal; // ERROR - in this context
+ friend class F::Internal; // { dg-error "" } in this context
public:
typedef enum { A, B } e;
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S
void f ()
{
{
- S s1; // ERROR - skips initialization
+ S s1; // { dg-error "" } skips initialization
- t: // ERROR - jump to label
+ t: // { dg-error "" } jump to label
S s2;
;
}
- goto t; // ERROR - from here
+ goto t; // { dg-error "" } from here
}
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-Wunused" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options: -Wunused
struct S
{
{
{
S s1;
- int j; // WARNING - unused
+ int j; // { dg-warning "" } unused
- t: // WARNING - unused
+ t: // { dg-warning "" } unused
S s2;
}
}
+// { dg-do assemble }
// Testcase for various invalid gotos.
// Origin: Jason Merrill <jason@redhat.com>
-// Build don't link:
void f ()
{
- goto foo1; // ERROR - jumps
- try { foo1:; } catch (...) { } // ERROR - into try
- goto foo2; // ERROR - jumps
- try { } catch (...) { foo2:; } // ERROR - into catch
- goto foo3; // ERROR - jumps
- { int i=2; foo3:; } // ERROR - past init
+ 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 (...) { } // ERROR -
- goto foo4; // ERROR -
- try { } catch (...) { foo5:; } // ERROR -
- goto foo5; // ERROR -
- { int i=2; foo6:; } // ERROR -
- goto foo6; // ERROR -
+ 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 "" }
}
+// { dg-do run }
// Test that we clean up temporaries bound to references properly when
// jumping out of their scope.
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Loren J. Rittle 07 Jun 2000 <ljrittle@acm.org>
//
-// Build don't link:
+// { 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; // ERROR - forward ref
+struct S; // { dg-error "" } forward ref
void f(S); // ok
-void f(S s) {} // ERROR - incomplete type
+void f(S s) {} // { dg-error "" } incomplete type
void j (int){} // ok
void k (){} // ok
void q (void){} // ok
-void t (void t); // ERROR - incomplete
-void r (void, ...); // ERROR - incomplete
-void s (void const); // ERROR - incomplete
+void t (void t); // { dg-error "" } incomplete
+void r (void, ...); // { dg-error "" } incomplete
+void s (void const); // { dg-error "" } incomplete
+// { dg-do run }
extern "C" void abort();
int i;
+// { dg-do run }
int i;
struct D {
+// { dg-do run }
// Check that elements for which no explicit initializer was given are
// default-initialized properly.
-// Build don't run:
-// Special g++ Options: -O3
+// { dg-do link }
+// { dg-options "-O3" }
// Origin: Mark Mitchell <mark@codesourcery.com>
typedef int (*fp)();
-// Build don't run:
-// Special g++ Options: -O3
+// { dg-do link }
+// { dg-options "-O3" }
// Origin: Gabriel Dos_Reis <Gabriel.Dos_Reis@sophia.inria.fr>
void f() {}
-// Build don't link:
+// { dg-do assemble }
// Origin: bkoz@nabi.net
typedef struct
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation
// Contributed by Nathan Sidwell 21 June 2000 <nathan@codesourcery.com>
+// { dg-do run }
// Origin: Jakub Jelinek <jakub@redhat.com>
struct bar {
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 17 Jan 2001 <nathan@codesourcery.com>
void f(void *ptr)
{
X y = X ();
- X y1 (0); // ERROR - cannot convert
+ X y1 (0); // { dg-error "" } cannot convert
X y2 = X (0);
X *x = new X ();
- X *x2 = new X (0); // ERROR - cannot convert
+ X *x2 = new X (0); // { dg-error "" } cannot convert
}
-// Special g++ Options: -O3
+// { dg-do run }
+// { dg-options "-O3" }
typedef int (*fp)();
-// Build don't link:
+// { dg-do assemble }
struct X
{
-// Build don't link:
+// { dg-do assemble }
class error {
public:
};
class foo {
- const error x = 1; // ERROR - initialization of non-static data member
+ const error x = 1; // { dg-error "" } initialization of non-static data member
};
+// { dg-do run { xfail *-*-* } }
// Objects must be destructed in decreasing cnt order
// Original test attributed to James Kanze <jkanze@otelo.ibmmail.com>
-// execution test - XFAIL *-*-*
extern "C" void abort ();
+// { dg-do run }
// Test for default-initialization of POD-structs in functional cast notation.
struct foo { int a[10]; };
+// { dg-do run }
// simplified from testcase in Windows Developer Journal,
// submitted by eyal.ben-david@aks.com
-// Build don't link:
+// { dg-do assemble }
// submitted by David C Binderman <dcb@pncl.co.uk>
void
f()
{
- const int var [ 10 ]; // ERROR - missing initializer
+ const int var [ 10 ]; // { dg-error "" } missing initializer
}
-// Build don't link:
+// { dg-do assemble }
// Based on a testcase submitted by Tudor Hulubei <tudor@cs.unh.edu>
};
void a() {
- goto bar; // ERROR - jump from here
- A x; // ERROR - jump crosses initialization
- bar: // ERROR - jump to here
+ goto bar; // { dg-error "" } jump from here
+ A x; // { dg-error "" } jump crosses initialization
+ bar: // { dg-error "" } jump to here
;
}
};
void b() {
- goto bar; // ERROR - jump from here
- X x; // ERROR - jump crosses initialization
- bar: // ERROR - jump to here
+ goto bar; // { dg-error "" } jump from here
+ X x; // { dg-error "" } jump crosses initialization
+ bar: // { dg-error "" } jump to here
;
}
#include <vector>
void c() {
- goto bar; // ERROR - jump from here
- std::vector<int> x; // ERROR - jump crosses initialization
- bar: // ERROR - jump to here
+ goto bar; // { dg-error "" } jump from here
+ std::vector<int> x; // { dg-error "" } jump crosses initialization
+ bar: // { dg-error "" } jump to here
;
}
-// Build don't link:
+// { dg-do assemble }
static const char foo[] = { "bar" };
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O2 -Winline" }
// Origin: Martin Reinecke <martin@MPA-Garching.MPG.DE>
-// Special g++ Options: -O2 -Winline
class foo
{
-// Build don't link:
-// Special g++ Options: -O2
+// { dg-do assemble }
+// { dg-options "-O2" }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O2" }
// Origin: Jakub Jelinek <jakub@redhat.com>
-// Special g++ Options: -O2
class baz
{
-// Build don't link:
-// Special g++ Options: -O2 -g
+// { dg-do assemble }
+// { dg-options "-O2 -g" }
// (Should preferrably cycle through options.)
// Origin: Hans-Peter Nilsson <hp@axis.com>
// See <URL:http://gcc.gnu.org/ml/gcc-patches/2000-06/msg00310.html>
-// Build don't link:
+// { dg-do assemble }
// Origin: Alexandre Oliva <aoliva@cygnus.com>
struct foo {
-// Build don't link:
+// { dg-do assemble }
// Origin: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
#include <iostream>
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O1" }
// Origin: Jakub Jelinek <jakub@redhat.com>
-// Special g++ Options: -O1
class Type;
template<class E>
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O1" }
// Origin: Jakub Jelinek <jakub@redhat.com>
-// Special g++ Options: -O1
struct foo {
bool x;
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O3" }
// Origin: Jakub Jelinek <jakub@redhat.com>
-// Special g++ Options: -O3
struct foo
{
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O3" }
// Origin: Jakub Jelinek <jakub@redhat.com>
-// Special g++ Options: -O3
static void foo (int a)
{
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O1" }
// Origin: Scott Snyder <snyder@fnal.gov> via PR 1733.
-// Special g++ Options: -O1
//
-// crash test
struct TBtItem
{
+// { dg-do assemble }
+// { dg-options "-O2 -Winline" }
// Origin: Martin Reinecke <martin@MPA-Garching.MPG.DE>
-// Build don't link:
-// Special g++ Options: -O2 -Winline
#include <cmath>
-// Build don't link:
+// { dg-do assemble }
struct A {
int a, b, c, d;
-// Special g++ Options: -O2
+// { dg-do run }
+// { dg-options "-O2" }
// Origin: suckfish@ihug.co.nz
// DECLARATIONS
-// Build don't run:
+// { dg-do link }
struct B
{
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O3" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options: -O3
class ostream;
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O2" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options: -O2
inline void f ()
{
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O2" }
// Origin: Matt Austern <austern@isolde.engr.sgi.com>
-// Special g++ Options: -O2
class X;
-// Build don't link:
-// Special g++ Options: -O2
+// { dg-do assemble }
+// { dg-options "-O2" }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S
+// { dg-do run }
+// { dg-options "-O2" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options: -O2
#include <list>
+// { dg-do run }
+// { dg-options "-O1" }
// Origin: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
-// Special g++ Options: -O1
#include <map>
#include <cstdlib>
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O2" }
// Origin: Mark Mitchell <mitchell@codesourcery.com>
-// Special g++ Options: -O2
inline void f ()
{
-// Build don't run:
+// { dg-do link }
+// { dg-options "-fno-implicit-templates" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options: -fno-implicit-templates
template <class T>
struct U {
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 26 April 2001 <nathan@codesourcery.com>
void foo ()
{
// there is a ctrl-h on the next line
- \b // ERROR - stray char
+ \b // { dg-error "" } stray char
}
+// { dg-do assemble }
+// { dg-options "-w" }
// Submitted by Nathan Sidwell <nathan@acm.org>
// Bug: g++ was giving the wrong line number for statics.
-// Special g++ Options: -w
class A
{
- A(); // ERROR - private
- ~A(); // ERROR - private
+ A(); // { dg-error "" } private
+ ~A(); // { dg-error "" } private
};
-static A a; // ERROR - here
+static A a; // { dg-error "" } here
+// { dg-do assemble }
// Submitted by Nathan Sidwell <nathan@acm.org>
// Bug: g++ wasn't listing candidates for a failed conversion.
-void f(int, double); // ERROR - candidate
-void f(double, int); // ERROR - candidate
-void f(int); // ERROR - candidate
+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; // ERROR - no match
+ ptr = &f; // { dg-error "" } no match
}
+// { dg-do assemble }
// Bug: g++ gets confused by the #line directive within a method.
// Contributed by Mark Mitchell <mark@codesourcery.com>
-// Build don't link:
struct S
{
-// Build don't link:
+// { dg-do assemble }
#define x \
y
-int; // ERROR - invalid declaration
+int; // { dg-error "" } invalid declaration
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 25 Jul 2001 <nathan@codesourcery.com>
class A {
public:
- int kaka(tmp::B = b); // ERROR - no b in scope
+ int kaka(tmp::B = b); // { dg-error "" } no b in scope
};
+// { dg-do assemble }
typedef struct {
int i;
} *p;
-void f (p) { } // ERROR - function uses anonymous type
+void f (p) { } // { dg-error "" } function uses anonymous type
p q;
int main()
{
extern p j;
struct A { int j; };
- extern A a; // ERROR - extern uses local type
- extern void f (A); // ERROR - extern uses local type
+ extern A a; // { dg-error "" } extern uses local type
+ extern void f (A); // { dg-error "" } extern uses local type
}
-// Build don't link:
+// { dg-do assemble }
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
extern "C"
{
}
typedef struct { int dummy[10]; } *FAIL_FILE;
-extern FAIL_FILE fail_open(); // ERROR - non-local function
+extern FAIL_FILE fail_open(); // { dg-error "" } non-local function
typedef struct { int dummy[10]; } *SUCCESS_FILE, S;
extern SUCCESS_FILE success_open();
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
-extern "C" void f (); // ERROR - previous declaration
-static void f () {} // ERROR - extern redeclared static
+extern "C" void f (); // { dg-error "" } previous declaration
+static void f () {} // { dg-error "" } extern redeclared static
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
static int strlen (const char*) { return 0; }
// 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<strlen>(); // ERROR - no matching template
+template void f<strlen>(); // { dg-error "" } no matching template
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
static int f ();
-// Build don't link:
-// Special g++ Options: -fno-weak
+// { dg-do assemble }
+// { dg-options "-fno-weak" }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <typename T>
-// Build don't run:
+// { dg-do link }
// Origin: Mark Mitchell <mark@codesourcery.com>
namespace N {
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O0 -fpic" }
// Origin: Jakub Jelinek <jakub@redhat.com>
-// Special g++ Options: -O0 -fpic
// Skip if target: cris-*-elf* cris-*-aout* mmix-*-*
struct bar {
-// Build don't run:
+// { dg-do link }
struct Outer {
virtual ~Outer() {}
-// Build don't link:
-// Special g++ Options: -O2
+// { dg-do assemble }
+// { dg-options "-O2" }
void f ()
{
+// { dg-do run }
// Bug: g++ lies about DECL_CONTEXT, so the backend thinks B::f is not
// function-local.
// Contributed by Jason Merrill <jason@cygnus.com>
-// excess errors test
struct A {
virtual void f () = 0;
+// { dg-do run }
// Test that a local declaration of one of a global overload set works
int f () { return 0; }
+// { dg-do assemble }
// simple test for id from base class during class defn
-// Build don't link:
struct foo {
enum { blah = 1 };
-// Build don't link:
+// { dg-do assemble }
struct A {
struct B {
-// Build don't link:
+// { dg-do assemble }
namespace A {
int i;
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct B {
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
int main()
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
union U {
-// Build don't link:
+// { dg-do assemble }
// Origin: Benjamin Kosnik <bkoz@cygnus.com>
class b
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 25 Aug 1999 <nathan@acm.org>
+// { dg-do run }
// Bug: t->B is resolved to the type instead of the field.
struct A {
+// { 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.
-// Build don't link:
struct A {
int i;
};
void E::f() {
- B::i = 0; // ERROR - B is ambiguous
+ B::i = 0; // { dg-error "" } B is ambiguous
}
void f () {
E e;
- e.B::i = 0; // ERROR - B is ambiguous
+ e.B::i = 0; // { dg-error "" } B is ambiguous
}
+// { dg-do assemble }
// Test for proper handling of type lookup for conversion operator names.
-// Build don't link:
// Test 1: Only at file scope
typedef int B;
struct A
{
int B;
- operator B *(); // ERROR -
+ operator B *(); // { dg-error "" }
};
-A::operator B * () // ERROR -
+A::operator B * () // { dg-error "" }
{
return 0;
}
-// Build don't link:
+// { dg-do assemble }
struct B {
int i;
+// { dg-do assemble }
// Bug: typename_sub2 returned the type, so we tried to look up "A" in B.
-// Build don't link:
struct A { struct A1 { }; };
+// { dg-do run }
// Check that we don't complain about ambiguity between the same static
// member function in different subobjects.
+// { dg-do assemble }
// Origin: GerhardTonn@gmx.de
-// Build don't link:
struct super {
union {
+// { dg-do assemble }
// Test for proper handling of type lookup if base class has field with the
// same name as the containing class.
-// Build don't link:
struct a { int a; };
struct b : a {};
+// { dg-do run }
// Test to make sure that the use of __typeof__ in WIFEXITED works.
int main ()
+// { dg-do run }
// Test for proper handling of references to overloaded member functions.
struct A {
-// Build don't link:
+// { dg-do assemble { xfail *-*-* } }
// Simplified from bug report by Paris Smaragdis <paris@media.mit.edu>
-// crash test - XFAIL *-*-*
template <class T> class vector {};
class foo {};
int main() {
foo f;
- f.vector(); // ERROR - not a method
+ f.vector(); // { dg-error "" } not a method
}
+// { dg-do run }
int f(int i)
{
struct C {
+// { dg-do run }
// Test for handling of type shadowing in function scope.
int main()
-// Build don't link:
+// { dg-do assemble }
struct S {
int A;
-// Build don't link:
+// { dg-do assemble }
struct S {
typedef long I;
+// { dg-do run }
+// { dg-options "-O2" }
// Test for bad loop optimization of goto fixups.
-// Special g++ Options: -O2
typedef bool (*ftype) ();
-// Build don't link:
-// Special g++ Options: -O
+// { dg-do assemble }
+// { dg-options "-O" }
class foo {
public:
+// { dg-do assemble }
// Build don't linK:
int main()
-{ // ERROR - invalid redeclaration of
+{ // { dg-error "" } invalid redeclaration of
return 0;
}
int main(int, const char**)
-{ // ERROR - as
+{ // { dg-error "" } as
return 0;
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
-double main () {} // ERROR - main must return `int'
+double main () {} // { dg-error "" } main must return `int'
-// Build don't link:
+// { dg-do assemble }
template<int T>
struct A {
+// { dg-do assemble }
// Test for overloaded operators in "C" linkage
-// Build don't link:
extern "C" {
typedef struct b
+// { dg-do run }
struct foo {
static int bar ()
{
+// { dg-do run }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Jan 1999 <nathan@acm.org>
-// Build don't link:
+// { dg-do assemble }
struct C
{
void E::g()
{
- c.D().f(); // ERROR - no matching function
+ c.D().f(); // { dg-error "" } no matching function
}
-// Build don't link:
+// { dg-do assemble }
// by Bert Bril <bert@dgb.nl>
struct M1 {
-// Build don't link:
+// { dg-do assemble }
// Origin: Chip Salzenberg <chip@perlsupport.com>
class Foo {
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 10 Aug 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
#include <new>
+// { dg-do run }
typedef __SIZE_TYPE__ size_t;
template <class T>
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S {
+// { dg-do run }
// Test that const-correctness is observed when using new.
struct A {
+// { dg-do run }
// Test that we properly default-initialize the new int when () is given.
#include <new>
+// { dg-do run }
// Origin: philip_martin@ntlworld.com
#include <new>
-// Build don't run:
+// { dg-do link }
#include <cstddef>
int main()
{
- int i = NULL; // WARNING - converting NULL to non-pointer type
- float z = NULL; // WARNING - converting NULL to non-pointer type
+ int i = NULL; // { dg-warning "" } converting NULL to non-pointer type
+ float z = NULL; // { dg-warning "" } converting NULL to non-pointer type
int a[2];
- i != NULL; // WARNING - NULL used in arithmetic
- NULL != z; // WARNING - NULL used in arithmetic
+ i != NULL; // { dg-warning "" } NULL used in arithmetic
+ NULL != z; // { dg-warning "" } NULL used in arithmetic
k != NULL; // No warning: decay conversion
NULL != a; // Likewise.
- -NULL; // WARNING - converting NULL to non-pointer type
- +NULL; // WARNING - converting NULL to non-pointer type
- ~NULL; // WARNING - converting NULL to non-pointer type
- a[NULL] = 3; // WARNING - converting NULL to non-pointer-type
- i = NULL; // WARNING - converting NULL to non-pointer type
- z = NULL; // WARNING - converting NULL to non-pointer type
- k(NULL); // WARNING - converting NULL to int
- g(NULL); // WARNING - converting NULL to int
- h<NULL>(); // WARNING - NULL bound to integer template parameter
- l(NULL); // WARNING - converting NULL to int
+ -NULL; // { dg-warning "" } converting NULL to non-pointer type
+ +NULL; // { dg-warning "" } converting NULL to non-pointer type
+ ~NULL; // { dg-warning "" } converting NULL to non-pointer type
+ a[NULL] = 3; // { dg-warning "" } converting NULL to non-pointer-type
+ i = NULL; // { dg-warning "" } converting NULL to non-pointer type
+ z = NULL; // { dg-warning "" } converting NULL to non-pointer type
+ k(NULL); // { dg-warning "" } converting NULL to int
+ g(NULL); // { dg-warning "" } converting NULL to int
+ h<NULL>(); // { dg-warning "" } NULL bound to integer template parameter
+ l(NULL); // { dg-warning "" } converting NULL to int
NULL && NULL; // No warning: converting NULL to bool is OK
}
+// { dg-do run }
// Based on a testcase by Eric Dumazet <Eric.Dumazet@COSMOSBAY.COM>
extern "C" void abort ();
-// Build don't link:
+// { dg-do assemble }
void x()
{
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S {
- bool operator! (int, ...); // ERROR -
+ bool operator! (int, ...); // { dg-error "" }
};
+// { dg-do run }
// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 28 Nov 2000 <nathan@codesourcery.com>
+// { dg-do run }
// Copyright (C) 2000, 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 28 Nov 2000 <nathan@codesourcery.com>
-// Special g++ Options: -O2
+// { dg-do run }
+// { dg-options "-O2" }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 18 May 2001 <nathan@codesourcery.com>
-// Special g++ Options: -O2
+// { dg-do run }
+// { dg-options "-O2" }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 26 May 2001 <nathan@codesourcery.com>
-// Special g++ Options: -O2
+// { dg-do run }
+// { dg-options "-O2" }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 May 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 Jul 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
class A {
public:
+// { dg-do assemble }
// 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
int main()
{
B b;
- if ((const char *)b != 0) // WARNING - surprising overload resolution
+ if ((const char *)b != 0) // { dg-warning "" } surprising overload resolution
return 1;
if ((const char *)(const B)b == 0)
return 2;
+// { dg-do run }
struct A {
A operator+ (int) const { return *this; }
};
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
const char *pc;
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 5 Sep 1999 <nathan@acm.org>
// (rather inconsistently), but subsequent changes broke the warning. Make
// sure that doesn't happen again.
-// excess errors test - XFAIL
-void ovl (int); // ERROR - candidate
-void ovl (float); // ERROR - candidate
+void ovl (int); // { dg-error "" } candidate
+void ovl (float); // { dg-error "" } candidate
void fn (int);
void fna (int);
void (*vptr) ();
(ovl) (1); // ok
- (&ovl) (1); // ERROR - not suitable for overload resolution
- (ovl) (); // ERROR - no matching candidates
- (&ovl) (); // ERROR - not suitable for overload resolution
+ (&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); // ERROR - not suitable for overload resolution
- (0, &ovl) (1); // ERROR - not suitable for overload resolution
- (argc ? ovl : ovl) (1); // ERROR - not suitable for overload resolution
- (argc ? &ovl : &ovl) (1); // ERROR - not suitable for overload resolution
+ (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)
ptr = (ovl); // ok
ptr = (&ovl); // ok
// 13.4 indicates these are ok.
- ptr = (0, ovl); // ok
- ptr = (0, &ovl); // ok
- ptr = (argc ? ovl : ovl); // ok
- ptr = (argc ? &ovl : &ovl);// ok
+ ptr = (0, ovl); // ok { dg-bogus "" "" { xfail *-*-* } }
+ ptr = (0, &ovl); // ok { dg-bogus "" "" { xfail *-*-* } }
+ ptr = (argc ? ovl : ovl); // ok { dg-bogus "" "" { xfail *-*-* } }
+ ptr = (argc ? &ovl : &ovl);// ok { dg-bogus "" "" { xfail *-*-* } }
- vptr = (ovl); // ERROR - no matching candidates
- vptr = (&ovl); // ERROR - no matching candidates
- vptr = (0, ovl); // ERROR - no matching candidates
- vptr = (0, &ovl); // ERROR - no matching candidates
- vptr = (argc ? ovl : ovl); // ERROR - no matching candidates
- vptr = (argc ? &ovl : &ovl);// ERROR - no matching candidates
+ 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 = (argc ? fna : fn);
ptr = (argc ? &fna : &fn);
- f; // WARNING - not a call
- ovl; // ERROR - not suitable for overload
- &ovl; // ERROR - not suitable for overload
+ f; // { dg-warning "" } not a call
+ ovl; // { dg-error "" } not suitable for overload
+ &ovl; // { dg-error "" } not suitable for overload
(void)f; // ok
- (void)ovl; // ERROR - not suitable for overload
- (void)&ovl; // ERROR - not suitable for overload
+ (void)ovl; // { dg-error "" } not suitable for overload
+ (void)&ovl; // { dg-error "" } not suitable for overload
static_cast<void>(f); // ok
- static_cast<void>(ovl); // ERROR - not suitable for overload
- static_cast<void>(&ovl); // ERROR - not suitable for overload
- ((void)1, f); // WARNING - not a call XFAIL
- ((void)1, ovl); // ERROR - not suitable for overload
- ((void)1, &ovl); // ERROR - not suitable for overload
+ static_cast<void>(ovl); // { dg-error "" } not suitable for overload
+ static_cast<void>(&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); // ERROR - not suitable for overload
- (void)((void)1, &ovl); // ERROR - not suitable for overload
+ (void)((void)1, ovl); // { dg-error "" } not suitable for overload
+ (void)((void)1, &ovl); // { dg-error "" } not suitable for overload
return 0;
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Neil Booth <neilb@earthling.net> from bug #27.
struct A{};
-// Build don't link:
+// { dg-do assemble }
// Origin: Nathan Sidwell <nathan@codesourcery.com>
struct A {
+// { dg-do run }
extern "C" void abort();
struct A {
-// Build don't run:
+// { dg-do link }
template <class T>
class ConstArray {
-// Build don't run:
+// { dg-do link }
void f(const int *);
void f(int *) {}
-// Build don't run:
+// { dg-do link }
void f(int* const volatile * const * const*);
void f(int* const * const * const*) {}
-// Build don't run:
+// { dg-do link }
struct S {};
+// { dg-do run }
extern "C" void abort();
struct S1
+// { dg-do run }
// Check that object call works when there are multiple conversion ops
// returning the same type.
+// { dg-do run }
class a {
public:
int f() { return 0; }
+// { dg-do run }
struct T { ~T() {}; };
int g ()
-// Build don't link:
+// { dg-do assemble }
// Origin: Frank Pilhofer <fp@fpx.de>
struct A {
+// { dg-do assemble }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Jason Merrill 14 Jun 2001 <jason@redhat.com>
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 {}; // ERROR - no final overrider
+struct C: public B1, public B2 {}; // { dg-error "" } no final overrider
+// { dg-do assemble }
// Test that we save declspecs before a class defn properly.
-// Build don't link:
static volatile union {
void f() { }
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 Nov 2000 <nathan@codesourcery.com>
struct X
{
- bool operator (const X &) const; // ERROR - parse error
+ bool operator (const X &) const; // { dg-error "" } parse error
};
-// Build don't link:
+// { 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
+// { dg-do run }
struct foo {};
typedef long unsigned int & (foo::*pmf)(void);
void fn (...) {}
-// Build don't link:
+// { dg-do assemble }
// submitted by David C Binderman <dcb@pncl.co.uk>
void
f()
{
- pmf = & pf->f; // ERROR - not a valid pmf expression
+ pmf = & pf->f; // { dg-error "" } not a valid pmf expression
}
+// { dg-do assemble }
// Submitted by Nathan Sidwell <nathan@acm.org>
// Bug: g++ was crashing after giving errors.
Gtk_Base::Gtk_Base()
{
- connect_to_method(this,&show); // ERROR - invalid pmf expression
- connect_to_method(this,&expose); // ERROR - invalid pmf expression
+ connect_to_method(this,&show); // { dg-error "" } invalid pmf expression
+ connect_to_method(this,&expose); // { dg-error "" } invalid pmf expression
}
+// { 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 <jason@cygnus.com>
+// { 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.
+// { dg-do run }
// Test that we only call f once and that pointers to different subobjects
// compare as different.
+// { dg-do assemble }
// Test for proper diagnostics on trying to take the address of a non-static
// member function.
int main ()
{
A a;
- &a.f; // ERROR - overloaded
- &a.g; // ERROR - can't write a pmf like this
+ &a.f; // { dg-error "" } overloaded
+ &a.g; // { dg-error "" } can't write a pmf like this
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 28 Feb 2001 <nathan@codesourcery.com>
-// Build don't link:
-// Special g++ Options: -Wall
+// { dg-do assemble }
+// { dg-options "-Wall" }
struct a
{
int main()
{
a A;
- A.x("%d"); // WARNING - too few arguments for format
+ A.x("%d"); // { dg-warning "" } too few arguments for format
return 0;
}
-// Build don't link:
+// { dg-do assemble }
class x
{
void foo()
{
x* y;
- if (y->is_constant) // ERROR - assuming &
+ if (y->is_constant) // { dg-error "" } assuming &
{
}
}
+// { dg-do run }
// Test that we properly convert a constant ptm to bool.
class A { };
+// { dg-do assemble }
class cow {
public:
void moo (char *);
cow* c;
void (cow::*fp0)(char*) = &cow::moo; // OK
- void (cow::*fp1)(int) = &cow::moo; // ERROR - conversion
- int (cow::*fp2)(char*) = &cow::moo; // ERROR - conversion
- int (cow::*fp3)(char*, void*) = fp2; // ERROR - conversion
+ 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
}
-// Build don't link:
+// { dg-do assemble }
class c {
void (c::*x)();
public:
- void f() { this->x(); } // ERROR - pointer-to-member
+ void f() { this->x(); } // { dg-error "" } pointer-to-member
};
+// { dg-do run }
// Test to make sure g++ can handle target types that aren't identical
// with pointers to members.
+// { dg-do assemble }
// Bug: g++ doesn't see that A is a vbase of C.
// Submitted by Jason Merrill <jason@cygnus.com>
-// Build don't link:
struct A {
int i;
void g ()
{
- int C::*p = &A::i; // ERROR - conversion from vbase
- void (C::*fp)() = &A::f; // ERROR - conversion from vbase
+ int C::*p = &A::i; // { dg-error "" } conversion from vbase
+ void (C::*fp)() = &A::f; // { dg-error "" } conversion from vbase
}
-// Build don't link:
-// crash test
+// { dg-do assemble }
// Copyright (c) 2000, 2001 Free Software Foundation.
// Distilled from a bug report by Eric Ford <eford@princeton.edu>
{
int i;
for(i = 2; i < nPoints; ++i)
- y[i] = y[nPoints] .* (x[i]-x[1]) / (x[nPoints]-x[1]); // ERROR - .*
+ y[i] = y[nPoints] .* (x[i]-x[1]) / (x[nPoints]-x[1]); // { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Aug 2000 <nathan@codesourcery.com>
void A::foo ()
{
int (A::*ptr1) (int) = &A::ns;
- int (A::*ptr2) (int) = A::ns; // ERROR - not ptr mem
- int (A::*ptr3) (int) = &ns; // ERROR - not ptr mem
- int (A::*ptr4) (int) = ns; // ERROR - not ptr mem
+ int (A::*ptr2) (int) = A::ns; // { dg-error "" } not ptr mem
+ int (A::*ptr3) (int) = &ns; // { dg-error "" } not ptr mem
+ int (A::*ptr4) (int) = ns; // { dg-error "" } not ptr mem
int (*ptr5) (short) = &A::ns;
int (*ptr6) (short) = A::ns;
int (*ptr8) (short) = ns;
int (A::*ptr11) (int) = &A::single;
- int (A::*ptr12) (int) = A::single; // ERROR - not ptr mem
- int (A::*ptr13) (int) = &single; // ERROR - not ptr mem
- int (A::*ptr14) (int) = single; // ERROR - not ptr mem
+ int (A::*ptr12) (int) = A::single; // { dg-error "" } not ptr mem
+ int (A::*ptr13) (int) = &single; // { dg-error "" } not ptr mem
+ int (A::*ptr14) (int) = single; // { dg-error "" } not ptr mem
- int (A::*ptr20) (int) = &(A::ns); // ERROR - not ptr mem
- int (A::*ptr21) (int) = &(A::single); // ERROR - not ptr mem
+ int (A::*ptr20) (int) = &(A::ns); // { dg-error "" } not ptr mem
+ int (A::*ptr21) (int) = &(A::single); // { dg-error "" } not ptr mem
int (*ptr31) (short) = &A::sole;
int (*ptr32) (short) = A::sole;
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 22 Nov 2000 <nathan@codesourcery.com>
int main ()
{
foofPtr fp = &foo::b;
- barfPtr bp = (barfPtr)fp; // WARNING - pointer to member
- foofPtr fp2 = (foofPtr)bp; // WARNING - pointer to member
+ barfPtr bp = (barfPtr)fp; // { dg-warning "" } pointer to member
+ foofPtr fp2 = (foofPtr)bp; // { dg-warning "" } pointer to member
if (fp2 != fp)
return 1;
fobj.m = 78;
foomPtr fmp = &foo::m;
- barmPtr bmp = (barmPtr)fmp; // WARNING - pointer to member
- foomPtr fmp2 = (foomPtr)bmp; // WARNING - pointer to member
+ barmPtr bmp = (barmPtr)fmp; // { dg-warning "" } pointer to member
+ foomPtr fmp2 = (foomPtr)bmp; // { dg-warning "" } pointer to member
bar *bptr = &fobj;
if (fmp != fmp2)
+// { dg-do run }
// Test that const-correctness is observed when using pointers-to-members.
struct A {
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O" }
// Origin: Benjamin Pflugmann <philemon@spin.de>
-// Special g++ Options: -O
// DR 295 allows qualification via typedef
public:
func_type *Function;
// The following is DR 295 dependent
- const func_type* function(void) { return Function; } // ERROR - constifying
- volatile func_type* functionv(void); // ERROR - qualifier
+ const func_type* function(void) { return Function; } // { dg-error "" } constifying
+ volatile func_type* functionv(void); // { dg-error "" } qualifier
} action;
void work(const char *source)
-// Build don't link:
+// { dg-do assemble }
extern "C" void realloc();
-//Build don't link:
+// { dg-do assemble }
struct X{
void i();
- void i(int); // ERROR -
- int i; // ERROR - conflict
+ void i(int); // { dg-error "" }
+ int i; // { dg-error "" } conflict
};
-// Build don't link:
+// { dg-do assemble }
struct S {
S(int);
- S(int); // ERROR - already declared
+ S(int); // { dg-error "" } already declared
~S();
- ~S(); // ERROR - already declared
+ ~S(); // { dg-error "" } already declared
};
+// { dg-do assemble }
// Bug: g++ thought this was a redeclaration of a local variable.
-// Build don't link:
int i;
int main ()
+// { dg-do assemble }
int main() {
struct A {
void f();
- void f(); // ERROR - already declared
+ void f(); // { dg-error "" } already declared
};
}
-// Build don't link:
+// { dg-do assemble }
int f();
void g()
{
const int& i = f(); // OK
- int& j = f(); // ERROR - initialization of non-const reference
- const volatile int& k = f(); // ERROR - initialization of volatile ref
+ int& j = f(); // { dg-error "" } initialization of non-const reference
+ const volatile int& k = f(); // { dg-error "" } initialization of volatile ref
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
struct A {
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct B1
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 27 Feb 2001 <nathan@codesourcery.com>
+// { dg-do assemble }
// Test that we don't allow multiple user-defined conversions in reference
// initialization.
-// Build don't link:
struct B { };
C c;
-const A& ref (c); // ERROR - requires two UDCs
+const A& ref (c); // { dg-error "" } requires two UDCs
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 10 Aug 2000 <nathan@codesourcery.com>
namespace A {
template <class T> void f(T) {}
}
-void (* &h)(int) = A::f<int>; // ERROR - rvalue to non-const
-void (*const volatile &i)(int) = A::f<int>; // ERROR - rvalue to volatile
+void (* &h)(int) = A::f<int>; // { dg-error "" } rvalue to non-const
+void (*const volatile &i)(int) = A::f<int>; // { dg-error "" } rvalue to volatile
void (*const &j)(int) = A::f<int>;
-int &k = 1; // ERROR - rvalue to non-const
-int &const volatile l = 1; // ERROR - rvalue to volatile
+int &k = 1; // { dg-error "" } rvalue to non-const
+int &const volatile l = 1; // { dg-error "" } rvalue to volatile
int const &m = 1;
-// Special g++ Options: -O2
-// Skip if not target: i?86-*-*
+// { dg-do run { target i?86-*-* } }
+// { dg-options "-O2" }
inline double foo (double x)
{
+// { dg-do run }
extern "C" void abort ();
struct A {
-// Build don't link:
+// { dg-do assemble }
// Special g++ Option:
// Origin: holmen@mail.nu
C* D::g() {
int i = 0;
while (i < 1 && a[i].f() != 1) {}
- return undefined_variable; // ERROR -
+ return undefined_variable; // { dg-error "" }
}
+// { dg-do run }
+// { dg-options "-frtti" }
// test of rtti of non-class types
-// Special g++ Options: -frtti
#include <typeinfo>
+// { dg-do run }
+// { dg-options "-frtti" }
// test of rtti of single inheritance and multiple inheritance classes
-// Special g++ Options: -frtti
#include <typeinfo>
+// { dg-do run }
+// { dg-options "-frtti" }
// test of rtti of single inheritance and multiple inheritance with
// virtual functions
-// Special g++ Options: -frtti
#include <typeinfo>
+// { dg-do run }
+// { dg-options "-frtti -w" }
// test of rtti of single inheritance and multiple inheritance with
// virtual inheritance
-// Special g++ Options: -frtti -w
#include <typeinfo>
-// Build don't link:
-// Special g++ Options: -fno-rtti
+// { dg-do assemble }
+// { dg-options "-fno-rtti" }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 9 Apr 1999 <nathan@acm.org>
int main(void) {
int i;
- typeid(i); // ERROR - rtti disabled
+ typeid(i); // { dg-error "" } rtti disabled
}
+// { dg-do run }
+// { dg-options "-frtti" }
// test of rtti of single inheritance and multiple inheritance classes
// dynamic casting
-// Special g++ Options: -frtti
#include <typeinfo>
+// { dg-do run }
+// { dg-options "-frtti" }
// test of rtti of single inheritance and multiple inheritance with
// virtual functions
// dynamic casting
-// Special g++ Options: -frtti
#include <typeinfo>
+// { dg-do run }
+// { dg-options "-w" }
// test of rtti of single inheritance and multiple inheritance with
// virtual inheritance
// dynamic casting
-// Special g++ Options: -w
#include <typeinfo>
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
void f() {
const int *c = 0;
static_cast <const int *>(i);
- static_cast <int *>(c); // ERROR - casts away constness
+ static_cast <int *>(c); // { dg-error "" } casts away constness
}
+// { dg-do run }
// Testcase for proper scoping of local externs.
int x = 1;
+// { dg-do assemble }
// Bug: g++ thinks that the i in g() shadows the parm from f()
// Contributed by Jason Merrill <jason@cygnus.com>
-// Build don't link:
void f (int i)
{
-// Special g++ Options: -O2
+// { dg-do run }
+// { dg-options "-O2" }
#include <iostream>
-// Build don't link:
-// Special g++ Options: -O2 -foptimize-sibling-calls -fno-exceptions
+// { dg-do assemble }
+// { dg-options "-O2 -foptimize-sibling-calls -fno-exceptions" }
struct X
{
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 Mar 1999 <nathan@acm.org>
+// { 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
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
struct X {
void f(int i)
{
- i = sizeof(X::f); // ERROR - cannot take sizeof a member function
+ i = sizeof(X::f); // { dg-error "" } cannot take sizeof a member function
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S
{
- int j; // ERROR - non-static data member
- int i[2]; // ERROR - non-static data member
+ int j; // { dg-error "" } non-static data member
+ int i[2]; // { dg-error "" } non-static data member
};
void f ()
{
- sizeof (S::j); // ERROR - used here
- sizeof (S::i[0]); // ERROR - used here
+ sizeof (S::j); // { dg-error "" } used here
+ sizeof (S::i[0]); // { dg-error "" } used here
}
+// { dg-do run }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 5 Sep 1999 <nathan@acm.org>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 5 Sep 1999 <nathan@acm.org>
int main (int argc, char **argv)
{
- sizeof (s); // ERROR - incomplete
- sizeof (0, s); // ERROR - incomplete
- sizeof (argc ? s : s); // ERROR - incomplete
+ sizeof (s); // { dg-error "" } incomplete
+ sizeof (0, s); // { dg-error "" } incomplete
+ sizeof (argc ? s : s); // { dg-error "" } incomplete
- sizeof (arys); // ERROR - incomplete
- sizeof (0, arys); // ERROR - incomplete
- sizeof (argc ? arys : arys); // ERROR - incomplete
+ sizeof (arys); // { dg-error "" } incomplete
+ sizeof (0, arys); // { dg-error "" } incomplete
+ sizeof (argc ? arys : arys); // { dg-error "" } incomplete
- sizeof (aryt); // ERROR - incomplete
- sizeof (0, aryt); // ERROR - incomplete
- sizeof (argc ? aryt : aryt); // ERROR - incomplete
+ sizeof (aryt); // { dg-error "" } incomplete
+ sizeof (0, aryt); // { dg-error "" } incomplete
+ sizeof (argc ? aryt : aryt); // { dg-error "" } incomplete
- sizeof (fn); // ERROR - cannot take size of function
- sizeof (0, fn); // ERROR - cannot take size of function
- sizeof (argc ? fn : fn); // ERROR - cannot take size of function
+ 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
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 23 Feb 2000 <nathan@codesourcery.com>
// Derived from a bug report by Marko Maekelae <Marko.Makela@HUT.FI>
-// crash test
struct A;
void foo ()
{
- sizeof ( void ()); // ERROR - ISO forbids
+ sizeof ( void ()); // { dg-error "" } ISO forbids
sizeof ( void (A::*) ());
sizeof ( void (A::*) () const);
- sizeof (void (*) () const); // ERROR - invalid quals
- sizeof ( void () const); // ERROR - ISO forbids, ERROR - invalid quals
+ sizeof (void (*) () const); // { dg-error "" } invalid quals
+ sizeof ( void () const); // { dg-error "" } ISO forbids, ERROR - invalid quals
}
+// { dg-do assemble }
extern "C" void abort();
struct S
static const int i = 3;
};
-const int S::i = 2; // ERROR - duplicate initialization
+const int S::i = 2; // { dg-error "" } duplicate initialization
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-w" }
// Origin: Ulrich Drepper <drepper@cygnus.com>
-// Special g++ Options: -w
struct st
{
-// Build don't link:
+// { dg-do assemble }
// Origin: Raja R Harinath <harinath@cs.umn.edu>
enum ReservedName {
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@redhat.com>
int main ()
-// Build don't run:
+// { dg-do link }
// Origin: scott snyder <snyder@fnal.gov>
struct Cleaner
-// Build don't run:
+// { dg-do link }
// Origin: scott snyder <snyder@fnal.gov>
struct basic_string
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
// Special g++ Option: -fdata-sections
+// { dg-do run }
// Test that we properly evaluate the object parameter when accessing static
// members.
-// Build don't link:
+// { dg-do assemble }
// Based on a test case by Koos Vriezen <koos@polder.ubc.kun.nl>
struct foo {
-// Build don't run:
+// { dg-do link }
struct foo
{
foo() {};
-// Build don't link:
+// { dg-do assemble }
class S
{
+// { dg-do run }
+// { dg-options "-O" }
// Origin: Andrew Pollard <andrew@odie.demon.co.uk>
-// Special g++ Options: -O
struct A {
A(int, int);
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S
inline void f()
{
static S s;
- atexit (0); // ERROR - implicit declaration
+ atexit (0); // { dg-error "" } implicit declaration
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
void f (int i)
+// { dg-do run }
// Origin: Jason Merrill <jason@cygnus.com>
int j = 42;
-// Build don't link:
+// { dg-do assemble }
// Origin: Ulrich Drepper <drepper@cygnus.com>
struct st
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
extern "C" int memcmp (const void * __s1,
-// Build don't link:
-// Special g++ Options: -O
+// { dg-do assemble }
+// { dg-options "-O" }
// Origin: Thomas Kunert <kunert@physik.tu-dresden.de>
#include <ctype.h>
-// Build don't link:
-// Special g++ Options: -O2
+// { dg-do assemble }
+// { dg-options "-O2" }
// Origin: Jakub Jelinek <jakub@redhat.com>
void bar(int);
-// Skip if not target: i?86-*-*
-// Special g++ Options: -mtune=i686 -O2 -fpic
+// { dg-do run { target i?86-*-* } }
+// { dg-options "-mtune=i686 -O2 -fpic" }
class G {};
struct N {
-// Skip if not target: i?86-*-*
-// Special g++ Options: -mtune=i686 -O2
+// { dg-do run { target i?86-*-* } }
+// { dg-options "-mtune=i686 -O2" }
class G {};
struct N {
-// Build don't link:
+// { dg-do assemble }
// Origin: mrs@wrs.com (Mike Stump)
class Wrapper {
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 Mar 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 3 Jun 1999 <nathan@acm.org>
// politely, but we used to die horribly.
class Y
-{ // ERROR - previous definition
+{ // { dg-error "" } previous definition
};
class Y
-{ // ERROR - redefinition
+{ // { dg-error "" } redefinition
};
template<class T> class X
-{ // ERROR - previous definition
+{ // { dg-error "" } previous definition
};
template<class T> class X
-{ // ERROR - redefinition
+{ // { dg-error "" } redefinition
};
template<class T> class X<T *>
-{ // ERROR - previous definition
+{ // { dg-error "" } previous definition
};
template<class T> class X<T *>
-{ // ERROR - redefinition
+{ // { dg-error "" } redefinition
};
template<> class X<int>
-{ // ERROR - previous definition
+{ // { dg-error "" } previous definition
};
template<> class X<int>
-{ // ERROR - redefinition
+{ // { dg-error "" } redefinition
};
template<> class X<int *>
-{ // ERROR - previous definition
+{ // { dg-error "" } previous definition
};
template<> class X<int *>
-{ // ERROR - redefinition
+{ // { dg-error "" } redefinition
};
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-fsyntax-only" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options: -fsyntax-only
class AAA{
public:
-// Build don't link:
-// Special g++ Options: -fsyntax-only
+// { dg-do assemble }
+// { dg-options "-fsyntax-only" }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct B
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 22 June 2000 <nathan@codesourcery.com>
X();
};
-class X::X () {} // ERROR - parse error
+class X::X () {} // { dg-error "" } parse error
X::X () {}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 22 June 2000 <nathan@codesourcery.com>
};
class Y::Z {};
-class Y::W () {} // ERROR - parse error
+class Y::W () {} // { dg-error "" } parse error
Y::W::X () {}
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options:
# 1 "foo" 3
void f () {}
+// { dg-do run }
extern "C" int printf (const char *, ...);
int c, d;
+// { dg-do run }
extern "C" void abort();
int ic;
-// Build don't link:
+// { dg-do assemble }
typedef unsigned short ushort;
class foo {
-// Build don't link:
+// { dg-do assemble }
-extern int a[][]; // ERROR - invalid multidimensional array
-extern int b[7][]; // ERROR - invalid multidimensional array
+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)[]; // ERROR - previous declaration
-extern int (*i)[7]; // ERROR - conflicting types for `i'
+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); // ERROR - passing wrong type
+ f(k); // { dg-error "" } passing wrong type
}
-// Build don't link:
+// { dg-do assemble }
typedef const struct {
int x;
static void foo(Test t)
{
- t.x = 0; // ERROR - assignment of read-only member
+ t.x = 0; // { dg-error "" } assignment of read-only member
return;
}
-//Build don't link:
+// { dg-do assemble }
struct S{
static const int i;
-//Build don't link:
+// { dg-do assemble }
template<class T>
struct X{
T v;
-// Build don't link:
+// { dg-do assemble }
struct A {
void f ();
-// Build don't link:
+// { dg-do assemble }
// by Alexandre Oliva <oliva@dcc.unicamp.br>
typedef t* u;
typedef u v;
typedef v* (*w)(t const); // this is ok
-typedef v* (*w)(t); // ERROR - covers message `previously declared here'
-typedef v* (*const w)(t); // ERROR - invalid redeclaration
-typedef v const* (*w)(t); // ERROR - invalid redeclaration
-typedef v* const (*w)(t); // ERROR - invalid redeclaration
+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
+// { dg-do assemble }
// Submitted by Jason Merrill <jason@cygnus.com>.
// Bug: g++ fails to see through the T typedef in the C ctor.
-// Build don't link:
struct A {
A (int) { }
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
typedef int I;
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 17 Aug 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// Origin: sk@gluit.de
-// Special g++ Options:
#include <typeinfo>
int len = 1;
char carr[len];
- typeid(typeof(carr)); // ERROR - type has variable size
- typeid(carr); // ERROR - type has variable size
+ typeid(typeof(carr)); // { dg-error "" } type has variable size
+ typeid(carr); // { dg-error "" } type has variable size
}
-// Build don't link:
+// { dg-do assemble }
#include <typeinfo>
+// { dg-do assemble }
+// { dg-options "-pedantic -Wno-deprecated" }
// This code snippet should be rejected with -pedantic
// Based on a test case by Louidor Erez <s3824888@techst02.technion.ac.il>
-// Build don't link:
-// Special g++ Options: -pedantic -Wno-deprecated
template<class T>
class Vector {
template<class T>
void f()
{
- Vector<T>::iterator i = 0; // WARNING - missing typename
+ Vector<T>::iterator i = 0; // { dg-warning "" } missing typename
}
-// Build don't link:
+// { dg-do assemble }
template<typename T>
void f()
{
- typename T::u; // ERROR - declare anything
+ typename T::u; // { dg-error "" } declare anything
}
-// Special g++ Options: -O2
+// { dg-do run }
+// { dg-options "-O2" }
#include <iostream>
#include <complex>
-// Build don't link:
+// { dg-do assemble }
class A
{
union B
{
char f1;
- A f2; // gets bogus error - non-copy assignment op is OK
+ A f2; // { dg-bogus "" } non-copy assignment op is OK
};
+// { dg-do run }
// Bug: g++ crashed on empty intializers for unions.
// Bug: gcc and g++ didn't zero unions with empty initializers.
// Submitted by J"orn Rennecke <amylaar@cygnus.co.uk>
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct A
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options:
union A
{
int i;
int j;
- A () : i (3), j (2) {} // ERROR - multiple initializations
+ A () : i (3), j (2) {} // { dg-error "" } multiple initializations
};
union B
int j;
};
- B () : i (3), j (2) {} // ERROR - multiple initializations
+ B () : i (3), j (2) {} // { dg-error "" } multiple initializations
};
union C
+// { dg-do assemble }
class D2;
class B {
private:
- int a; // ERROR - B::a is private
+ int a; // { dg-error "" } B::a is private
protected:
int b;
friend class D2;
};
-class D : public B { // ERROR - within this context
+class D : public B { // { dg-error "" } within this context
public:
using B::a;
using B::b;
};
-class D2 : public B { // ERROR - conflicting access specifications
+class D2 : public B { // { dg-error "" } conflicting access specifications
public:
using B::a;
using B::b;
-// Build don't link:
+// { dg-do assemble }
struct X{
void f();
};
-// Build don't link:
+// { dg-do assemble }
struct A{
A();
};
} S;
struct B: S{
- using S::S; // ERROR - no such field
+ using S::S; // { dg-error "" } no such field
};
-// Build don't link:
+// { dg-do assemble }
// Based on a testcase by Martin Bachtold <martinb@coyotesystems.com>
-// Build don't link:
+// { dg-do assemble }
// Based on bug report by Klaus-Georg Adams
// <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
+// { dg-do run }
// Test of class-scope using-declaration for functions.
#define assert(COND) if (!(COND)) return 1
-// Build don't link:
+// { dg-do assemble }
class A {
protected:
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Nov 2000 <nathan@codesourcery.com>
struct D : A
{
- using A::D; // ERROR - names constructor
+ using A::D; // { dg-error "" } names constructor
};
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 26 Feb 2001 <nathan@codesourcery.com>
namespace {
extern "C" int foo ();
- using ::foo; // ERROR - already in use
+ using ::foo; // { dg-error "" } already in use
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
#include <stdarg.h>
+// { dg-do run }
// Copyright (C) 1999, 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 Oct 1999 <nathan@acm.org>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 Oct 1999 <nathan@acm.org>
struct X {int m;};
struct Y : X {int m;};
-struct Z; // ERROR - forward decl
+struct Z; // { dg-error "" } forward decl
void fn1(va_list args)
{
int i = va_arg (args, int);
- Y x = va_arg (args, Y); // WARNING - cannot receive
- Y y = va_arg (args, struct Y); // WARNING - cannot receive
- int &r = va_arg (args, int &); // WARNING - cannot receive
+ Y x = va_arg (args, Y); // { dg-warning "" } cannot receive
+ Y y = va_arg (args, struct Y); // { dg-warning "" } cannot receive
+ int &r = va_arg (args, int &); // { dg-warning "" } cannot receive
- Z z1 = va_arg (args, Z); // ERROR - incomplete
- const Z &z2 = va_arg (args, Z); // ERROR - incomplete
+ Z z1 = va_arg (args, Z); // { dg-error "" } incomplete
+ const Z &z2 = va_arg (args, Z); // { dg-error "" } incomplete
- va_arg (args, char); // ERROR - promote
- va_arg (args, int []); // ERROR - promote
- va_arg (args, int ()); // ERROR - promote
- va_arg (args, bool); // ERROR - promote
+ va_arg (args, char); // { dg-error "" } promote
+ va_arg (args, int []); // { dg-error "" } promote
+ va_arg (args, int ()); // { dg-error "" } promote
+ va_arg (args, bool); // { dg-error "" } promote
}
-// Build don't link:
+// { dg-do assemble }
// Bug 845. We were treating __builtin_va_arg as a unary expr, not a primary,
// and hence getting parse errors.
+// { dg-do run }
+// { dg-options "-w" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options: -w
int result;
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
int i;
-// Build don't link:
+// { dg-do assemble }
// Origin: scott snyder <snyder@fnal.gov>
class d0_Collection_Base {};
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 10 Jan 2001 <nathan@codesourcery.com>
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 19 Jan 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
struct S0 { virtual void f1 () { } };
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Nov 2000 <nathan@codesourcery.com>
{
virtual int foo (char);
static int foo ();
- virtual int foo (int); // ERROR - this function
+ virtual int foo (int); // { dg-error "" } this function
static int foo (float);
virtual int foo (double);
};
struct B : A
{
- static int foo (int); // ERROR - cannot override
+ static int foo (int); // { dg-error "" } cannot override
};
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Nov 2000 <nathan@codesourcery.com>
struct B
{
- virtual void foo (); // ERROR - of this function
+ virtual void foo (); // { dg-error "" } of this function
};
struct C : A , B
struct E : D
{
- virtual int foo (); // ERROR - invalid override
+ virtual int foo (); // { dg-error "" } invalid override
};
+// { dg-do run }
struct B
{
virtual int f() volatile
+// { dg-do run }
struct B
{
virtual int f() volatile
-// Build don't link:
+// { dg-do assemble }
class A {
public:
- virtual int foo() = 0; // ERROR - original definition
+ virtual int foo() = 0; // { dg-error "" } original definition
};
class B {
: public A, public B
{
public:
- virtual double foo() { return 2; } // ERROR - conflicting return type
+ virtual double foo() { return 2; } // { dg-error "" } conflicting return type
};
class D
: public B, public A
{
public:
- virtual double foo() { return 2; } // ERROR - conflicting return type
+ virtual double foo() { return 2; } // { dg-error "" } conflicting return type
};
-// Build don't link:
-// Special g++ Options: -w
+// { dg-do assemble }
+// { dg-options "-w" }
// Origin: Derived from code by Andris Pavenis <andris@stargate.astr.lu.lv>
class vector {};
+// { 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 <jason@cygnus.com>
-// Special g++ Options: -Woverloaded-virtual
-// Build don't link:
struct A {
virtual void f (int);
-// Build don't link:
-// Special g++ Options: -fno-rtti
+// { dg-do assemble }
+// { dg-options "-fno-rtti" }
// Origin: Anthony Green <green@cygnus.com>
class _JvObjectPrefix
+// { dg-do run }
extern "C" int printf (const char*, ...);
struct A
+// { dg-do run }
// Source: Neil Booth, from PR #111.
class A
+// { dg-do assemble }
// Test that failed lvalue-to-rvalue conversion of vf doesn't crash the
// compiler.
class f_class
-{ }; // ERROR - candidates
+{ }; // { dg-error "" } candidates
volatile f_class
ret_v_f_class()
int main(void)
{
volatile f_class vf;
- 0 ? ret_v_f_class() : vf; // ERROR - can't copy volatile lvalue
+ 0 ? ret_v_f_class() : vf; // { dg-error "" } can't copy volatile lvalue
return 0;
}
-// Build don't run:
+// { dg-do link }
// Origin: DJ Delorie <dj@delorie.com>
class X {
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 8 Feb 2000 <nathan@acm.org>
-// Build don't link:
-// Special g++ Options: -W -Wall
+// { dg-do assemble }
+// { dg-options "-W -Wall" }
typedef unsigned long size_t;
extern void* malloc (size_t);
void* (* _realloc) (void*, size_t);
};
-struct vtable mtable = { malloc, free }; // WARNING - _realloc
+struct vtable mtable = { malloc, free }; // { dg-warning "" } _realloc
-// Build don't link:
+// { dg-do assemble }
class A {
};
-class B { // WARNING - only private constructors
+class B { // { dg-warning "" } only private constructors
public:
void f();
};
-class C { // WARNING - only private destructors
+class C { // { dg-warning "" } only private destructors
public:
void f();
};
-class D { // WARNING - all member functions are private
+class D { // { dg-warning "" } all member functions are private
private:
void f();
};
template <class T>
-class X { // WARNING - only private destructors
+class X { // { dg-warning "" } only private destructors
private:
~X ();
};
template <class T>
-class Y { // WARNING - only private constructors
+class Y { // { dg-warning "" } only private constructors
private:
Y ();
Y (const Y&);
template <class T>
-class Z { // WARNING - all member functions are private
+class Z { // { dg-warning "" } all member functions are private
private:
void f();
};
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>
void fs ()
{
- unsigned s1 = -1; // WARNING - initialization
- unsigned s2(-1); // WARNING - initialization
- unsigned volatile s3 = -1;// WARNING - initialization
- unsigned const s4 = -1; // WARNING - initialization
- unsigned const &s5(-1); // WARNING - initialization
- s1 = -1; // WARNING - assignment
- fn (-1); // WARNING - passing
+ 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 ()
-// Special g++ Options: -W
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-W " }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 Febs 2001 <nathan@codesourcery.com>
return new X (); // gets bogus warning
}
-X x = {}; // WARNING - missing initializer
+X x = {}; // { dg-warning "" } missing initializer
-// Build don't link:
-// Special g++ Options: -W -Wall
+// { dg-do assemble }
+// { dg-options "-W -Wall" }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 2 Mar 2001 <nathan@codesourcery.com>
-// Build don't link:
-// Special g++ Options: -W -Wall
+// { dg-do assemble }
+// { dg-options "-W -Wall" }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 26 April 2001 <nathan@codesourcery.com>
void bar (int);
Y::Y(int i)
-{ // WARNING - unused parameter
+{ // { dg-warning "" } unused parameter
}
void Y::bar (int i)
-{ // WARNING - unused parameter
+{ // { dg-warning "" } unused parameter
}
void bar (int i)
-{ // WARNING - unused parameter
+{ // { dg-warning "" } unused parameter
}
+// { dg-do run }
extern "C" void abort();
struct S
+// { dg-do run }
template <class T, unsigned N>
unsigned size(T (&)[N]) { return N; }
template <class T, unsigned N>
-// Build don't link:
+// { dg-do assemble }
template<int N, class C>
class Bar {};
-// Build don't link:
+// { dg-do assemble }
// Origin: Brendan Kehoe <brendan@cygnus.com>
template <int x> int foo(char[4][x]) { return x; }
+// { dg-do assemble }
// Test to make sure that the array bounds are treated as an expression
// in template parm substitution.
// Written by Jason Merrill <jason@cygnus.com>
-// Build don't link:
template <class T> void f (T t) { int ar[sizeof (T)]; }
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// Origin: Alfred Minarik <a8601248@unet.univie.ac.at>
-// Special g++ Options:
template<typename _CharT>
struct basic_filebuf
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <typename T>
-// Build don't link:
+// { dg-do assemble { target i?86-*-linux* x86_64-*-linux } }
// Origin: "Weidmann, Nicholas" <nicholas.weidmann@swx.ch>
-// Skip if not target: i?86-*-linux* x86_64-*-linux
template<int i> int foo(int v)
{
-// Build don't link:
+// { dg-do assemble { target i?86-*-linux* } }
// Origin: "Weidmann, Nicholas" <nicholas.weidmann@swx.ch>
-// Skip if not target: i?86-*-linux*
typedef void (function_ptr)(int);
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
void f()
{
S<const int> s;
- s = s; // ERROR - generated assignment operator is illegal
+ s = s; // { dg-error "" } generated assignment operator is illegal
}
+// { dg-do assemble }
template <typename Y> struct auto_ptr_ref {
Y* py;
auto_ptr_ref(Y* p) : py(p) {}
typedef X element_type;
explicit auto_ptr(X* p =0) throw() : px(p) {}
- auto_ptr(auto_ptr& r) throw() : px(r.release()) {} // ERROR - candidate
+ auto_ptr(auto_ptr& r) throw() : px(r.release()) {} // { dg-error "" } candidate
template<typename Y>
- auto_ptr(auto_ptr<Y>& r) throw() : px(r.release()) {}// ERROR - candidate
+ auto_ptr(auto_ptr<Y>& r) throw() : px(r.release()) {}// { dg-error "" } candidate
auto_ptr& operator=(auto_ptr& r) throw() {
reset(r.release());
X* release() throw() { X* p=px; px=0; return p; }
void reset(X* p=0) throw() { if (px != p) delete px, px = p; }
- auto_ptr(auto_ptr_ref<X> r) throw() : px(r.py) {} // ERROR - candidate
+ auto_ptr(auto_ptr_ref<X> r) throw() : px(r.py) {} // { dg-error "" } candidate
template<typename Y> operator auto_ptr_ref<Y>() throw() {
return auto_ptr_ref<Y>(release());
}
auto_ptr<Derived> y(f());
x = y;
g(f());
- h(f()); // ERROR - no usable copy ctor
+ h(f()); // { dg-error "" } no usable copy ctor
}
+// { dg-do assemble }
template<class Type>
class A
{
template<class Type>
void f(A<Type>& a, Type d)
{
- A.m=d; // ERROR - invalid use of template
+ A.m=d; // { dg-error "" } invalid use of template
}
int main()
+// { dg-do assemble }
// Bug: Checking whether A depends on template parms, we crash because
// __builtin_va_list lacks TYPE_LANG_SPECIFIC.
-// Build don't link:
void f (__builtin_va_list arg)
{
-// Build don't link:
+// { dg-do assemble }
struct IsCompressed { };
struct Field {
-// Build don't link:
+// { dg-do assemble }
struct IsCompressed { };
struct Field {
inline bool
for_each(const Field& p, IsCompressed, C)
{
- return p.IsCompressed(); // ERROR - calling type like a method
+ return p.IsCompressed(); // { dg-error "" } calling type like a method
}
template bool for_each<int>(const Field& p, IsCompressed, int);
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 10 Jan 2001 <nathan@codesourcery.com>
{
void *CLUT;
- CLUT = (unsigned char [3][256])CLUTp; // ERROR - cast to array
+ CLUT = (unsigned char [3][256])CLUTp; // { dg-error "" } cast to array
return;
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
int i;
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S
-// Build don't link:
+// { dg-do assemble }
// Origin: Loring Holden <lsh@lsh.cs.brown.edu>
template <class T>
-// Build don't link:
+// { dg-do assemble }
template <class T> struct B { static const int i = 3; };
template <class T> struct A { static const int i = B<T>::i; };
enum { i = A<int>::i };
+// { dg-do link }
// This test should get a linker error for the reference to A<int>::i.
-// An XPASS on this test is really a FAIL.
-// excess errors test - XFAIL *-*-*
+// { dg-error "i" "" { target *-*-* } 0 }
template <class T> struct B { static const int i = 3; };
template <class T> struct A { static const int i = B<T>::i; };
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S1 {};
void f()
{
S2 s;
- (D*) s; // ERROR - cannot convert
+ (D*) s; // { dg-error "" } cannot convert
}
-// Build don't link:
+// { dg-do assemble }
template<class T>
class A {
-// Build don't link:
+// { dg-do assemble }
// Origin: Chris Heath <cheath@math.lsa.umich.edu>
struct A {
void f(A a) {}
-int main() {f(1);} // ERROR - no conversion from int to A.
+int main() {f(1);} // { dg-error "" } no conversion from int to A.
+// { dg-do run }
int i = 0;
template <class T>
+// { dg-do assemble }
template<class T> class A {
public:
class subA {};
template<class T> class B : public A<T> {
public:
- class subB : public A::subA {}; // ERROR - not a class or namespace
+ class subB : public A::subA {}; // { dg-error "" } not a class or namespace
};
-// Build don't link:
+// { dg-do assemble }
template<int M, int N>
class GCD {
public:
- enum { val = (N == 0) ? M : GCD<N, M % N>::val }; // ERROR - division
+ enum { val = (N == 0) ? M : GCD<N, M % N>::val }; // { dg-error "" } division
};
int main() {
- GCD< 1, 0 >::val; // ERROR - instantiated
+ GCD< 1, 0 >::val; // { dg-error "" } instantiated
}
-// Build don't link:
+// { dg-do assemble }
class A
{
template <class j> class A::A_impl
-{ // ERROR - does not declare a template
+{ // { dg-error "" } does not declare a template
};
-// Build don't link:
-// Special g++ Options: -g
+// { dg-do assemble }
+// { dg-options "-g" }
template <class C>
class CenteringTag {
-// Build don't link:
+// { dg-do assemble }
template <class T> struct A {};
-template <class T> struct A<T>; // ERROR - does not specialize args
-template <class T> const struct A; // ERROR - parse error
-template <class T> template A<int>; // ERROR - .*
+template <class T> struct A<T>; // { dg-error "" } does not specialize args
+template <class T> const struct A; // { dg-error "" } parse error
+template <class T> template A<int>; // { dg-error "" } .*
-// Build don't link:
+// { dg-do assemble }
template <class T> struct A {};
template <class T> struct A<T*>;
-A<int*> ai; // ERROR - incomplete type
+A<int*> ai; // { dg-error "" } incomplete type
-// Build don't link:
+// { dg-do assemble }
template <class T>
template <class U>
-struct A { // ERROR - too many template parameter lists
+struct A { // { dg-error "" } too many template parameter lists
public:
A() {}
-// Build don't link:
-// Special g++ Options:
-// excess errors test - XFAIL xstormy16-*-*
+// { dg-do assemble { xfail xstormy16-*-* } }
+// { dg-options "" }
extern "C" void qsort(void *base, __SIZE_TYPE__ nmemb, __SIZE_TYPE__ size,
int (*compar)(const void *, const void *));
-// Build don't link:
+// { dg-do assemble }
template <int B>
class foo;
-// Build don't run:
+// { dg-do link }
template<class T>
class foo {
-// Build don't link:
+// { dg-do assemble }
template <int I>
void f()
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S1
-// Build don't link:
+// { dg-do assemble }
template <class T = int>
struct A { const T x; A() : x(0) { } A(T x) : x(x) { } };
template <class B>
-void func () { B y; y = B(); } // ERROR - can't use default assignment
+void func () { B y; y = B(); } // { dg-error "" } can't use default assignment
int main (void) { func< A<> >(); }
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
class Pooled
{
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S1 {};
template <class T, class U = S1<T> >
struct S2 {};
-template struct S2<100>; // ERROR - type/value mismatch
+template struct S2<100>; // { dg-error "" } type/value mismatch
-// Build don't link:
+// { dg-do assemble }
template <class A, class B> void foo();
template <class C> class bar {
public:
int i;
- template <class B> friend void foo<C,B>(); // ERROR - template-id
+ template <class B> friend void foo<C,B>(); // { dg-error "" } template-id
};
template <class A, class B> void foo() {
bar<A> baz; baz.i = 1;
-// Build don't link:
+// { dg-do assemble }
template<typename T, template <class> class U> void template_fn (T);
template<typename T> void callme ( void (*)(T));
-// Build don't link:
+// { dg-do assemble }
template <class T>
void f()
-// Build don't link:
+// { dg-do assemble }
// Origin: Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
double f(double);
-// Build don't link:
+// { dg-do assemble }
template<int i> int f (void)
{
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
template <class ARRY>
inline unsigned int asize(ARRY &a)
void f(unsigned int n) {
int x[n];
- asize(x); // ERROR - no matching function
+ asize(x); // { dg-error "" } no matching function
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Steven Parkes <parkes@sierravista.com>
typedef __SIZE_TYPE__ size_t;
-// Build don't link:
+// { dg-do assemble }
template <class Type>
class CVector {
-// Build don't link:
+// { dg-do assemble }
extern "C" int printf(const char *, ...);
template <class T> struct A {
- typedef typename T::X B; // ERROR - not a class
+ typedef typename T::X B; // { dg-error "" } not a class
A(double);
};
template <class T> void xxx(typename A<T>::B);
template <class T> struct B {
- friend void xxx<T>(T); // ERROR - does not match any template
+ friend void xxx<T>(T); // { dg-error "" } does not match any template
};
template struct B<double>;
-// Build don't link:
+// { dg-do assemble }
// Origin: Corey Kosak
struct cow_t {
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
template <class T> struct A
template<class T> struct C
{
- friend typename A<T>::B; // ERROR - `typename' not allowed
+ friend typename A<T>::B; // { dg-error "" } `typename' not allowed
};
-// Build don't link:
+// { dg-do assemble }
// Origin: Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
class A {
-// Build don't link:
+// { dg-do assemble }
// Origin: Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
template <class T>
-// Build don't link:
+// { dg-do assemble }
// Origin: Miniussi <miniussi@ilog.fr>
template <class O>
-// Build don't link:
+// { dg-do assemble }
// Origin: Andreas Kloeckner <ak@ixion.net>
template<class Iterator> struct iterator_traits {
typedef typename Iterator::iterator_category
- iterator_category; // ERROR - no type iterator_category
+ iterator_category; // { dg-error "" } no type iterator_category
};
template<class Category>
};
reverse_iterator<list_iterator<T> > rbegin()
- { return reverse_iterator<list_iterator<T> > // ERROR - no type|instantiated here
- (list_iterator<T>(Head->next())); } // ERROR - not declared
+ { return reverse_iterator<list_iterator<T> > // { dg-error "" } no type|instantiated here
+ (list_iterator<T>(Head->next())); } // { dg-error "" } not declared
};
template class list<int>;
-// Build don't link:
+// { dg-do assemble }
// Origin: Jens Maurer <jmaurer@menuett.rhein-main.de>
template<class T, void (T::*f)(int)>
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
struct S {
- typedef typename T::Y<T>::Z X; // ERROR - No Y in A
- X x; // ERROR - No Y in A
+ typedef typename T::Y<T>::Z X; // { dg-error "" } No Y in A
+ X x; // { dg-error "" } No Y in A
};
struct A {
-// Build don't link:
+// { dg-do assemble }
// Origin: Ian Nixon <ian@tharas.com>
class Action {
-// Build don't link:
+// { dg-do assemble }
template <unsigned rank>
class Tensor
};
template <unsigned rank>
-class Tensor<2> : Tensor<rank> { // ERROR - template parameters not used
+class Tensor<2> : Tensor<rank> { // { dg-error "" } template parameters not used
};
-// Build don't link:
+// { dg-do assemble }
// Origin: rch@larissa.sd.bi.ruhr-uni-bochum.de
template< class X >
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <int> struct S1{};
-// Build don't link:
+// { dg-do assemble }
// Origin: Walter Brisken <walterfb@puppsr14.princeton.edu>
template <class T> class list {};
void crash()
{
newtype* n;
- n->list.size (); // ERROR - invalid use of template
+ n->list.size (); // { dg-error "" } invalid use of template
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <int T>
friend struct S<U>::X;
template <int U>
- friend typename S<U>::Y; // ERROR - typename as friend
+ friend typename S<U>::Y; // { dg-error "" } typename as friend
};
struct T {
struct U {
template <int T>
- friend typename S<T>::X; // ERROR - typename as friend
+ friend typename S<T>::X; // { dg-error "" } typename as friend
};
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
struct S
{
template <class U>
- friend S<U>; // ERROR - friend must use tag
+ friend S<U>; // { dg-error "" } friend must use tag
};
template struct S<int>;
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
template <class T> void f()
-// Build don't link:
+// { dg-do assemble }
// Origin: Leon Bottou <leonb@research.att.com>
class AA { protected:
-// Build don't link:
+// { dg-do assemble }
// Origin: Rick Campbell <rick.campbell@db.com>
template <class Owner, typename Type>
-// Build don't link:
+// { dg-do assemble }
// Origin: Jean-Francois Panisset <panisset@discreet.com>
template<class T>
-// Build don't link:
+// { dg-do assemble }
// Origin: Loring Holden <lsh@cs.brown.edu>
template <class T>
-// Build don't link:
+// { dg-do assemble }
template <class T, int i>
struct K {
template <class T>
void
-K<T, i>::f() // ERROR - i has not been declared
+K<T, i>::f() // { dg-error "" } i has not been declared
{
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
-// Special g++ Options: -fpermissive -w
+// { dg-do assemble }
+// { dg-options "-fpermissive -w" }
// Origin: Mark Mitchell <mark@codesourcery.com>
char foo[26];
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
// Origin: Jakub Jelinek <jakub@redhat.com>
template<class T> struct foo {
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 1 Sep 2000 <nathan@codesourcery.com>
};
void foo () {
- basic_string<char>::iterator<char> p; // ERROR - not a template // ERROR - no type
+ basic_string<char>::iterator<char> p; // { dg-error "" } not a template // ERROR - no type
}
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 11 Aug 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 5 Sept 2000 <nathan@codesourcery.com>
// bug 147. We ICE'd on an unprocessed LOOKUP_EXPR during tsubsting
namespace EManip {
- template <class T> void do_assign(T* d); // ERROR - candidate
+ template <class T> void do_assign(T* d); // { dg-error "" } candidate
}
-template <class T> void do_assign(T* d); // ERROR - candidate
+template <class T> void do_assign(T* d); // { dg-error "" } candidate
template <class T>
struct MatrixC
{
void foo () {
EManip::do_assign<T> (0);
- &EManip::do_assign<T>; // ERROR - unresolved
- &do_assign<T>; // ERROR - unresolved
- EManip::do_assign<T>; // ERROR - unresolved
- do_assign<T>; // ERROR - unresolved
+ &EManip::do_assign<T>; // { dg-error "" } unresolved
+ &do_assign<T>; // { dg-error "" } unresolved
+ EManip::do_assign<T>; // { dg-error "" } unresolved
+ do_assign<T>; // { dg-error "" } unresolved
}
};
void foo(MatrixC <double> *ptr)
{
- EManip::do_assign<double>; // ERROR - unresolved
- &EManip::do_assign<double>; // ERROR - unresolved
+ EManip::do_assign<double>; // { dg-error "" } unresolved
+ &EManip::do_assign<double>; // { dg-error "" } unresolved
ptr->foo ();
- void (*p1) (int *) = &do_assign<double>; // ERROR - cannot convert
- void (*p2) (int *) = &EManip::do_assign<double>; // ERROR - cannot convert
+ void (*p1) (int *) = &do_assign<double>; // { dg-error "" } cannot convert
+ void (*p2) (int *) = &EManip::do_assign<double>; // { dg-error "" } cannot convert
void (*p3) (int *) = &do_assign;
void (*p4) (int *) = &EManip::do_assign;
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 Oct 2000 <nathan@codesourcery.com>
// Origin: Bug 543 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
template <class T>
void addConstsTo(const T &container)
{
-typename T::const_iterator l = 0; // ERROR - no type const_iterator
+typename T::const_iterator l = 0; // { dg-error "" } no type const_iterator
}
void tallyConstants()
-// Build don't link:
+// { dg-do assemble }
template <class T> class List;
struct List
{
void length () const {
- for (ListIterator<T> li; li; ); // ERROR - used where a `bool'
+ for (ListIterator<T> li; li; ); // { dg-error "" } used where a `bool'
}
};
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 7 Nov 2000 <nathan@codesourcery.com>
void f()
{
- k( E(), (S*)0, &S::f ); // ERROR - no match
+ k( E(), (S*)0, &S::f ); // { dg-error "" } no match
}
-// Build don't link:
+// { dg-do assemble }
// Source: Neil Booth, from PR # 106. 4 Dec 2000.
template <bool b> class bar
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 5 Jan 2001 <nathan@codesourcery.com>
// Bug 911, ICE on bogus template declaration
-template <class T> class A<T>; // ERROR - not a template
+template <class T> class A<T>; // { dg-error "" } not a template
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 10 Jan 2001 <nathan@codesourcery.com>
// Bug 1585. We ICEd on a template template parm with no parms.
template<template<class> class C> class B;
-template<template<> class C> class D; // ERROR - parse error
+template<template<> class C> class D; // { dg-error "" } parse error
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 10 Jan 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble { xfail *-*-* } }
// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 11 Jan 2001 <nathan@codesourcery.com>
// Bug 1506. We ICE'd on a struct definition inside a template parms.
// This is still not completely fixed, but now issues a diagnostic
-// crash test - XFAIL *-*-*
template<class T =
-struct W {}; // ERROR - inside template parms
+struct W {}; // { dg-error "" } inside template parms
> struct S{};
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 7 May 2001 <nathan@codesourcery.com>
struct D : B<T>
{
D (T r)
- : B (r) // ERROR - no field named B
+ : B (r) // { dg-error "" } no field named B
{}
};
}
struct D2 : N1::B<T>
{
D2 (T r)
- : N1::B (r) // ERROR - no field named N1::B
+ : N1::B (r) // { dg-error "" } no field named N1::B
{}
};
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
//
// Copyright (C) 2001, 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 May 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 25 Jul 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
class foo
{
};
-template <class T : public foo> // ERROR - base clause
+template <class T : public foo> // { dg-error "" } base clause
struct bar
{
};
-// Build don't link:
+// { dg-do assemble }
template<class T>
class TestClass1 {
q2 = TestClass2<T>();
TestClass1<T> p1;
- p1 = TestClass1(); // ERROR - template used as expression
+ p1 = TestClass1(); // { dg-error "" } template used as expression
TestClass2<T> p2;
- p2 = TestClass2(); // ERROR - template used as expression
+ p2 = TestClass2(); // { dg-error "" } template used as expression
}
int main() {
-// Build don't link:
+// { dg-do assemble }
template <class T>
-void f(T) {} // ERROR - parameter has incomplete type
+void f(T) {} // { dg-error "" } parameter has incomplete type
-class C; // ERROR - forward declaration
+class C; // { dg-error "" } forward declaration
void g(const C& c)
{
- f(c); // ERROR - invalid use of undefined type
+ f(c); // { dg-error "" } invalid use of undefined type
}
-// Build don't link:
+// { dg-do assemble }
template <typename _CharT>
struct moneypunct
+// { dg-do assemble }
// Test for use of template parms in constructor name.
// Submitted by Jason Merrill <jason@cygnus.com>
-// Build don't link:
template <class T>
struct A {
-// Build don't link:
-// Special g++ Options: -g
+// { dg-do assemble }
+// { dg-options "-g" }
// Origin: Jim Wilson <wilson@cygnus.com>
template<template<class> class _Oper,
+// { dg-do assemble }
struct S {
template <class T>
- int f(T), g(T); // ERROR - more than one declarator
+ int f(T), g(T); // { dg-error "" } more than one declarator
};
template <class T>
-void x(T), y(T); // ERROR - more than one declarator
+void x(T), y(T); // { dg-error "" } more than one declarator
template <class T>
struct S2
};
template <class T>
-int S2<T>::i, S2<T>::j; // ERROR - more than one declarator
+int S2<T>::i, S2<T>::j; // { dg-error "" } more than one declarator
template <>
-int S2<int>::i, S2<double>::i; // ERROR - more than one declarator
+int S2<int>::i, S2<double>::i; // { dg-error "" } more than one declarator
-// Build don't link:
-// crash test - XFAIL *-*-*
+// { dg-do assemble { xfail *-*-* } }
// Simplified from testcase by Christophe Boyanique <boyan@imac.u-paris2.fr>
template <class T> struct foo { foo(); };
template<class T> foo<T>::foo() {}
-T; // ERROR - no type
+T; // { dg-error "" } no type
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
template <class T, class U = int> struct A;
-// Build don't link:
-// crash test -
+// { dg-do assemble }
// by Paul Burchard <burchard@pobox.com>, Level Set Systems, Inc.
// Copyright (C) 1999 Free Software Foundation
-typedef std::vector<int>::iterator iter; // ERROR - syntax error before `::'
+typedef std::vector<int>::iterator iter; // { dg-error "" } syntax error before `::'
-// Build don't link:
+// { dg-do assemble }
template<class CoordinateSystem, class MeshTag>
struct Mesh { };
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 5 Sept 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 18 Jan 2001 <nathan@codesourcery.com>
void Baz (int *p1, int const *p2)
{
- int i = Foo (p1); // ERROR - cannot convert
+ int i = Foo (p1); // { dg-error "" } cannot convert
int j = Foo (p2);
}
void Baz (float *p1, float const *p2)
+// { dg-do run }
// Test that we can deduce t even though T is deduced from a later argument.
template <int I> struct A { };
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 13 Feb 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 13 Feb 2001 <nathan@codesourcery.com>
+// { dg-do run }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Jason Merrill 14 Jun 2001 <jason@redhat.com>
+// { dg-do run }
template <class T>
void f(T t, int i = 10);
-// Build don't link:
+// { dg-do assemble }
// Origin: Ian Nixon <ian@tharas.com>
struct A {};
-template<class M, class T = A, class C> class Tc {}; // ERROR - no defarg
+template<class M, class T = A, class C> class Tc {}; // { dg-error "" } no defarg
int main ()
{
- Tc<int> oops; // ERROR - using template
+ Tc<int> oops; // { dg-error "" } using template
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
template <class T, class U = int> struct A;
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T = int>
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
void f (int i)
{
- struct S { void g (int j = i) {} }; // ERROR - default argument uses local
+ struct S { void g (int j = i) {} }; // { dg-error "" } default argument uses local
S s;
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Larry Evans <jcampbell3@prodigy.net>
+// { dg-do run }
template <int S=0, class T=int>
struct X
{};
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S;
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S1
-// Build don't link:
+// { dg-do assemble }
template <int dim>
class Point {
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct C {
struct I {}; // OK
template <class W = int>
- void h(W); // ERROR - default argument
+ void h(W); // { dg-error "" } default argument
template <class Y>
void k(Y);
template <class T>
template <class U = double>
-void C<T>::f(U) {} // ERROR - default argument
+void C<T>::f(U) {} // { dg-error "" } default argument
template <class X = void*>
-void g(X); // ERROR - default argument
+void g(X); // { dg-error "" } default argument
template <class T = double>
template <class Y>
-void C<T>::k(Y) {} // ERROR - default argument
+void C<T>::k(Y) {} // { dg-error "" } default argument
-// Build don't link:
+// { dg-do assemble }
template <int Dim, class T, class EngineTag>
class Engine {};
-// Build don't link:
+// { dg-do assemble }
// Default arguments containing more than one non-nested explicit
// template argument leads to parse error
struct bar {
template <class T, class U>
- bar(int i = foo1<T>::baz, // gets bogus error - XFAIL *-*-*
+ bar(int i = foo1<T>::baz, // { dg-bogus "" "" { xfail *-*-* } } -
int j = int(foo2<T, U>::baz), // ok
- int k = foo2<T, U>::baz) {} // gets bogus error - before > - XFAIL *-*-*
+ int k = foo2<T, U>::baz) {} // { dg-bogus "" "" { xfail *-*-* } } - before > -
};
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T = int>
-// Build don't link:
+// { dg-do assemble }
class A
{
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
template <typename T>
void f(T);
-// Build don't link:
-// crash test -
+// { dg-do assemble }
// by Paul Burchard <burchard@pobox.com>, Level Set Systems, Inc.
// Copyright (C) 1999, 2002 Free Software Foundation
template<class T>
class X {
class Y : public T {};
- Y y; // ERROR - invalid base type
+ Y y; // { dg-error "" } invalid base type
};
int main() {
- X<int> x; // ERROR - instantiated
+ X<int> x; // { dg-error "" } instantiated
}
-// Build don't link:
-// Special g++ Options: -ansi
+// { dg-do assemble }
+// { dg-options "" }
// Origin: Theo Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
-// Special g++ Options:
inline const unsigned& f(unsigned const& a) {
return a;
+// { dg-do assemble }
// Bug: g++ forgets to instantiate A<int>
// Contributed by Jason Merrill <jason@cygnus.com>
-// Build don't link:
template <class T> struct A { };
void f () throw (A<int>);
-// Build don't run:
+// { dg-do link }
/*
+// { dg-do run }
template <class X> class TC {
public:
X aaa;
+// { dg-do run }
template <class X> class TC {
public:
X aaa;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed enums
template<class T>
struct templ
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S {
-// Build don't link:
+// { dg-do assemble }
template <class T> void f1()
{
-// Build don't link:
+// { dg-do assemble }
template <int I>
struct S1 { };
-// Build don't link:
+// { dg-do assemble }
// Origin: Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
template <typename T>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 4 Oct 2000 <nathan@codesourcery.com>
// Origin: bug 511 malte.starostik@t-online.de
struct B
{
private:
- enum foo {bar}; // ERROR - private
- typedef int baz; // ERROR - private
+ enum foo {bar}; // { dg-error "" } private
+ typedef int baz; // { dg-error "" } private
};
struct D: public B<int>
{
- void choke (foo); // ERROR - within this context
- void choke (baz); // ERROR - within this context
+ void choke (foo); // { dg-error "" } within this context
+ void choke (baz); // { dg-error "" } within this context
};
-// Build don't link:
+// { dg-do assemble }
struct U {
static int STATIC;
+// { dg-do run }
struct S { enum en { s0, s1, s2 }; };
template<typename S::en e>
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct U
-// Build don't link:
+// { dg-do assemble }
template <>
-enum E {e}; // ERROR - template declaration of enum
+enum E {e}; // { dg-error "" } template declaration of enum
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct vector {};
{
enum tern { H, L, X, U };
- vector<tern> ternvec; // ERROR - composed from a local type
+ vector<tern> ternvec; // { dg-error "" } composed from a local type
}
template void fn(int);
+// { dg-do run }
template <int I>
int f()
{
-// Build don't link:
+// { dg-do assemble }
template <int I>
void f();
-// Build don't link:
+// { dg-do assemble }
template <typename _CharT>
class _Format_cache
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
template <class U>
void S<T>::f ()
{
- U& u; // ERROR - uninitialized reference
+ U& u; // { dg-error "" } uninitialized reference
}
template void S<int>::f<double>();
-// Build don't link:
+// { dg-do assemble }
// Origin: Carl Nygard <cnygard@bellatlantic.net>
template <class RT>
-class Test { // ERROR - in instantiation
+class Test { // { dg-error "" } in instantiation
public:
- Test(const RT& c = RT()) {} // ERROR - reference to void
+ Test(const RT& c = RT()) {} // { dg-error "" } reference to void
};
void f ()
{
- Test<void> c; // ERROR - instantiated from here
+ Test<void> c; // { dg-error "" } instantiated from here
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 10 Jan 2001 <nathan@codesourcery.com>
void foo (B *ptr)
{
- ptr->Tpl.t (); // ERROR - template as expression
+ ptr->Tpl.t (); // { dg-error "" } template as expression
}
+// { dg-do run }
// Bug: g++ generates an error trying to generate the first foo<int>, when
// it should silently fail and go on to the next one.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
void foo(T t) {}
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-ansi -pedantic-errors -w" }
// GROUPS passed templates
-// Special g++ Options: -ansi -pedantic-errors -w
template <class T>
void foo(T t);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
void foo(T t);
-// Build don't run:
-// Special g++ Options: -ansi -pedantic-errors -w
+// { dg-do link }
+// { dg-options "-ansi -pedantic-errors -w" }
// GROUPS passed templates
template <class U>
struct S
-// Build don't run:
+// { dg-do link }
+// { dg-options "-ansi -pedantic-errors -w" }
// GROUPS passed templates
-// Special g++ Options: -ansi -pedantic-errors -w
template <class U>
struct S
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
struct S
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template<int N_rank>
class Array;
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template<int N_rank>
class Array;
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-ansi -pedantic-errors -w" }
// GROUPS passed templates
-// Special g++ Options: -ansi -pedantic-errors -w
template <class T, class U>
void foo(U u, T t);
-// Build don't run:
+// { dg-do link }
+// { dg-options "-ansi -pedantic-errors -w" }
// GROUPS passed templates
-// Special g++ Options: -ansi -pedantic-errors -w
template <class T>
int foo(T t) { return 0; }
-// Build don't run:
+// { dg-do link }
+// { dg-options "-ansi -pedantic-errors -w" }
// GROUPS passed templates
-// Special g++ Options: -ansi -pedantic-errors -w
template <class T>
int foo(T t);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
void foo(T t) {}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
T foo(T t);
template <>
-int foo<char>(char c); // ERROR - does not match any template declaration
+int foo<char>(char c); // { dg-error "" } does not match any template declaration
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
T foo(T* t);
template <>
-int foo<char>(char c); // ERROR - does not match declaration.
+int foo<char>(char c); // { dg-error "" } does not match declaration.
template <>
-int bar<char>(); // ERROR - no template bar.
+int bar<char>(); // { dg-error "" } no template bar.
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T, class U>
T foo(T t, U* u);
-// Build don't run:
+// { dg-do link }
+// { dg-options "-ansi -pedantic-errors -w" }
// GROUPS passed templates
-// Special g++ Options: -ansi -pedantic-errors -w
template <class T>
int foo(T t) { return 1; }
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
int foo(T t);
-int foo<int>(int i) { return 0; } // ERROR - missing template <>
+int foo<int>(int i) { return 0; } // { dg-error "" } missing template <>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <int I>
class S {};
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates
template <class T>
int foo(T t) { return 1; }
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates
template <class T>
void foo(T t);
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates
template <class T>
int foo(T t) { return 1; }
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates
template <class T>
int foo(T) { return 0; }
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T, class U>
void foo(T t, U u) {}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
void foo(T, T*);
-// Build don't run:
+// { dg-do link }
+// { dg-options "-ansi -pedantic-errors -w" }
// GROUPS passed templates
-// Special g++ Options: -ansi -pedantic-errors -w
template <class T>
struct S
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
struct S
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
void foo(T t);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
void foo(T t);
template <>
-void foo(int) {}; // ERROR - previously defined here.
+void foo(int) {}; // { dg-error "" } previously defined here.
template <>
-void foo<int>(int) {} // ERROR - duplicate specialization.
+void foo<int>(int) {} // { dg-error "" } duplicate specialization.
-// Build don't run:
+// { dg-do link }
+// { dg-options "-ansi -pedantic-errors -w" }
// GROUPS passed templates
-// Special g++ Options: -ansi -pedantic-errors -w
struct S
{
template <class T>
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates
template <class T>
void foo(T);
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates
class ostream {};
+// { dg-do assemble }
template <int I>
void f(int j);
void g()
{
- f<7, 12>(3); // ERROR - no matching function.
+ f<7, 12>(3); // { dg-error "" } no matching function.
}
+// { dg-do assemble }
template <class T>
void f(int i);
void g()
{
- f<7>(3); // ERROR - no matching function.
+ f<7>(3); // { dg-error "" } no matching function.
}
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
void foo(T t);
+// { dg-do run }
extern "C" void abort();
template <void* P>
+// { dg-do assemble }
template <int I>
void f(int i);
void g()
{
int i;
- f<i>(7); // ERROR - template argument 1 is invalid.
+ f<i>(7); // { dg-error "" } template argument 1 is invalid.
}
+// { dg-do run }
extern "C" void abort(void);
template <int I>
+// { dg-do run }
extern "C" void abort(void);
void F(int)
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T>
void foo(T t) {}
+// { dg-do run }
extern "C" void abort ();
template <class T> int f ()
+// { dg-do run }
extern "C" void abort ();
template <int a> int fact ()
+// { dg-do run }
extern "C" void abort ();
template <int a> inline int fact ()
+// { dg-do run }
extern "C" void abort ();
template <int a> inline int fact ();
+// { dg-do run }
extern "C" void abort ();
template <int a> inline int fact2 ();
+// { dg-do run }
template <class T> T* create ()
{
return new T;
+// { dg-do run }
template <class T> T* create ();
template <class T> T* create2()
+// { dg-do run }
extern "C" void abort ();
int a = 0;
+// { dg-do run }
extern "C" void abort ();
template <class T> void f ();
+// { dg-do run }
extern "C" void abort ();
template <class T> void f ();
-// Build don't run:
+// { dg-do link }
+// { dg-options "-ansi -pedantic-errors -w" }
// GROUPS passed templates
-// Special g++ Options: -ansi -pedantic-errors -w
template <class T>
int foo(T t);
+// { dg-do run }
extern "C" void abort ();
template <class T> void f ();
+// { dg-do run }
extern "C" void abort ();
template <class T> void f ();
+// { dg-do run }
extern "C" void abort ();
template <class T> void f ()
+// { dg-do run }
extern "C" void abort ();
template <class T> void f ()
+// { dg-do run }
extern "C" void abort ();
template <class T> void f ()
+// { dg-do run }
extern "C" void abort ();
template <class T> void f ()
+// { dg-do run }
void f(int) {}
void f(double);
+// { dg-do assemble }
struct S
{
void f(int);
void bar()
{
- foo<S::f>(); // ERROR - no matching function
- foo<g>(); // ERROR - no matching function
+ foo<S::f>(); // { dg-error "" } no matching function
+ foo<g>(); // { dg-error "" } no matching function
}
-// Build don't link:
+// { dg-do assemble }
template <bool B>
struct S
-//Build don't link:
-template class x {}; // ERROR - not a template instantiation
+// { dg-do assemble }
+template class x {}; // { dg-error "" } not a template instantiation
-// Build don't link:
+// { dg-do assemble }
template <class T>
void f(T) {}
T S<T>::t;
template void f(int);
-template void f(int); // ERROR - duplicate explicit instantiation
+template void f(int); // { dg-error "" } duplicate explicit instantiation
template int S<int>::t;
-template int S<int>::t; // ERROR - duplicate explicit instantiation
+template int S<int>::t; // { dg-error "" } duplicate explicit instantiation
template class S<double>;
-template class S<double>; // ERROR - duplicate explicit instantiation
+template class S<double>; // { dg-error "" } duplicate explicit instantiation
-extern template void f(double); // WARNING - extern not allowed
-inline template class S<float>; // WARNING - inline not allowed
+extern template void f(double); // { dg-warning "" } extern not allowed
+inline template class S<float>; // { dg-warning "" } inline not allowed
template <class T>
struct S<T*> {};
template <class T>
void g(T);
-template void g(int); // ERROR - no definition of g.
+template void g(int); // { dg-error "" } no definition of g.
-// Build don't link:
+// { dg-do assemble }
// by Alexandre Oliva <oliva@dcc.unicamp.br>
// Based on a testcase by Reid M. Pinchback <reidmp@MIT.EDU>
// According to the C++ Standard [temp.expl.spec]/17-18, explicit
class a {};
};
template <class X>
-template <> // ERROR - invalid specialization
+template <> // { dg-error "" } invalid specialization
class bug<X>::a<char> {};
-// Build don't link:
+// { dg-do assemble }
// Contributed by Reid M. Pinchback <reidmp@MIT.EDU>
// Adapted by Alexandre Oliva <oliva@dcc.unicamp.br>
// plain char, signed char and unsigned char are distinct types
-// Build don't link:
+// { dg-do assemble }
// by Alexandre Oliva <oliva@dcc.unicamp.br>
// the template
namespace N {
- template <class T> class foo; // ERROR - referenced below
+ template <class T> class foo; // { dg-error "" } referenced below
}
using namespace N;
-template <> class foo<void>; // ERROR - invalid specialization
+template <> class foo<void>; // { dg-error "" } invalid specialization
+// { dg-do run }
// Reduced from a testcase by Yotam Medini <yotam@avanticorp.com>
// egcs 1.1 seems to generate code that deletes a NULL pointer.
+// { dg-do assemble }
// Test for not complaining about mismatches during unification.
-// Build don't link:
template <void (*F)(int)> void f();
template <void (*F)(double)> void f();
-// Build don't link:
+// { dg-do assemble { xfail *-*-* } }
// Based on bug report by Simon A. Crase <s.crase@ieee.org>
-// crash test - XFAIL *-*-*
struct foo {
template <class T> void bar();
};
-template void foo::bar<void>(); // gets bogus error - ICE - XFAIL *-*-*
+template void foo::bar<void>(); // { dg-bogus "" "" { xfail *-*-* } } - ICE -
-// Build don't link:
+// { dg-do assemble }
template <int I, int J, int K>
struct S {};
S<0, 1, 2> s2;
f<0>(s0, s2);
- f(s0, s2); // ERROR - no matching function
+ f(s0, s2); // { dg-error "" } no matching function
}
-// Build don't link:
+// { dg-do assemble }
template <int I>
struct A {
-// Build don't link:
+// { dg-do assemble }
template <int I>
void f(int (*)[I] = 0);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
template <class T, class U>
void foo(T t, U u);
+// { dg-do assemble }
// Bug: We were complaining about explicit instantiation of A<T>::B.
-// Build don't link:
template <class T>
struct A
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 10 Aug 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 7 Sep 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 7 Sep 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates
void foo(int);
void bar()
{
- foo<int>(3); // ERROR - foo is not a template.
+ foo<int>(3); // { dg-error "" } foo is not a template.
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 17 Nov 2000 <nathan@codesourcery.com>
// bug 721, we died horribly when export was used wrongly
struct test {
-int export(void); // ERROR - parse error
+int export(void); // { dg-error "" } parse error
};
-int test::export(void) // ERROR - parse error
+int test::export(void) // { dg-error "" } parse error
{
return 0;
}
template <class T> class Y;
-export template <class T> class X; // WARNING - export not implemented
+export template <class T> class X; // { dg-warning "" } export not implemented
+// { dg-do run }
template <int n> class vec {
double x[n];
-// Build don't link:
+// { dg-do assemble }
template <int I>
struct S {};
void bar()
{
- foo(S<3>()); // ERROR - no way to deduce J from this.
+ foo(S<3>()); // { dg-error "" } no way to deduce J from this.
}
-// Build don't link:
+// { dg-do assemble }
template <int I>
struct S {};
-// Build don't link:
+// { dg-do assemble }
template <class T, int i>
struct S1;
-// Build don't link:
+// { dg-do assemble }
// Based on a bug report by tveldhui <tveldhui@extreme.indiana.edu>
-// Build don't link:
+// { dg-do assemble }
template<int I> struct A { };
template<int I, int J> int f(A<I+J>);
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 23 June 2000 <nathan@codesourcery.com>
{
C<1> c1;
C<1 & 2> c2;
-C<1>2> c3; // ERROR - parse error
+C<1>2> c3; // { dg-error "" } parse error
C<(1>2)> c4;
-C<1 & 2>2> c5; // ERROR - parse error
+C<1 & 2>2> c5; // { dg-error "" } parse error
C<1 & (2>2)> c6;
}
-template <int i = 3>4 > class X1 {}; // ERROR - parse error
-template <int i = 3&&4>0 > class X2 {}; // ERROR - parse error
+template <int i = 3>4 > class X1 {}; // { dg-error "" } parse error
+template <int i = 3&&4>0 > class X2 {}; // { dg-error "" } parse error
template <int i = 3&&4 > class X3 {};
template <int i = (3>4) > class X4 {};
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
+// { dg-do run }
// Bug: g++ silently ignores function-try-blocks in templates.
// Submitted by Jason Merrill <jason@cygnus.com>
+// { dg-do run }
template <class T>
void f(T);
+// { dg-do run }
template <class T>
void f(T);
+// { dg-do assemble }
template <class T>
class C;
void f(U u)
{
C<U> cu;
- cu.i = 3; // ERROR - S<double>::f<U> is a friend, but this is
+ cu.i = 3; // { dg-error "" } S<double>::f<U> is a friend, but this is
// S<int>::f<double>.
}
};
template <class U>
friend void S<T>::f(U);
- int i; // ERROR - private
+ int i; // { dg-error "" } private
};
+// { dg-do run }
template <class T>
class C;
+// { dg-do run }
template <class T>
class C;
-// Build don't link:
+// { dg-do assemble }
template <class U>
class S1
-// Build don't link:
+// { dg-do assemble }
class S1
{
-// Build don't link:
+// { dg-do assemble }
template <class T>
class S2
-// Build don't link:
+// { dg-do assemble }
template <class T>
class S2
-// Build don't link:
+// { dg-do assemble }
template <class U>
class S1
-// Build don't link:
+// { dg-do assemble }
template <class T = int> struct A;
-// Build don't link:
+// { dg-do assemble }
template <class T> struct A {
static void f();
template <class T> class B
{
friend class A<T>;
- static int i; // ERROR - private
+ static int i; // { dg-error "" } private
};
template <class T> class C
B<T>::i = 3;
C<T>::i = 3;
C<double>::i = 3;
- B<double>::i = 3; // ERROR - member `i' is private
+ B<double>::i = 3; // { dg-error "" } member `i' is private
}
template void A<int>::f();
-// Build don't link:
+// { dg-do assemble }
template <class T = int>
struct S
-// Build don't link:
+// { dg-do assemble }
-template <class T = int> // ERROR - original definition
+template <class T = int> // { dg-error "" } original definition
struct S
-{ // ERROR - redefinition of default arg
+{ // { dg-error "" } redefinition of default arg
template <class U = int>
friend class S;
};
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S
-// Build don't link:
+// { dg-do assemble }
template <class T> struct A;
struct B
{
template <class U>
- friend class A<U>; // ERROR - does not specialize any args
+ friend class A<U>; // { dg-error "" } does not specialize any args
};
struct C
{
template <class U>
- friend class A<U*>; // ERROR - partial specialization
+ friend class A<U*>; // { dg-error "" } partial specialization
};
-// Build don't link:
+// { dg-do assemble }
struct S
{
- friend void f<>(int); // ERROR - does not match any template
+ friend void f<>(int); // { dg-error "" } does not match any template
};
-// Build don't link:
+// { dg-do assemble }
class S
{
- friend void f<>(int); // ERROR - does not match any template
+ friend void f<>(int); // { dg-error "" } does not match any template
int i;
};
-// Build don't link:
+// { dg-do assemble }
class mystream;
-// Build don't link:
+// { dg-do assemble }
template <class T> class a;
-// Build don't link:
+// { dg-do assemble }
template <class T>
void f(T);
{
friend void f<>(double);
- int i; // ERROR - private
+ int i; // { dg-error "" } private
};
void f(T)
{
C c;
- c.i = 3; // ERROR - f<double> is a friend, this is f<int>.
+ c.i = 3; // { dg-error "" } f<double> is a friend, this is f<int>.
}
-// Build don't link:
+// { dg-do assemble }
template <class T, class U>
struct S {
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S1 {
-// Build don't link:
+// { dg-do assemble }
template <class T, class U>
struct S {
-// Build don't run:
-// Special g++ Options: -g
+// { dg-do link }
+// { dg-options "-g" }
template <class P1>
struct S1
-// Build don't link:
-// excess errors test
+// { dg-do assemble }
// This testcase won't fail if class ::foo is forward-declared in the
// global namespace, nor if class bar is not a template class.
-// Build don't link:
+// { dg-do assemble }
class foo {
- friend void bar<int>(int); // ERROR - must be declared first
+ friend void bar<int>(int); // { dg-error "" } must be declared first
};
template <typename T> void bar(T);
-// Build don't link:
+// { dg-do assemble }
template <class T>
-void f(T) {} // ERROR - previously defined here
+void f(T) {} // { dg-error "" } previously defined here
template <class U>
struct S {
template <class T>
- friend void f(T) {} // ERROR - redeclaration
+ friend void f(T) {} // { dg-error "" } redeclaration
};
S<int> si;
-// Build don't link:
+// { dg-do assemble }
// Simplified from report by Volker Dobler <volker@hugo.physik.uni-konstanz.de>
template <class T> class A {
- friend int ice<>( int k=0 ); // ERROR - default argument
- friend inline int f<>(double); // ERROR - inline
+ friend int ice<>( int k=0 ); // { dg-error "" } default argument
+ friend inline int f<>(double); // { dg-error "" } inline
};
-// Build don't link:
+// { dg-do assemble }
// Overly simplified from testcase by "B. K. Oxley" <binkley@bigfoot.com>
template<class P, class Q> struct foo {
typedef P parent_type;
- friend parent_type; // ERROR - template parameters cannot be friends
- friend Q; // ERROR - template parameters cannot be friends
+ friend parent_type; // { dg-error "" } template parameters cannot be friends
+ friend Q; // { dg-error "" } template parameters cannot be friends
};
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S;
+// { dg-do run }
class C
{
template <class T>
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-Wno-non-template-friend" }
// Origin: Jason Merrill <jason@cygnus.com>
-// Special g++ Options: -Wno-non-template-friend
template<class T> struct A
{
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
// Origin: Matt Austern <austern@isolde.engr.sgi.com>
class A {
+// { dg-do run }
// Test that template friends referring to class template members are
// respected.
-// excess errors test - XFAIL *-*-*
template <class T> struct A
{
{
template <class T> friend int A<T>::f (T);
template <class T> friend struct A<T>::AI;
- int a;
+ int a; // { dg-bogus "" "" { xfail *-*-* } }
public:
B(): a(0) { }
};
template <class T> int A<T>::f (T)
{
B b;
- return b.a;
+ return b.a; // { dg-bogus "" "" { xfail *-*-* } }
}
template <class T> int A<T>::AI::f (T)
{
B b;
- return b.a;
+ return b.a; // { dg-bogus "" "" { xfail *-*-* } }
}
int main ()
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Aug 2000 <nathan@codesourcery.com>
template<typename T> struct X
{
- template<typename D> friend X<D>; // ERROR - friend must use aggr tag
+ template<typename D> friend X<D>; // { dg-error "" } friend must use aggr tag
};
X<int> g;
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 17 Nov 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 7 Jan 2001 <nathan@codesourcery.com>
class A {};
class B {
- template<class T> friend class A; // ERROR - not a template
+ template<class T> friend class A; // { dg-error "" } not a template
};
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 5 Jun 2001 <nathan@codesourcery.com>
+// { dg-do run }
class C
{
template <class T>
+// { dg-do run }
template <class T>
void f(T);
+// { dg-do run }
template <class T>
void f(T);
+// { dg-do run }
template <class T>
class C
{
+// { dg-do run }
template <class U>
class C
{
-// Build don't link:
+// { dg-do assemble }
template<class T>
void compute(T) {
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
int i = 1;
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 28 Nov 2000 <nathan@codesourcery.com>
// Inspired by by 756. We'd ICE when trying to define a member of an
// incomplete template type.
-template<class X> struct ObjCount; // ERROR - forward decl
+template<class X> struct ObjCount; // { dg-error "" } forward decl
-template<class X> int ObjCount<X>::m; // ERROR - undefined type
+template<class X> int ObjCount<X>::m; // { dg-error "" } undefined type
+// { dg-do assemble }
+// { dg-options "-ftemplate-depth-10" }
// Test for catching infinitely recursive instantiations.
// Origin: Jason Merrill <jason@redhat.com>
-// Special g++ Options: -ftemplate-depth-10
template <int i> void f()
{
- f<i+1>(); // ERROR - excessive recursion
+ f<i+1>(); // { dg-error "" } excessive recursion
}
// We should never need this specialization because we should issue an
+// { dg-do run }
// Origin: Wolfgang Bangerth <wolf@gaia.iwr.uni-heidelberg.de>
int i = 1;
-// Build don't link:
+// { dg-do assemble }
// Make sure we make the right unqualified class a friend
// See PR c++/4403
static T value_AC;
};
template <typename T> T B<T>::valueA_AA;
-template <typename T> T B<T>::valueA_AC;// ERROR - private - XFAIL *-*-*
-template <typename T> T B<T>::value_AC; // gets bogus error - XFAIL *-*-*
+template <typename T> T B<T>::valueA_AC;// { dg-error "" "" { xfail *-*-* } } private -
+template <typename T> T B<T>::value_AC; // { dg-bogus "" "" { xfail *-*-* } } -
// this one is a friend
template <class T> struct A<T>::AA
{
T M ()
{
- return B<T>::valueA_AC; // ERROR - within this context - XFAIL *-*-*
+ return B<T>::valueA_AC; // { dg-error "" "" { xfail *-*-* } } within this context -
}
};
{
int M ()
{
- return B<int>::value_AC; // gets bogus error - XFAIL *-*-*
+ return B<int>::value_AC; // { dg-bogus "" "" { xfail *-*-* } } -
}
};
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <int I>
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-Wno-non-template-friend" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options: -Wno-non-template-friend
template<int I>
class C {
-// Build don't link:
-// Special g++ Options: -O2 -Winline
+// { dg-do assemble }
+// { dg-options "-O2 -Winline" }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
-// Special g++ Options: -O
+// { dg-do assemble }
+// { dg-options "-O" }
// Origin: Mark Mitchell <mitchell@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
template <class T>
void f(T t) {}
-// Build don't link:
+// { dg-do assemble }
// Origin: Neil Booth, from bug report #44
#include <iterator>
-// Build don't link:
+// { dg-do assemble }
// Origin: Neil Booth, from bug report #36
template <typename t> class vect;
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Nov 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 11 Jan 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
template<class T>
struct X_two {
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S
+// { dg-do link }
+// { dg-options "-frepo -Werror" }
// Build then link:
-// Special g++ Options: -frepo -Werror
// Submitted by Melissa O'Neill <oneill@cs.sfu.ca>
// the vtable of Foo<int> wouldn't be generated
-// Build don't run:
-
-// Additional sources: instantiate5.cc instantiate5-main.cc
+// { dg-do link }
+// { dg-gpp-additional-sources " instantiate5.cc instantiate5-main.cc" }
// `global constructors' are given the same name, based on foo(), on
// both translation units, which is wrong, because it must be possible
+// { dg-do link }
+// { dg-options "-frepo" }
// Build then link:
-// Special g++ Options: -frepo
// Simplified from testcase by Erez Louidor Lior <s3824888@techst02.technion.ac.il>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation
// Contributed by Nathan Sidwell 6 July 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Nov 2000 <nathan@codesourcery.com>
void g ()
{
const Y y;
- Z z; // ERROR - incomplete
+ Z z; // { dg-error "" } incomplete
}
template <int dim>
void h ()
{
const X<2> z;
- Z z1; // ERROR - incomplete
+ Z z1; // { dg-error "" } incomplete
}
template <int dim>
{
const X<dim> x;
const X<dim+1> y[3];
- Z z2; // ERROR - incomplete
+ Z z2; // { dg-error "" } incomplete
typedef Z z3; // ok
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 22 Nov 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 18 Aug 2000 <nathan@codesourcery.com>
template <int s>
static void g();
template <int s>
-void f(); // ERROR - candiate
+void f(); // { dg-error "" } candiate
static void f_plus ()
{
- foo (f<0>); // ERROR - no match
+ foo (f<0>); // { dg-error "" } no match
foo (g<0>);
}
};
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S {};
-// Build don't run:
+// { dg-do link }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
+// { dg-do run }
template <class STRUCT, class MEMBER> inline STRUCT *
setback(MEMBER *bp, MEMBER STRUCT::*offset)
{
+// { dg-do run }
extern "C" void abort();
template <class T>
+// { dg-do run }
extern "C" void abort();
template <class T>
+// { dg-do run }
extern "C" void abort();
template <class T>
+// { dg-do run }
template <class INT>
class b
{
+// { dg-do run }
extern "C" void abort();
template <class T>
-// Build don't link:
+// { dg-do assemble }
template <class STRUCT, class MEMBER> inline STRUCT *
setback(MEMBER *bp, MEMBER STRUCT::*offset)
-// Build don't link:
+// { dg-do assemble }
template <class T, class Allocator>
struct __vector_alloc_base
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation
// Contributed by Nathan Sidwell 3 July 2000 <nathan@codesourcery.com>
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
class A
{
+// { dg-do run }
template<class T>
class A {
public:
-// Build don't link:
+// { dg-do assemble }
void h(int);
-// Build don't link:
+// { dg-do assemble }
struct B {
int i;
-// Build don't link:
+// { dg-do assemble }
// Based on bug report by Miniussi <miniussi@ilog.fr>
// according to [temp.dep.type], `t' and `u' cannot be dependent types,
// and so there's no reason to delay lookup to specialization time.
void f(t p); // this is ::t [temp.dep]/3
- void f(typename A<T>::t p); // gets bogus error - redefinition
- void g(u p); // ERROR - unknown type name
+ void f(typename A<T>::t p); // { dg-bogus "" } redefinition
+ void g(u p); // { dg-error "" } unknown type name
};
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
struct A { typedef int B; };
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
void Y::f()
{
- X x; // ERROR - X is not a type.
+ X x; // { dg-error "" } X is not a type.
}
-// Build don't link:
+// { dg-do assemble }
// Origin: "Artem Hodyush" <artem@duma.gov.ru>
struct B { int m; };
-// Build don't link:
+// { dg-do assemble }
int f1 () {
struct A {
-// Build don't link:
+// { dg-do assemble }
struct A { A() { a = 2; } int a; };
-// Build don't link:
+// { dg-do assemble }
struct A { A() { a = 2; } int a; };
-// Build don't link:
+// { dg-do assemble }
struct A1 { struct B { B(); } b; };
struct A2 { struct B { ~B(); } b; };
-// Build don't link:
+// { dg-do assemble }
struct B { struct A { A(); int a; } aa; };
struct A { A(); int a; };
-// Build don't link:
+// { dg-do assemble }
struct B { struct A { A(); int a; } aa; };
B::A::A () { a = 37; }
-// Build don't link:
+// { dg-do assemble }
struct B { struct A { A(); int a; }; A aa; };
B::A::A () { a = 37; }
-// Build don't link:
+// { dg-do assemble }
class A {
int a;
-// Build don't link:
+// { dg-do assemble }
struct A { A() { a = 1; } int a; };
struct Q {
-// Build don't link:
+// { dg-do assemble }
-struct A { A() { a = 1; } int a; }; // ERROR -
-struct A { A() { a = 2; } int a; }; // ERROR -
+struct A { A() { a = 1; } int a; }; // { dg-error "" }
+struct A { A() { a = 2; } int a; }; // { dg-error "" }
A aavv;
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
typedef enum {} i;
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 25 April 2001 <nathan@codesourcery.com>
+// { dg-do run }
template <class T> struct A {
template <class U> struct B {
template <class V> void f (V) { }
-// Build don't link:
+// { dg-do assemble }
struct S1
{
template <class T>
- struct S2 {}; // ERROR - previous definition
+ struct S2 {}; // { dg-error "" } previous definition
template <class T>
- struct S2 {}; // ERROR - redefinition
+ struct S2 {}; // { dg-error "" } redefinition
};
-// Build don't link:
+// { dg-do assemble }
struct S1
{
-// Build don't link:
+// { dg-do assemble }
struct outer {
template <class T> struct inner;
-// Build don't link:
+// { dg-do assemble }
template <class X, class Y>
struct Inner;
-// Build don't link:
+// { dg-do assemble }
template <class X, class Y>
struct Inner;
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S1
-// Build don't link:
+// { dg-do assemble }
template <class Q>
class A {
-// Build don't link:
+// { dg-do assemble }
template <class T> struct S
{
-// Build don't link:
+// { dg-do assemble }
template <class T> struct A {
template <class U> struct B;
-// Build don't link:
+// { dg-do assemble }
template <class T> struct A {
template <class U> struct B;
+// { dg-do run }
template <class T> struct A {
template <class U> struct B {
template <class V> void f (V) { }
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class X, class Y>
-// Build don't link:
+// { dg-do assemble }
// Origin: <Corey Kosak> kosak@cs.cmu.edu
struct moo {
+// { dg-do run }
template <class T> struct A {
template <class U> struct B {
template <class V> struct C {
+// { dg-do run }
#include <typeinfo>
template <class T>
+// { dg-do run }
template <class T> struct A {
template <class U> struct B {
template <class V> static void f () { }
+// { dg-do run }
// Compiler: egcs-2.91.12 980302
// Error: compiler error in ctor of 'foo::bar<T>::bar(T const &)'
-// Special g++ Options: -ansi -pedantic-errors -w
+// { dg-do run }
+// { dg-options "-ansi -pedantic-errors -w" }
struct S
{
template <class U>
-// Build don't link:
+// { dg-do assemble }
template <class T>
class S
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S1
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
struct S {
template <class T>
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// Origin: philippeb@videotron.ca
-// Special g++ Options:
#include <iostream>
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template <class T>
struct S
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template <class T>
struct S
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf (const char *, ...);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template <class T>
struct S
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
struct S
{
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
struct S {
template <class T>
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
+// { dg-do run }
extern "C" void abort();
int k;
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
template <class T>
struct S
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template <class T>
struct S
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template <class X>
struct R
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template <class T>
struct S
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template <class T>
struct S
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
struct S {
template <class T>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template <class T>
struct R
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template <int i>
struct S
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
template<class T, int N>
class Foo {
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
template<class T, int N>
class A
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
template<class T>
class A
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
template<class T>
class A
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
template<class T, class U>
class A
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
struct S
{
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template <class X>
struct S
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template<class T, int N>
class A { };
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
template<int N>
struct I {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template<class X> class _bz_update { };
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template<class P_numtype, int N_length>
class TinyVector {};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template<int N, class T>
struct B {
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
template <int N>
struct IndexPlaceholder {};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
struct S {
template <class T, class U>
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed membertemplates
template <class T>
struct S
-// Build don't run:
+// { dg-do link }
// GROUPS passed membertemplates
struct S
{
-// Build don't run:
+// { dg-do link }
// GROUPS passed membertemplates
struct S
{
+// { dg-do run }
template <class T> struct A {
template <class U> void f (U u);
};
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S1 {};
struct S2
{
template <class T>
- void f<S1<T> >(T) {} // ERROR - bad specialization.
+ void f<S1<T> >(T) {} // { dg-error "" } bad specialization.
};
-// Build don't link:
+// { dg-do assemble }
template<unsigned int n> struct PartialDotProduct {
template<class T>
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S
+// { dg-do run }
template <class T>
struct A
{
-// Build don't link:
+// { dg-do assemble }
struct locale
{
+// { dg-do run }
struct S
{
template <class T>
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't link:
+// { dg-do assemble }
template <class T>
class X {
-// Build don't link:
+// { dg-do assemble }
class A
{
- template<class T>T epsilon; // ERROR - invalid member template
+ template<class T>T epsilon; // { dg-error "" } invalid member template
};
-// Build don't link:
+// { dg-do assemble }
template<class P> struct B
{
+// { dg-do run }
template <class T> struct A {
template <class U> void f(U);
};
-// Build don't link:
+// { dg-do assemble }
template <class T>
class S
{
protected:
template <class U>
- void f(U); // ERROR - is protected
+ void f(U); // { dg-error "" } is protected
private:
template <class U>
- void g(U); // ERROR - is private
+ void g(U); // { dg-error "" } is private
};
void f()
{
S<double> s;
- s.f(3); // ERROR - within this context
- s.g(2.0); // ERROR - within this context
+ s.f(3); // { dg-error "" } within this context
+ s.g(2.0); // { dg-error "" } within this context
}
-// Build don't link:
+// { dg-do assemble }
void
print(const int& i)
-// Build don't link:
+// { dg-do assemble }
class base
{
+// { dg-do run }
extern "C" int strcmp(const char*, const char*);
template <class T>
-// Build don't link:
+// { dg-do assemble }
struct A
{
void f() {}
template <class U>
- void f() {} // ERROR - redeclaration
+ void f() {} // { dg-error "" } redeclaration
};
struct D2
{
void f(T);
- void f(U); // ERROR - redeclaration
+ void f(U); // { dg-error "" } redeclaration
};
template struct D2<int, int>;
struct E
{
void f();
- void f(); // ERROR - redeclaration
+ void f(); // { dg-error "" } redeclaration
};
-// Build don't link:
+// { dg-do assemble }
struct foo {
template<typename T> static void bar( foo* );
- template<typename T> void bar() const; // gets bogus error - quals
+ template<typename T> void bar() const; // { dg-bogus "" } quals
};
-// Build don't link:
+// { dg-do assemble }
// GROUPS passed templates membertemplates
struct S {
template <class T>
-// Build don't link:
+// { dg-do assemble }
template<typename T> T baz() { return 0; }
-// Build don't link:
+// { dg-do assemble }
template <int i> class a
{
-// Build don't link:
-// excess errors test
+// { dg-do assemble }
struct foo {
template<typename T> T bar() { return staticbar<T>( this ); }
-// Build don't link:
+// { dg-do assemble }
// Origin: Corey Kosak <kosak@cs.cmu.edu>
struct cow_t {
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation
} b;
template <class T> void foo() {
- b.bar<T>(); // gets bogus error - bar undeclared
- b.template bar<T>(); // gets bogus error - ditto
+ b.bar<T>(); // { dg-bogus "" } bar undeclared
+ b.template bar<T>(); // { dg-bogus "" } ditto
b.B::bar<T>();
}
-template void foo<void>(); // gets bogus error
+template void foo<void>(); // { dg-bogus "" }
-// Build don't link:
-// crash test - XFAIL *-*-*
+// { dg-do assemble { xfail *-*-* } }
// by Paul Burchard <burchard@pobox.com>, Level Set Systems, Inc.
// Copyright (C) 1999 Free Software Foundation
-// Build don't link:
-// crash test - XFAIL *-*-*
+// { dg-do assemble { xfail *-*-* } }
// by Paul Burchard <burchard@pobox.com>, Level Set Systems, Inc.
// Copyright (C) 1999 Free Software Foundation
template<template<class> class>
class Y {
};
-Y<typename Q::X> y; // ERROR - typename out of template context
+Y<typename Q::X> y; // { dg-error "" } typename out of template context
-// Build don't link:
-// crash test - XFAIL *-*-*
+// { dg-do assemble { xfail *-*-* } }
// by Paul Burchard <burchard@pobox.com>, Level Set Systems, Inc.
// Copyright (C) 1999, 2002 Free Software Foundation
template<template<class> class>
class Y {
};
-Q::template X<int> x; // ERROR - template syntax
+Q::template X<int> x; // { dg-error "" } template syntax
-// Build don't link:
-// crash test - XFAIL *-*-*
+// { dg-do assemble { xfail *-*-* } }
// by Paul Burchard <burchard@pobox.com>, Level Set Systems, Inc.
// Copyright (C) 1999 Free Software Foundation
template<class>
class X {
};
- template<template<class> class XX = X> // gets bogus error - (original definition appeared here)
+ template<template<class> class XX = X> // { dg-bogus "" } (original definition appeared here)
class Y {
- }; // gets bogus error - redefinition of default argument for `template <class> XX'
+ }; // { dg-bogus "" } redefinition of default argument for `template <class> XX'
Y<> y;
};
-// Build don't link:
+// { dg-do assemble }
// by Paul Burchard <burchard@pobox.com>, Level Set Systems, Inc.
// Copyright (C) 1999, 2000 Free Software Foundation
class Q {
template<class T>
- class X { // ERROR - Q::X private
+ class X { // { dg-error "" } Q::X private
};
};
template<template<class> class XX>
class Y {
XX<int> x_;
};
-Y<Q::X> y; // ERROR - instantiated from here
+Y<Q::X> y; // { dg-error "" } instantiated from here
-// Build don't run:
+// { dg-do link }
// GROUPS passed templates membertemplates
extern "C" int printf(const char*, ...);
-// Build don't link:
+// { dg-do assemble }
// regression test -
// by Paul Burchard <burchard@pobox.com>, Level Set Systems, Inc.
};
template<class T>
struct C {
- B<T> b; // gets bogus error - B is not a template
+ B<T> b; // { dg-bogus "" } B is not a template
// but removing wrapper A gets rid of complaint
// also, replacing B<T> with A::B<T> also gets rid of complaint
};
-// Build don't link:
-// crash test - XFAIL *-*-*
+// { dg-do assemble { xfail *-*-* } }
// regression test -
// simplified from bug report by Leon Bottou <leonb@research.att.com>
-// Build don't link:
+// { dg-do assemble }
// Origin: "Adam J. Richter" <adam@yggdrasil.com>
template <class Style, class Base>
-// Build don't run:
+// { dg-do link }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <int n> struct A {
-// Build don't link:
+// { dg-do assemble }
// Origin: Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
struct H {
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mitchell@codesourcery.com>
template <class T, class V>
+// { dg-do run }
// Test for partial specialization of a member function template.
// Origin: Jason Merrill <jason@cygnus.com>
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T> struct A {
-// Build don't link:
+// { dg-do assemble }
//Purpose:
// Test nested template as template template arg.
//Result:
-// Build don't link:
+// { dg-do assemble }
// Origin: bitti@cs.tut.fi
template<typename T, unsigned int N>
{
public:
template<unsigned int I>
- class Vector<T,N>::CommaInit { }; // ERROR - invalid definition
+ class Vector<T,N>::CommaInit { }; // { dg-error "" } invalid definition
};
+// { dg-do run }
// Test that binfos aren't erroneously shared between instantiations.
class PK_CryptoSystem
-// Build don't link:
+// { dg-do assemble }
template <class T1,class T2>
struct X
-// Build don't link:
+// { dg-do assemble }
// Origin: Mathias Doreille <Mathias.Doreille@imag.fr>
template<class T>
-// Build don't link:
+// { dg-do assemble }
template <class T> struct A {};
template <class T> struct B : A<B<T> > {};
-// Build don't link:
+// { dg-do assemble }
-struct A { // ERROR - forward declaration
- friend struct B : A { // ERROR -
+struct A { // { dg-error "" } forward declaration
+ friend struct B : A { // { dg-error "" }
int x;
};
int y;
-// Build don't link:
+// { dg-do assemble }
template <class T> struct A { T *t; inline A() { t = 0; } };
template <class T> struct B : A<B<T> > { int x; inline B() { x = 3; } };
-// Build don't link:
+// { dg-do assemble }
struct B { int foo (); };
int B::foo() { return 37; }
-// Build don't link:
+// { dg-do assemble }
template <class A> struct X {
A operator[] (int);
template <class A> A X<A>::operator[] (int i)
{
- return A(); // gets bogus error
+ return A(); // { dg-bogus "" }
}
X<int> x;
-// Build don't link:
+// { dg-do assemble }
template<int N_length>
struct B
-// Build don't link:
+// { dg-do assemble }
enum E { };
-// Build don't link:
+// { dg-do assemble }
enum E { e };
-// Build don't link:
+// { dg-do assemble }
template <class R, void (R::* A) (void)>
class s
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 10 Jan 2001 <nathan@codesourcery.com>
int f() { return 0; }
int main() {
-return B<int,&f>::g(); // ERROR - could not convert arg
+return B<int,&f>::g(); // { dg-error "" } could not convert arg
}
+// { dg-do run }
// Test for nested template template parameter feature
template <template<template <class> class> class TTT> struct C
+// { dg-do run }
// Test for nested template template parameter feature
template <template<template <class> class> class TTT> struct C
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 7 Nov 2000 <nathan@codesourcery.com>
// Origin: bug 510 wolfgang.bangerth@iwr.uni-heidelberg.de
+// { dg-do run }
template <class T> struct B { };
template <class T> struct A {
+// { dg-do run }
struct B {
int f(int) { return 1; }
};
-// Build don't run:
+// { dg-do link }
template <class T>
int f(int (*fn)(T))
+// { dg-do run }
// Testcase for not trying a candidate that would generate an ill-formed
// instantiation.
+// { dg-do assemble }
struct A {
template <class T> int f (T) { return 0; }
int f (int) { return 1; }
int main ()
{
A a;
- return a.template f (0); // ERROR -
+ return a.template f (0); // { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 18 Jan 2001 <nathan@codesourcery.com>
}
bool Baz (E e)
{
- return e != e1; // ERROR - void not ignored.
+ return e != e1; // { dg-error "" } void not ignored.
}
-// Build don't link:
+// { dg-do assemble }
// Test resolution of templatized overloaded constructors.
// The more specialized constructor, i.e., A (const B<Dim1,Dim2> &b)
// should be chosen per \S 14.5.5.2/2 [temp.func.order/2].
-//Build don't link:
+// { dg-do assemble }
template<class T>
class C
{
main()
{
C<char*> c;
- char* p = Z(c.O); //ERROR - ambiguous c.O
+ char* p = Z(c.O); //{ dg-error "" } ambiguous c.O
}
-// Build don't link:
+// { dg-do assemble }
template <class T>
void g(T, T);
-// Build don't link:
+// { dg-do assemble }
template <class T> void foo(T);
-// Build don't link:
+// { dg-do assemble }
-template <class T> void foo(); // ERROR - candidate
+template <class T> void foo(); // { dg-error "" } candidate
void (*bar)() = foo<void>;
-void (*baz)() = foo; // ERROR - can't deduce T
+void (*baz)() = foo; // { dg-error "" } can't deduce T
+// { dg-do run }
// Check that foo<int> isn't resolved too early.
template <class T> void foo(T*);
-// Build don't link:
+// { dg-do assemble }
// Adapted from testcase by Corey Kosak <kosak@cs.cmu.edu>
template<class T> void foo(moo_t<T>) {
typename moo_t<T>::cow_t p;
- foo(p); // gets bogus error - no matching function for call - XFAIL *-*-*
+ foo(p); // { dg-bogus "" "" { xfail *-*-* } } - no matching function for call -
}
int main() {
moo_t<int> x;
- foo(x); // gets bogus error - instantiated from here - XFAIL *-*-*
+ foo(x); // { dg-bogus "" "" { xfail *-*-* } } - instantiated from here -
}
-// Build don't link:
+// { dg-do assemble }
// Simplified from bug report by Tim Rowley <tor@cs.brown.edu>
void operator*(baz&, double);
template <class T> inline T operator*(double s, const T &p)
- ; // gets bogus error - must have argument of class type - XFAIL *-*-*
+ ; // { dg-bogus "" "" { xfail *-*-* } } - must have argument of class type -
void m(baz& a) { a * .5; }
+// { dg-do run }
template <class T>
int f(T)
{
+// { dg-do run }
// Testcase for use of template parms as types for other template parms.
template <class T, T t>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 5 Sept 2000 <nathan@codesourcery.com>
+// { dg-do assemble }
// Test that we can represent static_casts in template arg lists.
-// Build don't link:
template <int I> struct A { };
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
template <class T> struct A {
+// { dg-do run }
template<class T_type, int N>
class foo {
public:
-// Build don't link:
+// { dg-do assemble }
// Tests partial specialization
template<class T> struct foo1 {};
template<class T, int n> struct foo1<T[n]>;
foo1<char> bar1;
-foo1<char[10]> baz1; // ERROR - incomplete type
+foo1<char[10]> baz1; // { dg-error "" } incomplete type
template<class T> struct foo2 {};
template<class T, unsigned n> struct foo2<T[n]>;
foo2<char> bar2;
-foo2<char[10]> baz2; // ERROR - incomplete type
+foo2<char[10]> baz2; // { dg-error "" } incomplete type
typedef unsigned int other1_t;
template<class T> struct foo3 {};
template<class T, other1_t n> struct foo3<T[n]>;
foo3<char> bar3;
-foo3<char[10]> baz3; // ERROR - incomplete type -
+foo3<char[10]> baz3; // { dg-error "" } incomplete type -
typedef int other2_t;
template<class T> struct foo4 {};
template<class T, other1_t n> struct foo4<T[n]>;
foo4<char> bar4;
-foo4<char[10]> baz4; // ERROR - incomplete type -
+foo4<char[10]> baz4; // { dg-error "" } incomplete type -
+// { dg-do run }
// Test that partial ordering works between conversion ops from different
// classes.
// From Jason Merrill <jason@cygnus.com>
-// Build don't link:
+// { dg-do assemble }
// Origin: Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
// Bug 29. We failed to verify that template argument deduction
+// { dg-do run }
// Test that partial ordering ignores defaulted parms and 'this'.
struct A {
-// Build don't link:
+// { dg-do assemble }
// Origin: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
template <class T>
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S1
+// { dg-do run }
class foo
{
public:
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Aug 2000 <nathan@codesourcery.com>
void baz ();
};
-template <typename T> void foo (int (*)(T)); // ERROR - candidate
-template <typename T> void foo (int (A::*)(T)); // ERROR - candidate
+template <typename T> void foo (int (*)(T)); // { dg-error "" } candidate
+template <typename T> void foo (int (A::*)(T)); // { dg-error "" } candidate
void A::baz ()
{
- foo (&A::f); // ERROR - ambiguous
+ foo (&A::f); // { dg-error "" } ambiguous
foo (A::f);
foo (&(A::f));
foo (f);
+// { dg-do run }
struct S;
template <S* (S::*p)()>
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S : public S<T*> {};
-// Build don't run:
+// { dg-do link }
template<class T,class T1>
int connect_to_method(T* receiver,
-// Build don't link:
+// { dg-do assemble }
// Based on testcase by adriang@campbellsoft.com
int *pd = NULL;
int (*pf)() = NULL;
int Null::*pmd = NULL;
-int (Null::*pmf)() = NULL; // gets bogus error - cannot convert - XFAIL *-*-*
+int (Null::*pmf)() = NULL; // { dg-bogus "" "" { xfail *-*-* } } - cannot convert -
-// Build don't link:
+// { dg-do assemble }
class A {
public:
int main() {
g<&A::f>();
h<&A::i>();
- g<&B::f>(); // ERROR -
- h<&B::j>(); // ERROR -
- g<(void (A::*)()) &A::f>(); // ERROR -
- h<(int A::*) &A::i>(); // ERROR -
- g<(void (A::*)()) &B::f>(); // ERROR -
- h<(int A::*) &B::j>(); // ERROR -
- g<(void (A::*)()) 0>(); // ERROR -
- h<(int A::*) 0>(); // ERROR -
+ g<&B::f>(); // { dg-error "" }
+ h<&B::j>(); // { dg-error "" }
+ g<(void (A::*)()) &A::f>(); // { dg-error "" }
+ h<(int A::*) &A::i>(); // { dg-error "" }
+ g<(void (A::*)()) &B::f>(); // { dg-error "" }
+ h<(int A::*) &B::j>(); // { dg-error "" }
+ g<(void (A::*)()) 0>(); // { dg-error "" }
+ h<(int A::*) 0>(); // { dg-error "" }
return 0;
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
struct A {
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
struct A;
-// Build don't link:
+// { dg-do assemble }
const double M_PI=3.14159265358979323846;
+// { dg-do run }
template< int i > struct T :
public T< i-1 >
{
-// Build don't link:
+// { dg-do assemble }
template <class T>
-struct S1; // ERROR - previous declaration
+struct S1; // { dg-error "" } previous declaration
template <class T, class U>
-struct S1 {}; // ERROR - used 1 template parameter
+struct S1 {}; // { dg-error "" } used 1 template parameter
-template <class T = int> // ERROR - original def of default
+template <class T = int> // { dg-error "" } original def of default
struct S2;
template <class T = int>
-struct S2; // ERROR - redefinition of default
+struct S2; // { dg-error "" } redefinition of default
-template <class T> // ERROR - template parameter
+template <class T> // { dg-error "" } template parameter
struct S3;
template <int I>
-struct S3; // ERROR - redeclared here
+struct S3; // { dg-error "" } redeclared here
template <template <class T> class C>
-struct S3; // ERROR - redeclared here
+struct S3; // { dg-error "" } redeclared here
-// Build don't link:
+// { dg-do assemble }
struct A
{
-// Build don't link:
+// { dg-do assemble }
int i;
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T, T&>
+// { dg-do run }
// Origin: John Wilkinson <jfw@sgi.com>
template <class T, int& Size>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Apr 2001 <nathan@codesourcery.com>
+// { dg-do link }
+// { dg-options "-frepo" }
+
// Bug: g++ complains about duplicate explicit instantiations with -frepo.
// From Jason Merrill <jason@cygnus.com>
// Build then link:
-// Special g++ Options: -frepo
template <class T> struct A {
virtual ~A () { }
+// { dg-do link }
+// { dg-options "-frepo" }
// Test that collect2 isn't confused by GNU ld's "In function `foo':" message.
// Contributed by Jason Merrill <jason@cygnus.com>
// Build then link:
-// Special g++ Options: -frepo
template <class T>
T f (T t)
+// { dg-do link }
+// { dg-options "-frepo" }
// Test that we properly generate the vtable and such for C.
// Contributed by scott snyder <snyder@fnal.gov>
// Build then link:
-// Special g++ Options: -frepo
struct A
{
+// { dg-do link }
+// { dg-options "-frepo" }
// Build then link:
-// Special g++ Options: -frepo
template <class T>
struct S {
-// Build don't link:
+// { dg-do assemble }
template<class X, class Z>
class foo
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S {
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
-template <class T> struct A { // ERROR - shadowed parameter
+template <class T> struct A { // { dg-error "" } shadowed parameter
struct B {
- void T(); // ERROR - shadows template parameter
+ void T(); // { dg-error "" } shadows template parameter
};
};
A<int> a;
+// { dg-do run }
extern "C" void abort();
template <int I>
+// { dg-do run }
// Although template class B is not used at all, it causes the
// incorrect specialization of A to be selected
+// { dg-do run }
// Adapted from testcase by Oskar Enoksson <osken393@student.liu.se>
extern "C" void abort();
-// Build don't link:
+// { dg-do assemble }
template <class S, class T>
class mem_fun1_t {
+// { dg-do run }
extern "C" void abort();
template <class T>
+// { dg-do run }
extern "C" void abort();
template <class T>
+// { dg-do run }
extern "C" void abort();
template <class T>
+// { dg-do run }
template <class T>
void f(T t);
-// crash test - XFAIL *-*-*
+// { dg-do assemble { xfail *-*-* } }
class X
{
public:
X() {}
template <typename A, typename B>
- X::X<A, void, B>() {} // ERROR - non-template type used as a template
+ X::X<A, void, B>() {} // { dg-error "" } non-template type used as a template
};
+// { dg-do run }
extern "C" void abort();
template <class T>
-// Build don't link:
+// { dg-do assemble }
template<class K>
struct A {
-// Build don't link:
+// { dg-do assemble }
template<class T>
struct Foo { };
-// Build don't link:
+// { dg-do assemble }
template<class A, class B>
void foo(const A& a, const B& b)
-// Build don't link:
+// { dg-do assemble }
template<class T> T f(T o) { return o; }
template<> int f(int o) { return o; }
-// Build don't link:
+// { dg-do assemble }
class X
{
-// Build don't link:
+// { dg-do assemble }
// According to the non-normative example in
// [temp.class.spec.mfunc]/2, these should be valid, but the grammar
template <class T>
struct S {
template <class U> void f(U);
- template <> void f<int>(int); // ERROR - invalid specialization
+ template <> void f<int>(int); // { dg-error "" } invalid specialization
template <class V> struct I {};
template <class V> struct I<V*> {};
- template <> struct I<int>; // ERROR - invalid specialization
+ template <> struct I<int>; // { dg-error "" } invalid specialization
};
-// Build don't link:
+// { dg-do assemble }
template <class T> struct S {};
-template <class T = int> struct S<T*> {}; // ERROR - default argument
+template <class T = int> struct S<T*> {}; // { dg-error "" } default argument
template <int I, int J> struct A {};
-template <int I> struct A<I+5, I*2> {}; // ERROR - argument involves parameter
+template <int I> struct A<I+5, I*2> {}; // { dg-error "" } argument involves parameter
template <class T, T t> struct C {};
-template <class T> struct C<T, 1>; // ERROR - type depends on parameter
+template <class T> struct C<T, 1>; // { dg-error "" } type depends on parameter
int i;
-template <class T> struct C<T*, &i>; // ERROR - type depends on parameter
+template <class T> struct C<T*, &i>; // { dg-error "" } type depends on parameter
template< int X, int (*array_ptr)[X] > class B {};
int array[5];
-template< int X > class B<X,&array> { }; // ERROR - type depends on parameter
+template< int X > class B<X,&array> { }; // { dg-error "" } type depends on parameter
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S
template <class T>
-template <> // ERROR - enclosing classes not specialized
+template <> // { dg-error "" } enclosing classes not specialized
void S<T>::f<int> ()
-{ // ERROR - template does not match any declaration
+{ // { dg-error "" } template does not match any declaration
}
+// { dg-do assemble }
/* [temp.expl.spec] p18. */
template<class T>
};
template<class T>
-class A<T>::B<void> { // ERROR - only one template header
+class A<T>::B<void> { // { dg-error "" } only one template header
};
-// Build don't link:
+// { dg-do assemble }
template <class T> class A;
// template <>
-class A<int>; // ERROR - missing template header - XFAIL *-*-*
+class A<int>; // { dg-error "" "" { xfail *-*-* } } missing template header -
-// Build don't link:
+// { dg-do assemble }
template <class T, int I>
struct S {
+// { dg-do assemble }
// From: lat@iki.fi (Lassi A. Tuura)
// Test that a specialization without an initializer is not a definition,
// as specified in [temp.expl.spec].
-// Build don't link:
struct X;
template <class T> struct Y { static const X array[]; };
-// Build don't link:
+// { dg-do assemble }
template <class T, class U>
struct Y {};
-// Build don't link:
+// { dg-do assemble }
template <class T>
bool f(T);
+// { dg-do run }
char c;
struct S {
+// { dg-do run }
extern "C" void abort();
class X
+// { dg-do run }
#include <cstddef>
template <class T>
-template <> struct A {}; // ERROR - not a specialization
-template <> void f (); // ERROR - not a specialization
+// { dg-do assemble }
+template <> struct A {}; // { dg-error "" } not a specialization
+template <> void f (); // { dg-error "" } not a specialization
-// Build don't link:
+// { dg-do assemble }
// Origin: Raja R Harinath <harinath@cs.umn.edu>
template<class T1, class T2> class foo;
-// Build don't run:
+// { dg-do link }
// Origin: James McKelvey <mckelvey@fafnir.com>
class A
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 17 Jan 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 18 Jan 2001 <nathan@codesourcery.com>
extern "C" int puts (char const *);
-template <typename T> int Foo (T); // ERROR - candidate
-template <typename T> int Foo (T &); // ERROR - candidate
+template <typename T> int Foo (T); // { dg-error "" } candidate
+template <typename T> int Foo (T &); // { dg-error "" } candidate
-template <typename T> int Qux (T); // ERROR - candidate
-template <typename T> int Qux (T const &); // ERROR - candidate
+template <typename T> int Qux (T); // { dg-error "" } candidate
+template <typename T> int Qux (T const &); // { dg-error "" } candidate
-template <typename T> int Bar (T const *const &); // ERROR - candidate
-template <typename T> int Bar (T *const &); // ERROR - candidate
-template <typename T> int Bar (T *); // ERROR - candidate
+template <typename T> int Bar (T const *const &); // { dg-error "" } candidate
+template <typename T> int Bar (T *const &); // { dg-error "" } candidate
+template <typename T> int Bar (T *); // { dg-error "" } candidate
-template <typename T> int Baz (T *const &); // ERROR - candidate
-template <typename T> int Baz (T *); // ERROR - candidate
+template <typename T> int Baz (T *const &); // { dg-error "" } candidate
+template <typename T> int Baz (T *); // { dg-error "" } candidate
int Baz (int const *ptr, int *ptr2)
{
- Baz (ptr2); // ERROR - ambiguous
- Bar (ptr2); // ERROR - ambiguous
- Foo (ptr2); // ERROR - ambiguous
- Qux (ptr2); // ERROR - ambiguous
+ Baz (ptr2); // { dg-error "" } ambiguous
+ Bar (ptr2); // { dg-error "" } ambiguous
+ Foo (ptr2); // { dg-error "" } ambiguous
+ Qux (ptr2); // { dg-error "" } ambiguous
return 0;
}
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 18 Jan 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 21 Jan 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 19 Jan 2001 <nathan@codesourcery.com>
template <class T> struct S
{
- int f (T); // ERROR - void type
+ int f (T); // { dg-error "" } void type
};
void foo ()
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 19 Jan 2001 <nathan@codesourcery.com>
void f()
{
- Inner<dim> i; // ERROR - non-template
- Inner<> j; // ERROR - non-template
+ Inner<dim> i; // { dg-error "" } non-template
+ Inner<> j; // { dg-error "" } non-template
}
};
struct O {};
{
Outer<1> x;
x.f ();
- Outer<1>::Inner<2> z; // ERROR - non-template
- O<1> w; // ERROR - non-template
+ Outer<1>::Inner<2> z; // { dg-error "" } non-template
+ O<1> w; // { dg-error "" } non-template
}
template <typename T, template <typename C> class TPL>
struct X
{
TPL<T> t;
- T<int> s; // ERROR - non-template
+ T<int> s; // { dg-error "" } non-template
};
template <typename T> struct Y
void bar ()
{
X<int, Y> a;
- X<int, O> b; // ERROR - non-template
+ X<int, O> b; // { dg-error "" } non-template
}
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S {};
void S<int>::f() {}
template <>
-void S<int>::g() {} // ERROR - does not match any template declaration
+void S<int>::g() {} // { dg-error "" } does not match any template declaration
+// { dg-do run }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 12 Feb 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
// Origin: <mikes@nilenet.com>
// rejected.
template<class T> class blah{};
-blah<char>::blah(){} // ERROR - invalid specialization
+blah<char>::blah(){} // { dg-error "" } invalid specialization
int main(){}
-// Build don't link:
+// { dg-do assemble }
template <class T>
void f(T t1, T t2);
void h()
{
- f(3, 'c'); // ERROR - no matching function
- g(3, 'c'); // ERROR - no matching function
+ f(3, 'c'); // { dg-error "" } no matching function
+ g(3, 'c'); // { dg-error "" } no matching function
}
-// Build don't link:
+// { dg-do assemble }
struct S1
{
void h()
{
S1 s1;
- s1.f(3, 'c'); // ERROR - no matching function
+ s1.f(3, 'c'); // { dg-error "" } no matching function
S2<char> s2;
- s2.f(3, 'c'); // ERROR - no matching function
+ s2.f(3, 'c'); // { dg-error "" } no matching function
}
+// { dg-do run }
extern "C" void abort();
template <class T>
+// { dg-do run }
extern "C" void abort();
template <void* P>
+// { dg-do assemble }
extern "C" void abort();
template <class T>
template <>
int f(int i)
-{ // ERROR - specialization of f<int>(int) after instantiation
+{ // { dg-error "" } specialization of f<int>(int) after instantiation
return 1;
}
+// { dg-do run }
extern "C" void abort();
template <class T>
-// Build don't link:
-// crash test - XFAIL *-*-*
+// { dg-do assemble { xfail *-*-* } }
// regression test -
// by Paul Burchard <burchard@pobox.com>, Level Set Systems, Inc.
};
template<class A>
struct Y {
- static X<A> x(A(1)); // ERROR - ANSI C++ forbids in-class initialization of non-const static member `x'
+ static X<A> x(A(1)); // { dg-error "" } ANSI C++ forbids in-class initialization of non-const static member `x'
};
Y<int> y;
+// { dg-do run }
// Bug: g++ was failing to destroy C<int>::a because it was using two
// different sentry variables for construction and destruction.
//
-// Build don't link:
+// { dg-do assemble }
template <class A>
class TEST
+// { dg-do run { xfail *-*-aout *-*-coff *-*-hpux* *-*-hms } }
// On targets that don't support weak symbols, we require an explicit
// instantiation of arr.
-// excess errors test - XFAIL *-*-aout *-*-coff *-*-hpux* *-*-hms
template<class T>
struct A {
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S
{
- static const T t = 3; // ERROR - initializing non-integral type
+ static const T t = 3; // { dg-error "" } initializing non-integral type
};
double d = S<double>::t;
-// Build don't run:
-// excess errors test - XFAIL *-*-aout *-*-coff *-*-hpux* *-*-hms
+// { dg-do link { xfail *-*-aout *-*-coff *-*-hpux* *-*-hms } }
// Simplified from testcase by Erez Louidor Lior <s3824888@techst02.technion.ac.il>
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
int i;
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
template <class InputIterator, class BinaryOperation>
void accumulate(InputIterator first,
+// { dg-do run }
extern "C" void abort();
template <class T>
+// { dg-do run }
extern "C" void abort();
int i;
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 22 June 2000 <nathan@codesourcery.com>
};
template <class T> Y::Y(T &) {}
-template class Y::Y (int); // ERROR - parse error
-template Y::Y (int); // ERROR - template-id does not match
+template class Y::Y (int); // { dg-error "" } parse error
+template Y::Y (int); // { dg-error "" } template-id does not match
template Y::Y (int &);
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 22 June 2000 <nathan@codesourcery.com>
}
template class image<double>;
-template class image<double>::image (const image<int> &); // ERROR - parse error
-template class image<double>::image (image<int>); // ERROR - specified as declarator-id
+template class image<double>::image (const image<int> &); // { dg-error "" } parse error
+template class image<double>::image (image<int>); // { dg-error "" } specified as declarator-id
template image<double>::image (const image<int> &);
-// Build don't link:
+// { dg-do assemble }
int f1 () {
struct A { A() { a = 2; } int a; } ;
-// Build don't link:
+// { dg-do assemble }
template <class A> class B { public: A a; };
static B<int> b_int;
-// Build don't link:
+// { dg-do assemble }
template <class A> class B { public: A a; };
static B<int> b_int;
-// Build don't link:
+// { dg-do assemble }
template <class A> class B { public: A a; };
static B<int> b_int;
-// Build don't link:
+// { dg-do assemble }
-template <class A> class B { // ERROR - candidates
+template <class A> class B { // { dg-error "" } candidates
A a;
public:
- B(A&aa); // ERROR - near match
+ B(A&aa); // { dg-error "" } near match
~B();
};
-static B<int> b_int (3); // ERROR - no matching function
+static B<int> b_int (3); // { dg-error "" } no matching function
-// Build don't link:
+// { dg-do assemble }
typedef int I;
int i;
-// Build don't link:
+// { dg-do assemble }
template <class A> class B {
A a;
-// Build don't link:
+// { dg-do assemble }
template <class A> class B {
A a;
-// Build don't link:
+// { dg-do assemble }
struct bs_1 {
typedef int (*pfi) (void);
-// Build don't link:
+// { dg-do assemble }
template <class A> class B { public: A a; B(); };
template <> class B<char> { public: int y[10]; };
-// Build don't link:
+// { dg-do assemble }
template <class A>
class B {
public:
A a;
- B() { x = 2; } // ERROR - no x
+ B() { x = 2; } // { dg-error "" } no x
};
static B<int> bi;
-// Build don't link:
+// { dg-do assemble }
template <class A>
class B {
-// Build don't link:
+// { dg-do assemble }
class OBJECT {int a;};
class STDFILE {int b;};
-// Build don't link:
+// { dg-do assemble }
int a (void * x) { return 1; }
typedef void *T;
-// Build don't link:
+// { dg-do assemble }
template <class A> class B {
public:
-// Build don't link:
+// { dg-do assemble }
class OBJECT
{
{
public:
TESTA();
- T foo(int i) {T t = 0; return t}; // ERROR - no semi
+ T foo(int i) {T t = 0; return t}; // { dg-error "" } no semi
};
-// Build don't link:
+// { dg-do assemble }
class OBJECT
{
+// { dg-do run }
extern "C" int printf (const char *, ...);
template <class T> T max (const T&x, const T&y)
{
-// Build don't link:
+// { dg-do assemble }
extern void byebye ();
template <class T1, class T2>
-// Build don't link:
+// { dg-do assemble }
template <class X> class A {
public:
-// Build don't link:
+// { dg-do assemble }
template <class X> class A { public: int a; X x; };
template <class X> X f (A<X> a) { return a.x; }
-// Build don't link:
+// { dg-do assemble }
class AA { public: static int xx; };
template <class X> class A {
};
int AA::xx;
-template <class Y> int A<Y>::x; // gets bogus error
+template <class Y> int A<Y>::x; // { dg-bogus "" }
-// Build don't link:
+// { dg-do assemble }
template <class T> class temp1
{
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
template <class X> int f (X x, X y) { return 23; }
int foo () {
- return f (7); // ERROR -
+ return f (7); // { dg-error "" }
}
-// Build don't link:
+// { dg-do assemble }
template <class X> int f (X x, X y) { return 23; }
template <class X> int f (X x, int j = 3) { return 29; }
int foo () {
- return f (7); // gets bogus error -
+ return f (7); // { dg-bogus "" }
}
-// Build don't link:
+// { dg-do assemble }
template <class X> int f (X x, unsigned int j = 3) { return 29; }
template <class X> int f (X x, X y) { return 23; }
-// Build don't link:
+// { dg-do assemble }
template <class X> int f (X x, int * j) { return 29; }
template <class X> int f (X x, ...) { return 23; }
-// Build don't link:
+// { dg-do assemble }
template <class X> class B;
template <class X> int f (B<X> b) { return 37; }
-// Build don't link:
+// { dg-do assemble }
template <class X, int n> X f (auto X (*x)[n]) { return (*x)[n/2]; }
extern int i[30];
-// Build don't link:
+// { dg-do assemble }
template <class X, int n> X f (auto X (*x)[n]) { return (*x)[n/2]; }
extern int i[30], i2[33];
-// Build don't link:
+// { dg-do assemble }
struct B { int foo (); };
int B::foo() { return 37; }
-// Build don't link:
+// { dg-do assemble }
template <class X> struct A {
int fooo (int x);
inline int z () { return 5; }
};
-template <class Y> int A<Y>::fooo (int t) { return (this->*(x?&A<Y>::y : &A<Y>::z))() + t; } // gets bogus error
+template <class Y> int A<Y>::fooo (int t) { return (this->*(x?&A<Y>::y : &A<Y>::z))() + t; } // { dg-bogus "" }
A<int> ai;
-// Build don't link:
+// { dg-do assemble }
struct A {
int x;
int foo (int j);
};
-int A::foo (int q) { return q + (this->*(x ? &A::y : &A::z)) (); } // gets bogus error
+int A::foo (int q) { return q + (this->*(x ? &A::y : &A::z)) (); } // { dg-bogus "" }
-// Build don't link:
+// { dg-do assemble }
template <class X> struct A { int operator [] (int); };
template <class Y> int A<Y>::operator[] (int j) { return j * j; }
-// Build don't link:
+// { dg-do assemble }
struct A {
int operator[] (int);
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
template<class X> struct A {
A ();
~A();
-// Build don't link:
+// { dg-do assemble }
template <class X> struct A { };
template <> struct A<int> { int foo (); };
-// Build don't link:
+// { dg-do assemble }
void * foo () {
typedef int * ip;
-// Build don't link:
+// { dg-do assemble }
-class A { // ERROR - synthesized copy ctor
+class A { // { dg-error "" } synthesized copy ctor
public:
- A(int); // ERROR - referenced below
- A(float); // ERROR - referenced below
+ A(int); // { dg-error "" } referenced below
+ A(float); // { dg-error "" } referenced below
~A();
};
-A::A() { // ERROR -
+A::A() { // { dg-error "" }
}
A::A(int) {
-// Build don't link:
+// { dg-do assemble }
class A {
public:
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
extern "C" int printf (const char *, ...);
template<class X> struct A {
+// { dg-do run }
extern "C" int printf (const char *, ...);
template <class T>
-// Build don't link:
+// { dg-do assemble }
struct A {
struct B {
-// Build don't link:
+// { dg-do assemble }
struct A {
struct B {
+// { dg-do run }
extern "C" void abort ();
struct A {
int x;
stat (int j) { abort (); }
};
- static int stat (double d) { return 0; } // gets bogus error - cfront takes it
+ static int stat (double d) { return 0; } // { dg-bogus "" } cfront takes it
static int zap () {
stat (0);
- return stat (1); // gets bogus error - this should work
+ return stat (1); // { dg-bogus "" } this should work
}
};
-// Build don't link:
+// { dg-do assemble }
class B { };
template <class x, int b> class X : public B { int y[b]; };
-// Build don't link:
+// { dg-do assemble }
template <char *a, const char *b, char *const c> class A{int x;};
-// Build don't link:
+// { dg-do assemble }
struct bs_1
{
+// { dg-do run }
extern "C" int printf (const char *, ...);
template <class T> T max (const T&x, const T&y)
{
-// Build don't link:
+// { dg-do assemble }
template <class A> class B { public: A a; };
static B<int> b_int;
-// Build don't link:
+// { dg-do assemble }
#define DEF_A struct A { A() { a = 2; } int a; }
-// Build don't link:
+// { dg-do assemble }
int f1 () {
struct A {
-// Build don't link:
+// { dg-do assemble }
template<class E> class D
{
int main()
{
- C<int,D> c; // ERROR - args not match
+ C<int,D> c; // { dg-error "" } args not match
}
-// Build don't link:
+// { dg-do assemble }
template<class T> class D
{
template<template<class> class D,class E> class C
{
- D d; // ERROR - D is a template
+ D d; // { dg-error "" } D is a template
public:
int f();
};
template<template<class> class D,class E> int C<D,E>::f()
{
- return d.f(); // ERROR - d not properly declared
+ return d.f(); // { dg-error "" } d not properly declared
}
int main()
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
T a;
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
T a;
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
#include <vector>
template<template<class> class D,class E> class C
-// Build don't link:
+// { dg-do assemble }
template<class E> class D
{
int main()
{
- C<1,D> c; // ERROR - args not match
+ C<1,D> c; // { dg-error "" } args not match
}
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T, class U = int> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
-// Build don't link:
+// { dg-do assemble }
template<class E,class F> class D
{
int main()
{
- C<D,int> c; // ERROR - param list not match// WARNING - sees it as not having a type
+ C<D,int> c; // { dg-error "" } param list not match/sees it as not having a type
}
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<class T> class D
{
public:
+// { dg-do run }
template<int T, class U = int> class D
{
public:
+// { dg-do run }
template<int T, class U = int> class D
{
public:
+// { dg-do run }
template<int T, class U = int> class D
{
public:
+// { dg-do run }
template<class T, class U = int> class D
{
public:
+// { dg-do run }
template<class T, class U = T> class D
{
public:
-// Build don't link:
+// { dg-do assemble }
template<class E> class D
{
template<template<class> class D,class E> class C
{
- D<1> d; // ERROR - arg not match
+ D<1> d; // { dg-error "" } arg not match
};
int main()
+// { dg-do run }
#include <vector>
template<class E,template<class> class DD = std::vector> class C
+// { dg-do run }
template<template<class> class D,class E> class C
{
public:
+// { dg-do run }
template <class T, template <class T> class C>
struct X
{};
-// Build don't link:
+// { dg-do assemble }
template < class T, template <class> class E1, template <class> class E2 >
struct Add {
-// Build don't link:
+// { dg-do assemble }
template < class T, template < class > class E1, template < class > class E2 >
class Add {
-// Build don't link:
+// { dg-do assemble }
template<class M, class T> struct temp2;
template<template<class> class M, class T> struct temp2<M<T>, T> {};
-// Build don't link:
+// { dg-do assemble }
template <template<class> class TT> void f() {}
template <template<class,class> class TT> void f() {}
+// { dg-do run }
template <template<class,class> class TT, class T> void f(T)
{
}
+// { dg-do run }
template <template<int> class TT, class T> void f(T)
{
}
-// Build don't link:
+// { dg-do assemble }
template <int i> class C {};
template <template <long> class TT> class D {};
int main()
{
- D<C> d; // ERROR - args not match
+ D<C> d; // { dg-error "" } args not match
}
-// Build don't link:
+// { dg-do assemble }
template<int> class D
{
template<template<int> class D,class E> class C
{
- D<int> d; // ERROR - arg not match
+ D<int> d; // { dg-error "" } arg not match
};
int main()
+// { dg-do run }
template <class T, template <T> class TT> class C {};
template <int> class D {};
+// { dg-do run }
template<class E, int i, class F, class G=int, int j=i, class H=E> class D
{
};
-// Build don't link:
+// { dg-do assemble }
template<class A,class B> class mymap {};
// specialization
template<class Key, class Value>
class base<Key, Value, mymap<int, int > >
-{ // ERROR - type/value mismatch
+{ // { dg-error "" } type/value mismatch
};
-// Build don't link:
+// { dg-do assemble }
// Submitted by Erez Louidor Lior <s3824888@techst02.technion.ac.il>
-// Build don't link:
+// { dg-do assemble }
// Reported by Bruce Eckel <Bruce@EckelObjects.com>
-// Build don't link:
+// { dg-do assemble }
// Testing overloading of function argument involving template template
// parameters
-// Build don't link:
+// { dg-do assemble }
// by Paul Burchard <burchard@pobox.com>, Level Set Systems, Inc.
// Copyright (C) 1999 Free Software Foundation
class B {
};
-template<template<class XX> class AA> // gets bogus error - `template <class XX> template <class X> class A<X>' previously declared here
+template<template<class XX> class AA> // { dg-bogus "" } `template <class XX> template <class X> class A<X>' previously declared here
class C {
class D {
};
};
int main() {
- C<A> c; // gets bogus error - redefinition of `template <class XX> template <class X> class A<X>'
+ C<A> c; // { dg-bogus "" } redefinition of `template <class XX> template <class X> class A<X>'
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Alex Samuel <samuel@codesourcery.com>
namespace NS
-// Build don't link:
+// { dg-do assemble }
// Origin: Alex Samuel <samuel@codesourcery.com>
namespace NS
-// Build don't link:
+// { dg-do assemble }
// Origin: Marcin Kowalczyk <qrczak@knm.org.pl>
template<template<typename> class t1, typename t0> void single()
+// { dg-do run }
template<int> class F
{
};
+// { dg-do assemble }
// Origin: "Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>
-// Build don't link:
template<template<typename> class t1, typename t0> t1<t0> single()
{
+// { dg-do assemble }
// Origin: grg at ai dot mit dot edu
-// Build don't link:
class A;
template<template<class Ignored> class base> class C :
+// { dg-do run }
// Origin: Ewgenij Gawrilow <gawrilow@math.TU-Berlin.DE>
extern "C" void abort ();
-// Build don't link:
+// { dg-do assemble }
// Origin: Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
template <template <class> class TT> class X {};
-// Build don't link:
+// { dg-do assemble }
// Origin: David Margery <David.Margery@irisa.fr>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation
// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
-// Build don't link:
+// { dg-do assemble }
template<class E> class D
{
};
-template<template<class> class D,class E> class C // ERROR - ref below
+template<template<class> class D,class E> class C // { dg-error "" } ref below
{
- D<int,int> d; // ERROR - arg not match
+ D<int,int> d; // { dg-error "" } arg not match
};
int main()
+// { dg-do run }
template<class E> class DD
{
};
+// { dg-do run }
template<class E,class F=int> class D
{
};
+// { dg-do assemble }
// Testcase for handling of typedef wierdness.
-// Build don't link:
template <class T>
struct A
-// Build don't link:
+// { dg-do assemble }
typedef const int cint;
-// Build don't link:
+// { dg-do assemble }
template <class T>
void f(T, T)
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct B1 {
-// Build don't link:
+// { dg-do assemble }
template<class T>
struct A {
-// Build don't link:
+// { dg-do assemble }
struct S {
typedef int I;
};
-void f(typename S::I); // ERROR - using typename outside of template
+void f(typename S::I); // { dg-error "" } using typename outside of template
-// Build don't link:
+// { dg-do assemble }
template <class T, int I>
struct S {
-// Special g++ Options:
+// { dg-do run }
+// { dg-options "" }
// execution test
-// excess errors test
int i = 0;
-// Build don't link:
-// Special g++ Options:
-// excess errors test
+// { dg-do assemble }
+// { dg-options "" }
template <class T>
struct B
-// Build don't link:
-// Special g++ Options: -Wno-deprecated
+// { dg-do assemble }
+// { dg-options "-Wno-deprecated" }
template <class T>
struct B {
struct S : public B<T>
{
struct I {
- void f(X x); // WARNING - implicit typename
+ void f(X x); // { dg-warning "" } implicit typename
};
};
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
template <class T, bool B>
struct R {
-// Build don't run:
-// Special g++ Options: -Wno-deprecated
+// { dg-do link }
+// { dg-options "-Wno-deprecated" }
struct B {
typedef int I;
template <class T>
struct D2 : public D1<T> {
- I i; // ERROR - not a type
+ I i; // { dg-error "" } not a type
};
template <>
int main()
{
D2<int> d2i;
- f(d2i.i); // ERROR - no member i
+ f(d2i.i); // { dg-error "" } no member i
}
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct A
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
// Origin: Mark Mitchell <mark@codesourcery.com>
void X();
-// Special g++ Options:
+// { dg-do run }
+// { dg-options "" }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
class Base {
public:
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options:
template <class T>
struct B {
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// Origin: Mark Mitchell <mark@codesourcery.com>
-// Special g++ Options:
template <class T>
struct S1 {
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
template<class T>
void value_type(T){}
template<class T>
struct D:B<T>{
- Vector<value_type> r; // ERROR - value_type is not a type
+ Vector<value_type> r; // { dg-error "" } value_type is not a type
};
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
class ostream;
-// Build don't link:
-// Special g++ Options:
+// { dg-do assemble }
+// { dg-options "" }
// Copyright (C) 2000 Free Software Foundation
// Adapted by Nathan Sidwell 1 July 2000 <nathan@codesourcery.com>
// Derived from a bug report by scott snyder <snyder@fnal.gov>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 9 Aug 2000 <nathan@codesourcery.com>
template<class LB> struct C
{
- typename LB::DataType; // ERROR - does not declare anything
+ typename LB::DataType; // { dg-error "" } does not declare anything
typename LB::DataType m;
};
struct B {};
struct A {
- B; // ERROR - does not declare anything
+ B; // { dg-error "" } does not declare anything
B m;
};
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 9 Aug 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
//
// Origin: Jens.Maurer@gmx.net
// Copyright (C) 2001 Free Software Foundation, Inc.
-// Build don't link:
-// Special g++ Options: -Wno-deprecated
+// { dg-do assemble }
+// { dg-options "-Wno-deprecated" }
template <class T>
struct A
template <class U>
struct B : public A<U>
{
- A_Type Func(); // WARNING - implicit typename
+ A_Type Func(); // { dg-warning "" } implicit typename
};
template <class U>
-B<U>::A_Type B<U>::Func() { // WARNING - implicit typename
+B<U>::A_Type B<U>::Func() { // { dg-warning "" } implicit typename
}
-// Build don't link:
-// Special g++ Options: -Wno-deprecated
+// { dg-do assemble }
+// { dg-options "-Wno-deprecated" }
template <class T>
struct A
template <class U>
struct C : public B<U>
{
- A_Type Func(); // WARNING - implicit typename
+ A_Type Func(); // { dg-warning "" } implicit typename
};
template <class U>
-C<U>::A_Type C<U>::Func() { // WARNING - implicit typename
+C<U>::A_Type C<U>::Func() { // { dg-warning "" } implicit typename
}
-// Build don't link:
-// Special g++ Options: -Wno-deprecated
+// { dg-do assemble }
+// { dg-options "-Wno-deprecated" }
template <class T>
struct A
template <class U>
struct C : public B<U>
{
- void Func(A_Type); // WARNING - implicit typename
+ void Func(A_Type); // { dg-warning "" } implicit typename
};
template <class U>
-void C<U>::Func(A_Type) { // WARNING - implicit typename
+void C<U>::Func(A_Type) { // { dg-warning "" } implicit typename
}
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct A
template <class U>
struct B : public A<U>
{
- A_Type Func(); // ERROR - declaration
+ A_Type Func(); // { dg-error "" } declaration
};
template <class U>
-A<U>::A_Type B<U>::Func() // ERROR - function
+A<U>::A_Type B<U>::Func() // { dg-error "" } function
{
}
+// { dg-do assemble }
+// { dg-options "" }
// Test for implicit typename
-// Build don't link:
-// Special g++ Options:
template <class T>
struct A {
struct D : public A <C <T> > {
void f ()
{
- B* new_entries = (B *) 0; // WARNING - implicit typename
+ B* new_entries = (B *) 0; // { dg-warning "" } implicit typename
}
};
-// Build don't link:
+// { dg-do assemble }
template < class T > class A
{
public:
- typedef typename T::myT anotherT; // ERROR - undefined type
+ typedef typename T::myT anotherT; // { dg-error "" } undefined type
- anotherT t; // ERROR - undefined type
+ anotherT t; // { dg-error "" } undefined type
A() { }
- A(anotherT _t) { // ERROR - undefined type
+ A(anotherT _t) { // { dg-error "" } undefined type
t=_t;
}
- anotherT getT() { // ERROR - undefined type
+ anotherT getT() { // { dg-error "" } undefined type
return t;
}
};
-class B : public A< B > // ERROR - forward declaration
+class B : public A< B > // { dg-error "" } forward declaration
{
public:
typedef int myT;
+// { dg-do run }
+// { dg-options "-w" }
// Test to make sure that implicit typename doesn't break name binding rules.
-// Special g++ Options: -w
typedef double A;
template<class T> class B {
+// { dg-do assemble }
// Tests non-unification of parms that don't use template parms.
-// Build don't link:
enum kind {a, b};
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct S
-// Build don't link:
+// { dg-do assemble }
template <class T1, class T2>
struct ComputeBinaryType
+// { dg-do assemble }
template <class T> void f (T);
void g ();
int
main ()
{
- f (g); // ERROR - ambiguous unification
+ f (g); // { dg-error "" } ambiguous unification
return 0;
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 21 May 1999 <nathan@acm.org>
void f()
{
- foo<int &>(); // ERROR - attempt to build int & const *
- foo<void ()>(); // ERROR - attempt to build void (const *)()
+ foo<int &>(); // { dg-error "" } attempt to build int & const *
+ foo<void ()>(); // { dg-error "" } attempt to build void (const *)()
}
typedef void (*Fptr)();
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 26 Feb 2000 <nathan@codesourcery.com>
// template functions can be distinguished by return type alone. The return
// type may also be a template parameter.
-template <typename C> C foo (); // gets bogus error
+template <typename C> C foo (); // { dg-bogus "" }
void g ()
{
- int (*pfn1) () = &foo; // gets bogus error
- void (*pfn2) () = &foo; // gets bogus error
+ int (*pfn1) () = &foo; // { dg-bogus "" }
+ void (*pfn2) () = &foo; // { dg-bogus "" }
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 12 Jan 2001 <nathan@codesourcery.com>
template <typename T> void Foo (T const **);
template <typename T> void Bar (T const * const *);
-void Foo (int); // ERROR - candidate
-void Foo (float); // ERROR - candidate
+void Foo (int); // { dg-error "" } candidate
+void Foo (float); // { dg-error "" } candidate
void baz (int **p1)
{
- Foo (p1); // ERROR - no such function
+ Foo (p1); // { dg-error "" } no such function
Bar (p1); // OK
}
-// Build don't link:
+// { dg-do assemble }
union Un {int i;};
-// Build don't link:
+// { dg-do assemble }
// Origin: David Mazieres <dm@amsterdam.lcs.mit.edu>
template<class T> struct vector_base {
+// { dg-do run }
// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 26 Feb 2001 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
//
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 22 May 2001 <nathan@codesourcery.com>
+// { dg-do run }
#include <stdarg.h>
extern "C" void abort();
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation
// Contributed by Nathan Sidwell 22 June 2000 <nathan@codesourcery.com>
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation
// Contributed by Nathan Sidwell 22 June 2000 <nathan@codesourcery.com>
void PrintArgs (Type somearg, ...)
{
va_list argp;
-va_start (argp, somearg); // ERROR - cannot pass non-POD
+va_start (argp, somearg); // { dg-error "" } cannot pass non-POD
Type value;
-value = va_arg (argp, Type); // ERROR - cannot pass non-POD
+value = va_arg (argp, Type); // { dg-error "" } cannot pass non-POD
va_end (argp);
}
int main (void)
{
A dummy;
-PrintArgs (dummy, dummy); // ERROR - cannot pass non-POD
+PrintArgs (dummy, dummy); // { dg-error "" } cannot pass non-POD
return 0;
}
-// Build don't link:
+// { dg-do assemble }
// Origin: Jason Merrill <jason@cygnus.com>
-template <class T> T t; // ERROR - template declaration of t
+template <class T> T t; // { dg-error "" } template declaration of t
+// { dg-do run }
// Check that template classes handle inherited virtual bases
// properly, initializing them before direct non-virtual bases.
+// { dg-do run }
struct V { virtual ~V() {} };
template <class T> struct A : virtual V { };
template <class T> struct B {
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
template <class T>
-// Build don't link:
+// { dg-do assemble }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct S
+// { dg-do run }
// Origin: Mark Mitchell <mark@codesourcery.com>
struct B
-// Build don't link:
-// Special g++ Options: -Wunused
+// { dg-do assemble }
+// { dg-options "-Wunused" }
template <class T>
struct S
void foo()
{
R r; // no warning
- int i; // WARNING - unused
+ int i; // { dg-warning "" } unused
}
S();
-// Build don't link:
-// Special g++ Options: -Wall
+// { dg-do assemble }
+// { dg-options "-Wall" }
// Origin: Jeroen@MMR.be
template <typename T>
+// { dg-do assemble }
// Here is a simple one. GCC correctly gives errors for this code when the
// - -pedantic-errors option is used, whereas g++ doesn't.
-// Build don't link:
int (*p1)[3];
int (*p2)[5];
void
test ()
{
- p1 == p2; // ERROR - comparison.*
- p1 > p2; // ERROR - comparison.*
+ p1 == p2; // { dg-error "" } comparison.*
+ p1 > p2; // { dg-error "" } comparison.*
}
+// { dg-do assemble }
// Another simple one. GCC corerctly gives errors for this code when the
// - -pedantic-errors options is used. g++ doesn't.
-// Build don't link:
void f (int i) { }
void
test ()
{
- i ? f : fp; // ERROR -
+ i ? f : fp; // { dg-error "" }
}
-// Special g++ Options: -g
+// { dg-do run }
+// { dg-options "-g" }
// Internal compiler error on egcs 1.0.1 i586-pc-linux-gnulibc1.
// From: Max Lawson <mlawson@drfmc.ceng.cea.fr>
// Message-Id: <9803091022.AA07520@drfmc.ceng.cea.fr>
-// Build don't link:
+// { dg-do assemble }
template <int object_size>
class _fixed_size_allocator
{
+// { dg-do run }
// Error: intenral compiler error on 1998/05/28 snapshot.
#include <stdio.h>
#include <stdlib.h>
-// Build don't link:
+// { dg-do assemble }
// Error: Internal compiler error in 2.7.2 & EGCS 1.0.0
template <int nlimb, int i>
inline unsigned f (unsigned* ptr);
template <int nlimb>
inline unsigned f<nlimb,nlimb> (unsigned* ptr)
-{ //ERROR - partial specialization of function?
+{ //{ dg-error "" } partial specialization of function?
return 1;
}
+// { dg-do run }
#include <string.h>
class SomeClass_t {
-// Build don't link:
+// { dg-do assemble }
template< class T >
void sort( T* t, int n )
{
-// Skip if not native
-// Special g++ Options: -O2 -fPIC
-// Build don't link:
+// { dg-do assemble { target native } }
+// { dg-options "-O2 -fPIC " }
struct T
{
char* f1;
-// Build don't link:
+// { dg-do assemble }
template <class T>
struct X
{
-// Build don't link:
+// { dg-do assemble }
class X
{
public:
+// { dg-do assemble }
#include<map>
#include<iostream>
#include<vector>
template<class VertexType, class EdgeType>
class Graph
-{ // ERROR - candidates
+{ // { dg-error "" } candidates
public:
// public type interface
typedef std::map<int, EdgeType > Successor;
ostream& operator<<(ostream& os, Graph<VertexType,EdgeType>& G)
{
// display of vertices with successors
- for(int i = 0; i < G.size(); ++i) // ERROR - no size function
+ for(int i = 0; i < G.size(); ++i) // { dg-error "" } no size function
{
- os << G[i].first << " <"; // ERROR - no index operator
+ os << G[i].first << " <"; // { dg-error "" } no index operator
// The compiler does not like this line!!!!!!
typename Graph<VertexType, EdgeType>::Successor::iterator
- startN = G[i].second.begin(), // ERROR - no index operator
- endN = G[i].second.end(); // ERROR - no index operator
+ startN = G[i].second.begin(), // { dg-error "" } no index operator
+ endN = G[i].second.end(); // { dg-error "" } no index operator
while(startN != endN)
{
- os << G[(*startN).first].first << ' ' // ERROR - no index operator
+ os << G[(*startN).first].first << ' ' // { dg-error "" } no index operator
<< (*startN).second << ' ';
++startN;
}
int main()
{
// no edge weighting, therefore type Empty:
- Graph<std::string, Empty> V(true); // ERROR - no bool constructor
+ Graph<std::string, Empty> V(true); // { dg-error "" } no bool constructor
// ReadGraph(V, "gra1.dat");
// display of vertices with successors
-// Build don't link:
+// { dg-do assemble }
template<int N1, int N2>
struct meta_max {
-// Build don't link:
+// { dg-do assemble }
class X
{
public:
+// { dg-do run }
int main() {
for(int i=1; i < 9; i++);
for(int i=1; i < 9; i++);
-// Build don't link:
+// { dg-do assemble }
template <class STRUCT, class MEMBER> inline STRUCT *
setback(MEMBER *bp, MEMBER STRUCT::*offset)
{
-// Build don't link:
+// { dg-do assemble }
#include <iostream>
class X : public std::streambuf
+// { dg-do run }
#include <string.h>
class SomeClass_t {
-// Special g++ Options: -O
+// { dg-do run }
+// { dg-options "-O" }
#include <iostream>
#include <typeinfo>
+// { dg-do run }
template <class INT>
class b
{
+// { dg-do run }
+// { dg-options "" }
// Test for obsolete specialization syntax. Turn off -pedantic.
-// Special g++ Options:
#include <iostream>
#include <typeinfo>
+// { dg-do assemble }
template<bool B>
void f()
{
int main()
{
- f<bool>(); // ERROR - .*
+ f<bool>(); // { dg-error "" } .*
}
-// Build don't link:
+// { dg-do assemble }
// Error: Internal Compiler Error in 2.7.2. & egcs 1.0.0
#ifndef NO_META_MAX
+// { dg-do run }
template<double functionToIntegrate(double)>
double integrate(double a, double b, int numSamplePoints)
{
-//Build don't link:
+// { dg-do assemble }
class A {
private:
int i1_;
public:
- void f(int const i1 = 1); // ERROR - previous specification
+ void f(int const i1 = 1); // { dg-error "" } previous specification
};
void
A::f(int const i1 = 1)
-{ // ERROR - duplicate default argument
+{ // { dg-error "" } duplicate default argument
i1_ = i1;
}
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "" }
// Disable -ansi -pedantic-errors because of GNU extension
-// Special g++ Options:
template<class foo>
class bar {
public:
-// Special g++ Options: -O2 -W
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O2 -W " }
#include "stdio.h"
void writeNote() throw( int )
-//Build don't link:
+// { dg-do assemble }
#include <stdexcept>
class X : public std::runtime_error {
X ();
-// This is a crash test; we don't care how many normal errors we get.
-// excess errors test - XFAIL *-*-*
+// { dg-do assemble }
struct test_box
{
void print(void);
};
-void test<class BOX> (test_box *); // ERROR - illegal code
+void test<class BOX> (test_box *); // { dg-error "" } illegal code
class test_square
{
- friend void test<class BOX> (test_box *); // ERROR - does not match
+ friend void test<class BOX> (test_box *); // { dg-error "" } does not match
}
-template <class BOX> void test(BOX *the_box) // ERROR - semicolon missing
- {
+template <class BOX> void test(BOX *the_box) // { dg-error "" } semicolon missing
+ {x
the_box->print();
- };
+ }; // { dg-error "" }
-template void test<> (test_box *);
+template void test<> (test_box *); // { dg-error "" }
+// { dg-do run }
#include <string.h>
class SomeClass_t {
+// { dg-do assemble }
// Gets ICE 40.
#include <vector>
void ODEsolver::timeloop(vector<double>& y, double ts, double te, double dt)
{
- (ODEsolver::useMethod)(y,ts,dt); // ERROR - should use this->*
+ (ODEsolver::useMethod)(y,ts,dt); // { dg-error "" } should use this->*
}
int main (int nargs, char** args)
+// { dg-do assemble }
template<class T>
struct A {
- typedef T* iterator; // ERROR - pointer to reference
+ typedef T* iterator; // { dg-error "" } pointer to reference
public:
A(){}
};
-// Build don't link:
+// { dg-do assemble }
// Gives ICE on EGCS release branch as of 98/06/08 on i686-pc-linux-gnulibc1)
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
// Message-Id: <199806081358.PAA02505@achibm5.chemie.uni-karlsruhe.de>
find_if( l.begin(), l.end(),
// This is a typo, it should be bind2nd, but an
// ICE is not a very helpful diagnostic!
- binder2nd( equal_to<int>(), 2 ) ); // ERROR -
+ binder2nd( equal_to<int>(), 2 ) ); // { dg-error "" }
assert( *(it) == 2 );
}
-// Build don't link:
+// { dg-do assemble }
// Gives ICE on EGCS release branch as of 98/06/08 on i686-pc-linux-gnulibc1)
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
// Message-Id: <199806081358.PAA02505@achibm5.chemie.uni-karlsruhe.de>
std::find_if( l.begin(), l.end(),
// This is a typo, it should be bind2nd, but an
// ICE is not a very helpful diagnostic!
- std::binder2nd( std::equal_to<int>(), 2 ) ); // ERROR -
+ std::binder2nd( std::equal_to<int>(), 2 ) ); // { dg-error "" }
assert( *(it) == 2 );
}
-// Build don't link:
+// { dg-do assemble }
template<class T>
class Array {
public:
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-Wall" }
// Gives spurious warnings when compiled with -Wall
// EGCS 06/08/98 i686-pc-linux-gnulibc1
-// Special g++ Options: -Wall
// Message-Id: <199806081358.PAA02505@achibm5.chemie.uni-karlsruhe.de>
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
-// Build don't link:
+// { dg-do assemble }
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
// Reported against EGCS snaps 98/06/18.
void bar( double );
void bar( float );
- void foo( void (a::*member)(float) ); // ERROR - candidate
+ void foo( void (a::*member)(float) ); // { dg-error "" } candidate
};
a::a()
{
- foo( &junk ); // ERROR - junk is an unqualified-id.
- foo( &bar ); // ERROR - bar is an unqualified-id.
+ foo( &junk ); // { dg-error "" } junk is an unqualified-id.
+ foo( &bar ); // { dg-error "" } bar is an unqualified-id.
}
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O -Wall -fgcse -frerun-loop-opt" }
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
// Reported against EGCS snaps 98/06/28.
-// Special g++ Options: -O -Wall -fgcse -frerun-loop-opt
//
// Compilation of this program with the flags g++ -Wall -O -fgcse
// -frerun-loop-opt or -O2 produces spurious warnings in the standard
-// Build don't link:
+// { dg-do assemble }
// Gives ICE 109
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
// Reported against EGCS snaps 98/06/28.
{
try {
}
- catch (bad_alloc) { // ERROR - parse error
+ catch (bad_alloc) { // { dg-error "" } parse error
return 1;
}
return 0;
-// Build don't link:
+// { dg-do assemble }
// Gives ICE 109
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
// Reported against EGCS snaps 98/06/28.
{
try {
}
- catch (std::bad_alloc) { // ERROR - parse error
+ catch (std::bad_alloc) { // { dg-error "" } parse error
return 1;
}
return 0;
-// Build don't link:
+// { dg-do assemble }
// Gives ICE 109
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
// Reported against EGCS snaps 98/06/28.
{
try {
}
- catch (bad_alloc) { // ERROR - parse error
+ catch (bad_alloc) { // { dg-error "" } parse error
return 1;
}
return 0;
+// { dg-do run }
extern "C" void abort ();
-// Build don't link:
+// { dg-do assemble }
#include<iostream>
#include<cstddef>
-// Build don't link:
+// { dg-do assemble }
template<class T>
struct A {
typedef T T1;
+// { dg-do run }
#include <stdio.h>
class A {
-// Build don't link:
+// { dg-do assemble }
class C { };
void foo()
{
C c;
- void * v = static_cast<void *>(c); // ERROR - illegal cast
+ void * v = static_cast<void *>(c); // { dg-error "" } illegal cast
}
-// Build don't link:
+// { dg-do assemble }
#define CRASH 1
#ifdef CRASH
-// Build don't link:
+// { dg-do assemble }
typedef __SIZE_TYPE__ size_t;
inline void *operator new(size_t, void *place) throw() { return place; }
+// { dg-do assemble }
// Error: ICE on 2.7.2.3 and EGCS 1.0.0.
-// Build don't link:
template<int N1, int N2>
struct meta_max {
+// { dg-do run }
#include <vector>
#include <sstream>
+// { dg-do assemble }
// Ambiguous conversion, three candidates:
// builtin == (int, int), and the two user-defined operators
// Each one requires a user-defined ICS where another uses builtin conversions,
};
bool operator==(const MyInt& a, const int& b)
-{ // ERROR - candidate
+{ // { dg-error "" } candidate
return (int)a == b;
}
bool operator==(const MyInt& a, const MyInt& b)
-{ // ERROR - candidate
+{ // { dg-error "" } candidate
return (int)a == (int)b;
}
bool f()
{
- return 3 == MyInt(); // ERROR - ambiguous
+ return 3 == MyInt(); // { dg-error "" } ambiguous
}
-// Build don't link:
+// { dg-do assemble }
class foo {
protected:
void __duplicate ();
-// Build don't link:
+// { dg-do assemble }
#include <iostream>
template < class T >
+// { dg-do run }
//
// egcs-2.90.06
// cannot declare friend of enclosing class using its scope, works fine
+// { dg-do assemble }
+// { dg-options "-Wno-deprecated" }
/* bug.cc */
/* simple program to demonstrate the bug with named return values in gcc
*/
/* (w) 4.9.97 by Kurt Garloff <K.Garloff@ping.de> */
-// Special g++ Options: -Wno-deprecated
// 8/28/1998 - This dies in add_conversions from dfs_walk, null CLASSTYPE_METHOD_VEC
// for the test<T> record_type. This is marked as an expected failure for now,
// until we actually fix it.
// named return value version
template <class T>
-test<T> operator + (const test<T>& a, const test<T>& b) return c(a);// ERROR - named return value
-{ c += b; } // ERROR - c undeclared
+test<T> operator + (const test<T>& a, const test<T>& b) return c(a);// { dg-error "" } named return value
+{ c += b; } // { dg-error "" } c undeclared
int main()
{
-//Build don't link:
+// { dg-do assemble }
#include <vector>
using namespace std;
-//Build don't link:
+// { dg-do assemble }
#include <vector>
using namespace std;
-// Build don't link:
+// { dg-do assemble }
#include <complex>
template<class T>
class Vec {
-// Build don't link:
+// { dg-do assemble }
#include <fstream>
class bifstream : public std::ifstream {
+// { dg-do run }
#include<iostream>
int main() {
-// Build don't link:
+// { dg-do assemble }
class A {
public:
void malloc(unsigned int);
+// { dg-do run }
#include <fstream>
#include <cstdio>
-// Build don't link:
+// { dg-do assemble }
class Base {
public:
class Bar { public: virtual ~Bar() {}; };
-// Build don't link:
+// { dg-do assemble }
class string
{
+// { dg-do assemble }
#include <vector>
using namespace std;
template <typename T>
foo<T>::foo() :v(), t() {}
template <typename T=float>
-foo<T>::foo(vector<int> v_) :v(v_), t() {} // ERROR - default arg for member template
+foo<T>::foo(vector<int> v_) :v(v_), t() {} // { dg-error "" } default arg for member template
foo<float> a;
-// Build don't link:
+// { dg-do assemble }
template<class T>
struct A {
typedef T T1;
-// Build don't link:
+// { dg-do assemble }
class string
{
public:
-// Build don't link:
+// { dg-do assemble }
#include <cctype>
#include <iostream>
#include <sstream>
+// { dg-do assemble }
// Error: Internal Compiler Error in GCC 2.7.2 and EGCS 1998/05/28 snapshot.
#include <iostream>
{
public:
class base_func_args;
- virtual void func(base_func_args &) = 0; // ERROR - referenced below
+ virtual void func(base_func_args &) = 0; // { dg-error "" } referenced below
};
class some_base::base_func_args
float f;
};
-class some_derived::func(derived_func_args &a) // ERROR - illegal member syntax
+class some_derived::func(derived_func_args &a) // { dg-error "" } illegal member syntax
{
std::cout << a.i << ' ' << a.f << std::endl;
}
int
main()
{
- some_derived d; // ERROR - abstract class
- some_derived::derived_func_args dfa; // ERROR - incomplete class
+ some_derived d; // { dg-error "" } abstract class
+ some_derived::derived_func_args dfa; // { dg-error "" } incomplete class
some_base *b = &d;
dfa.i = 10;
dfa.f = 20;
- b->func(dfs); // ERROR - dfs not declared
+ b->func(dfs); // { dg-error "" } dfs not declared
return 0;
}
+// { dg-do run }
#include <iostream>
#include <iterator>
#include <string>
+// { dg-do assemble }
// All the pointer_to_binary_function cases used to fail because g++
// couldn't handle converting an overloaded function to a class type.
// The first one should still fail because it requires an implicit conversion
sort( a.begin(), a.end(), compare<int> );
sort<vector<int>::iterator,
pointer_to_binary_function<const Expr<int>, const Expr<int>, bool> >
- ( a.begin(), a.end(), compare ); // ERROR - constructor is explicit
+ ( a.begin(), a.end(), compare ); // { dg-error "" } constructor is explicit
sort( a.begin(), a.end(),
ptr_fun<const Expr<int>, const Expr<int>, bool> (compare) );
sort( a.begin(), a.end(),
+// { dg-do assemble }
// spurious 'const' in error.
// For egcs-2.91.34, the warning message refers to
// class ostream & operator <<(class ostream &, const class Vector<T> &)
template <class T>
class Vector
{
- friend ostream& operator<< (ostream& out, const Vector<T> & vec); // WARNING -
+ friend ostream& operator<< (ostream& out, const Vector<T> & vec); // { dg-warning "" }
};
template <class T>
-// Build don't link:
+// { dg-do assemble }
class A {};
class B : public virtual A {};
template <class Imp> class C : public Imp {};
+// { dg-do run }
#include <iostream>
class A1 {
-// Build don't link:
+// { dg-do assemble }
char *t1 (const char *s)
{
return const_cast<char *>(s);
-// Build don't link:
-// excess errors test
+// { dg-do assemble }
// Here we declare ::S
typedef struct s1 *S;
{
public:
static T *do_something ();
- friend class T; // ERROR - `T' is a template parameter
+ friend class T; // { dg-error "" } `T' is a template parameter
friend class XX<T, U>;
};
-// Build don't link:
+// { dg-do assemble }
enum { a, b };
class Bug {
+// { dg-do run }
struct foo { };
int f(int a, int b)
{
-// Build don't link:
+// { dg-do assemble }
typedef unsigned long Xv_opaque;
class DynaString
-// Build don't link:
+// { dg-do assemble }
class base {
protected:
virtual void f();
+// { dg-do run }
#include <iomanip>
#include <iostream>
#include <cstdlib>
-// Build don't link:
+// { dg-do assemble }
// Since the constructor is in streambuf.h, additional diagnostics are
// produced, which are not really supported in the old-deja framework
void
t( char* buf )
{
- std::istrstream str = buf; //ERROR - inaccessible copy constructor
+ std::istrstream str = buf; //{ dg-error "" } inaccessible copy constructor
}
+// { dg-do assemble }
// Error: Internal compiler error on 1998/05/28 snapshot.
-// Build don't link:
class foo {
public:
typedef int sometype;
};
-struct die : public foo::sometype { // ERROR - invalid base type
+struct die : public foo::sometype { // { dg-error "" } invalid base type
};
-// Build don't link:
+// { dg-do assemble }
#include <exception>
//using namespace std;
class A {
-// Special g++ Options:
+// { dg-do run }
+// { dg-options "" }
// Test for g++ array init extension
class A {
+// { dg-do run }
#define INC_FUNCTIONAL 1
#define USE_STATIC_CAST 1
-// Build don't link:
+// { dg-do assemble }
class A {
public:
A() { t=0; }
-//Build don't link:
+// { dg-do assemble }
#include <string>
class t {
-// Build don't link:
+// { dg-do assemble }
void
action0(float& arg1)
{
-//Build don't link:
+// { dg-do assemble }
#include <vector>
void f(void)
-//Special g++ Options:
+// { dg-do run }
+// { dg-options "" }
//This uses GNU extensions, so disable -ansi
#include <stdio.h>
#include <stdlib.h>
-// Build don't link:
+// { dg-do assemble }
template <class A>
class B:public A {
B(){}
+// { dg-do run }
#include <iterator>
using namespace std;
+// { dg-do run }
#include <cassert>
#include <iostream>
-// Build don't link:
+// { dg-do assemble }
/*
Check whether a typedef for a basic type as a baseclass is diagnosed.
*/
typedef int an_int;
-class bar : public an_int {}; // ERROR - not an aggregate
+class bar : public an_int {}; // { dg-error "" } not an aggregate
+// { dg-do assemble }
// Test that g++ complains about referring to a builtin type in a
// mem-initializer.
// Contributed by Kevin Buhr <buhr@stat.wisc.edu>
int r = 0;
-struct foo { // ERROR - candidate
- foo(int x) { r = 1; } // ERROR - candidate
+struct foo { // { dg-error "" } candidate
+ foo(int x) { r = 1; } // { dg-error "" } candidate
};
struct bar : foo {
typedef int an_int;
- bar() : bar::an_int(3) {} // ERROR - not a base
+ bar() : bar::an_int(3) {} // { dg-error "" } not a base
};
int
-// Build don't link:
+// { dg-do assemble }
#include <vector>
class T
+// { dg-do assemble }
// conversion ops should be treated as coming from the most derived class
// for overload resolution. See [over.match.funcs].
-// Build don't link:
class X {
public:
-// Build don't link:
+// { dg-do assemble }
typedef __SIZE_TYPE__ size_t;
class A {
unsigned counter;
};
-class D { //WARNING - only private members
+class D { //{ dg-warning "" } only private members
int ins( B*&);
};
-// Special g++ Options: -O -Wall
+// { dg-do run }
+// { dg-options "-O -Wall" }
// Depletes VM.
#include <iostream>
-// Build don't link:
+// { dg-do assemble }
class base {
public:
virtual ~base();
-// Build don't link:
+// { dg-do assemble }
int*& foo (int const *& x)
{
return const_cast<int*&> (x);
-//Build don't link:
+// { dg-do assemble }
// the template operator!= interferes. It should be in a namespace.
#include <utility>
+// { dg-do run }
#include <iostream>
#include <sstream>
+// { dg-do assemble }
// Makes bogus x86 assembly code.
#include <iostream>
}
// Prototypes (enable one or the other)
-double max<>(double, double); // ERROR - bogus code
+double max<>(double, double); // { dg-error "" } bogus code
// int max(int, int);
int main()
double d = 1234.5678;
cout.precision(12);
- cout << max(d, i) << endl; // ERROR -
- cout << max(i, d) << endl; // ERROR -
+ cout << max(d, i) << endl; // { dg-error "" }
+ cout << max(i, d) << endl; // { dg-error "" }
return 0;
}
+// { dg-do assemble }
class foo {
public:
- operator <<(const void *); //ERROR - no return type
- operator <<(char *); //ERROR - no return type
+ operator <<(const void *); //{ dg-error "" } no return type
+ operator <<(char *); //{ dg-error "" } no return type
};
void main()
-{ //ERROR - wrong return type for main
+{ //{ dg-error "" } wrong return type for main
foo f;
f << (void*)0;
}
-// Build don't link:
+// { dg-do assemble }
#include <exception>
class A {
-// Build don't link:
+// { dg-do assemble }
class x
{
public:
+// { dg-do assemble }
#include <stdio.h>
template <int n1>
-double val <int> () // ERROR - bogus code
+double val <int> () // { dg-error "" } bogus code
{
return (double) n1;
}
int main ()
{
- printf ("%d\n", val<(int)3> ()); // ERROR - val undeclared
+ printf ("%d\n", val<(int)3> ()); // { dg-error "" } val undeclared
}
-// Skip if not native
-// Special g++ Options: -fprofile-arcs -ftest-coverage
+// { dg-do run { target native } }
+// { dg-options "-fprofile-arcs -ftest-coverage" }
void
test_swap(int& x, int& y) throw()
{
+// { dg-do run }
// Error: Internal Compiler error on GCC 2.7.2.3 & EGCS 1998/05/23 snapshot.
class A {
-// Build don't link:
+// { dg-do assemble }
template <class T> void foo ();
template <class T>
+// { dg-do assemble }
template <unsigned X, class T> struct Foo {
friend void operator<<(int, Foo const &) {}
};
template <unsigned X> class Bar : public Foo<X,int> {};
-inline Bar<0> bar(int,int,int) { return Bar<3>(); } // ERROR - no conversion
+inline Bar<0> bar(int,int,int) { return Bar<3>(); } // { dg-error "" } no conversion
+// { dg-do run }
+// { dg-options "-w" }
// Another magic NULL problem.
-// Special g++ Options: -w
#include <stddef.h>
-// Build don't link:
+// { dg-do assemble }
template <class Key>
class d0om_Hashmap
{
-// Special g++ Options: -O2
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-O2" }
#ifdef HIDE_BUG
#define realloc Realloc
+// { dg-do run }
#include <sys/types.h>
#include <algorithm>
typedef short _eb91_int16_t;
-template<int N> f<0>(){} // ERROR - invalid code
+// { dg-do assemble }
+template<int N> f<0>(){} // { dg-error "" } invalid code
+// { dg-do assemble }
// Error: Internal compiler error on egcs 1998/05/28 snapshot.
const double M_PI=3.14159265358979323846;
int main()
{
double f=Sine<32,5>()
- return 0; // ERROR - parse error
+ return 0; // { dg-error "" } parse error
}
+// { dg-do assemble }
class baseClass
static int variable; // this is intentionally duplicated
};
-myClass::variable = 0; //ERROR - no type
+myClass::variable = 0; //{ dg-error "" } no type
+// { dg-do run }
struct A {};
template <class T>
+// { dg-do run }
// Creates bad assembly on sparc and x86
template<unsigned long SIZE>
struct Array { };
+// { dg-do assemble }
// Error: Internal compiler error in egcs 1998/05/28 snapshot.
void f()
{
- extent(b); // ERROR - no matching function
+ extent(b); // { dg-error "" } no matching function
}
+// { dg-do assemble }
int main() {
ref_ptr<Baz> foo;
- static_cast<Bar *> (foo)->DoSomething; //ERROR - invalid cast
+ static_cast<Bar *> (foo)->DoSomething; //{ dg-error "" } invalid cast
}
+// { dg-do run }
class null {
null (null const&);
void operator& ();
+// { dg-do run }
class null {
null (null const&);
void operator& ();
+// { dg-do run }
class null {
null (null const&);
void operator& ();
+// { dg-do run }
// check cleanup of template temporaries
extern "C" void abort ();
extern "C" void exit (int);
+// { dg-do run }
// check MI and VBC offsets on throw
extern "C" void abort ();
extern "C" void exit (int);
+// { dg-do run }
// try throwing 0 cast to a class object
extern "C" void abort ();
extern "C" void exit (int);
+// { dg-do run }
// check MI and VBC offsets on throw
extern "C" void abort ();
extern "C" void exit (int);
+// { dg-do run }
// check cleanup of partial array objects
extern "C" void abort (void);
extern "C" void exit (int);
-// Build don't link:
+// { dg-do assemble }
//test 2
struct A {};
void f()
{
- struct A; // ERROR - forward ref
- throw *(new A); // ERROR - invalid use of undefined type
+ struct A; // { dg-error "" } forward ref
+ throw *(new A); // { dg-error "" } invalid use of undefined type
}
+// { dg-do run }
// check EH with templates
extern "C" void abort ();
extern "C" void exit (int);
-// Build don't link:
+// { dg-do assemble }
// try throwing overloaded function
void f(int)
void g()
{
- throw &f; // ERROR - insufficient contextual information
+ throw &f; // { dg-error "" } insufficient contextual information
}
-// Build don't link:
+// { dg-do assemble }
// try throwing template function name
template <class T> void f(T);
void g()
{
- throw &f; // ERROR - insufficient contextual information
+ throw &f; // { dg-error "" } insufficient contextual information
}
-// Build don't link:
+// { dg-do assemble }
// check attempting to throw an overloaded function
struct A {
void g()
{
- throw &A::f; // ERROR - insufficient context
+ throw &A::f; // { dg-error "" } insufficient context
}
-// Build don't link:
-// Skip if not target: sparc-*-*
+// { dg-do assemble { target sparc-*-* } }
+// { dg-options "-ansi -pedantic-errors -Wcast-align" }
-// Special g++ Options: -ansi -pedantic-errors -Wcast-align
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 7 Dec 1999 <nathan@acm.org>
void f4 (char *ptr)
{
- (Z *)ptr; // WARNING - alignment
+ (Z *)ptr; // { dg-warning "" } alignment
}
-// Build don't link:
-// Special g++ Options: -ansi -pedantic-errors -Wsign-compare
+// { dg-do assemble }
+// { dg-options "-ansi -pedantic-errors -Wsign-compare" }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 5/13/2001
{
/* A MAX_EXPR is non-negative if EITHER argument to the MAX_EXPR is
determined to be non-negative. */
- if (u < (x >? -1)) // WARNING - signed and unsigned
+ if (u < (x >? -1)) // { dg-warning "" } signed and unsigned
return x;
if (u < (x >? 10))
return x;
/* A MIN_EXPR is non-negative if BOTH arguments to the MIN_EXPR are
determined to be non-negative. */
- if (u < ((x?11:8) <? -1)) // WARNING - signed and unsigned
+ if (u < ((x?11:8) <? -1)) // { dg-warning "" } signed and unsigned
return x;
if (u < ((x?11:8) <? 10))
return x;
+// { dg-do assemble }
+// { dg-options "-Wreturn-type" }
// Test that we don't get a warning about flowing off the end.
-// Build don't link:
-// Special g++ Options: -Wreturn-type
struct A {
~A ();
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 24 Feb 2000 <nathan@codesourcery.com>
void fn ()
{
- X x1(3.5); // WARNING - double to int
- X x2(3.5f); // WARNING - float to int
- X x3(1, 3.5); // WARNING - double to int
- X x4(1, 3.5f); // WARNING - float to int
- X x5(3.5, 1); // WARNING - double to int
- X x6(3.5f, 1); // WARNING - float to int
+ X x1(3.5); // { dg-warning "" } double to int
+ X x2(3.5f); // { dg-warning "" } float to int
+ X x3(1, 3.5); // { dg-warning "" } double to int
+ X x4(1, 3.5f); // { dg-warning "" } float to int
+ X x5(3.5, 1); // { dg-warning "" } double to int
+ X x6(3.5f, 1); // { dg-warning "" } float to int
- X y1 = 3.5; // WARNING - double to int
- X y2 = 3.5f; // WARNING - float to int
+ X y1 = 3.5; // { dg-warning "" } double to int
+ X y2 = 3.5f; // { dg-warning "" } float to int
- int j1 (3.5); // WARNING - double to int
- int j2 (3.5f); // WARNING - float to int
+ int j1 (3.5); // { dg-warning "" } double to int
+ int j2 (3.5f); // { dg-warning "" } float to int
- int k1 = 3.5; // WARNING - double to int
- int k2 = 3.5f; // WARNING - float to int
+ int k1 = 3.5; // { dg-warning "" } double to int
+ int k2 = 3.5f; // { dg-warning "" } float to int
- j1 = 3.5; // WARNING - double to int
- j2 = 3.5f; // WARNING - float to int
+ j1 = 3.5; // { dg-warning "" } double to int
+ j2 = 3.5f; // { dg-warning "" } float to int
- foo (3.5); // WARNING - double to int
- foo (3.5f); // WARNING - float to int
+ foo (3.5); // { dg-warning "" } double to int
+ foo (3.5f); // { dg-warning "" } float to int
- wibble (3.5); // WARNING - double to int
- wibble (3.5f); // WARNING - float to int
- wibble (1, 3.5); // WARNING - double to int
- wibble (1, 3.5f); // WARNING - float to int
- wibble (3.5, 1); // WARNING - double to int
- wibble (3.5f, 1); // WARNING - float to int
+ wibble (3.5); // { dg-warning "" } double to int
+ wibble (3.5f); // { dg-warning "" } float to int
+ wibble (1, 3.5); // { dg-warning "" } double to int
+ wibble (1, 3.5f); // { dg-warning "" } float to int
+ wibble (3.5, 1); // { dg-warning "" } double to int
+ wibble (3.5f, 1); // { dg-warning "" } float to int
- punk (); // WARNING - double to int
- rock (1); // WARNING - double to int
+ punk (); // { dg-warning "" } double to int
+ rock (1); // { dg-warning "" } double to int
}
-// Build don't link:
+// { dg-do assemble }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 6 Mar 2000 <nathan@codesourcery.com>
void foo (int const &);
void wibble (int const &);
void wibble (int const &, int const &);
-void punk (int const & = 3.5f); // WARNING - in passing
+void punk (int const & = 3.5f); // { dg-warning "" } in passing
void rock ();
-void rock (int const &, int const & = 3.5f); // WARNING - in passing
+void rock (int const &, int const & = 3.5f); // { dg-warning "" } in passing
void fn ()
{
- X x2(3.5f); // WARNING - float to int
- X x4(1, 3.5f); // WARNING - float to int
- X x6(3.5f, 1); // WARNING - float to int
+ X x2(3.5f); // { dg-warning "" } float to int
+ X x4(1, 3.5f); // { dg-warning "" } float to int
+ X x6(3.5f, 1); // { dg-warning "" } float to int
- X y2 = 3.5f; // WARNING - float to int
+ X y2 = 3.5f; // { dg-warning "" } float to int
- int j2 (3.5f); // WARNING - float to int
+ int j2 (3.5f); // { dg-warning "" } float to int
- int k2 = 3.5f; // WARNING - float to int
+ int k2 = 3.5f; // { dg-warning "" } float to int
- j2 = 3.5f; // WARNING - float to int
+ j2 = 3.5f; // { dg-warning "" } float to int
- foo (3.5f); // WARNING - float to int
+ foo (3.5f); // { dg-warning "" } float to int
- wibble (3.5f); // WARNING - float to int
- wibble (1, 3.5f); // WARNING - float to int
- wibble (3.5f, 1); // WARNING - float to int
+ wibble (3.5f); // { dg-warning "" } float to int
+ wibble (1, 3.5f); // { dg-warning "" } float to int
+ wibble (3.5f, 1); // { dg-warning "" } float to int
- punk (); // WARNING - float to int
- rock (1); // WARNING - float to int
+ punk (); // { dg-warning "" } float to int
+ rock (1); // { dg-warning "" } float to int
}
// and make sure we really know when something's unsigned
-// Build don't link:
-// Special g++ Options: -ansi -pedantic-errors -Winline -O1
+// { dg-do assemble }
+// { dg-options "-ansi -pedantic-errors -Winline -O1" }
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 9 Mar 2000 <nathan@codesourcery.com>
{}
inline void wobble ()
-{} // gets bogus error - cannot inline
+{} // { dg-bogus "" } cannot inline
void bar (void (*)());
void mwibble ()
{};
void mwobble ()
- {}; // gets bogus error - cannot inline
+ {}; // { dg-bogus "" } cannot inline
static void swibble ()
{};
static void swobble ()
- {}; // gets bogus error - cannot inline
+ {}; // { dg-bogus "" } cannot inline
};
void bar (void (B::*)());
struct C
{
virtual void vwobble ()
- {}; // gets bogus error - cannot inline
+ {}; // { dg-bogus "" } cannot inline
};
void bar4 ()
+// { dg-do assemble }
+// { dg-options "-O -Winline" }
// Bug: g++ wouldn't inline op<< because it was an explicit instantiation.
// Origin: Jason Merrill <jason@cygnus.com>
-// Special g++ Options: -O -Winline
-// Build don't link:
#include <iomanip>
#include <iostream>
-// Special g++ Options: -Woverloaded-virtual
-// Build don't link:
+// { dg-do assemble }
+// { dg-options "-Woverloaded-virtual" }
struct A {
- virtual void f(); // WARNING - hidden
+ virtual void f(); // { dg-warning "" } hidden
};
struct B: public A {
- void f(int); // WARNING - by this
+ void f(int); // { dg-warning "" } by this
};
-# Copyright (C) 1988, 90, 91, 92, 1994, 1997, 2000 Free Software Foundation, Inc.
+# Copyright (C) 1988, 90, 91, 92, 1994, 1997, 2000, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# This file was written by Rob Savoye. (rob@cygnus.com)
-
-#
-# these tests come from the original DejaGnu test suite
-# developed at Cygnus Support. If this isn't deja gnu, I
-# don't know what is...
-#
-
-# load support procs
-load_lib old-dejagnu.exp
-load_lib g++.exp
-
-
-# When a testcase doesn't have any special options, use these.
-if ![info exists DEFAULT_CXXFLAGS] {
- set DEFAULT_CXXFLAGS "-ansi -pedantic-errors -Wno-long-long"
+# Load support procs.
+load_lib g++-dg.exp
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CXXFLAGS
+if ![info exists DEFAULT_CXXFLAGS] then {
+ set DEFAULT_CXXFLAGS " -ansi -pedantic-errors -Wno-long-long"
}
-old-dejagnu-init
-global GXX_UNDER_TEST
-
-#
-# main test loop
-#
-
-set dirlen [expr [string length "$srcdir/$subdir"] + 1];
-foreach file [lsort [find $srcdir/$subdir *.C]] {
- # If we're only testing specific files and this isn't one of them, skip it.
- set tfile [string range $file $dirlen end];
- if ![runtest_file_p $runtests $tfile] then {
- continue
- }
- verbose "Testing $file"
-
- # We don't want old-dejagnu.exp to have to know about all the global
- # variables we use. For now we tell it about CXXFLAGS and LIBS and
- # leave LDFLAGS alone.
- old-dejagnu $GXX_UNDER_TEST "$file" "$tfile" "" "$DEFAULT_CXXFLAGS" "-lstdc++"
+# Initialize `dg'.
+dg-init
+
+# Gather a list of all tests, with the exception of those in directories
+# that are handled specially.
+set tests [lsort [find $srcdir/$subdir *.C]]
+
+proc g++-dg-prune { system text } {
+ regsub -all "(^|\n)\[^\n\]*: In (\[^\n\]*function|method|\[^\n\]*structor) \[^\n\]*" $text "" text
+ regsub -all "(^|\n)\[^\n\]*: In instantiation of \[^\n\]*" $text "" text
+ regsub -all "(^|\n)\[^\n\]*: instantiated from \[^\n\]*" $text "" text
+ regsub -all "(^|\n)\[^\n\]*: At (top level|global scope):\[^\n\]*" $text "" text
+ regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text
+ regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $text "" text
+ regsub -all "(^|\n)collect: re(compiling|linking)\[^\n\]*" $text "" text
+ return $text
}
-# The framework doesn't like to see any error remnants,
-# so remove them.
-if [info exists errorInfo] then {
- unset errorInfo
-}
+# Main loop.
+dg-runtest $tests "" $DEFAULT_CXXFLAGS
+
+# All done.
+dg-finish
-# Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
+# Copyright (C) 1997, 1999, 2000, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
proc g++-dg-test { prog do_what extra_tool_flags } {
# Set up the compiler flags, based on what we're going to do.
+ set options [list]
+
+ # Tests should be able to use "dg-do repo". However, the dg test
+ # driver checks the argument to dg-do against a list of acceptable
+ # options, and "repo" is not among them. Therefore, we resort to
+ # this ugly approach.
+ if [string match "*-frepo*" $extra_tool_flags] then {
+ set do_what "repo"
+ }
+
switch $do_what {
"preprocess" {
set compile_type "preprocess"
# The following line is needed for targets like the i960 where
# the default output file is b.out. Sigh.
}
+ "repo" {
+ set compile_type "object"
+ set output_file "[file rootname [file tail $prog]].o"
+ }
"run" {
set compile_type "executable"
# FIXME: "./" is to cope with "." not being in $PATH.
return ""
}
}
- set options ""
+
if { $extra_tool_flags != "" } {
lappend options "additional_flags=$extra_tool_flags"
}
set comp_output [g++_target_compile "$prog" "$output_file" "$compile_type" $options];
+ if { $do_what == "repo" } {
+ set object_file "$output_file"
+ set output_file "[file rootname [file tail $prog]].exe"
+ concat comp_output \
+ [g++_target_compile "$object_file" "$output_file" "executable" $options]
+ }
+
return [list $comp_output $output_file]
}
return $text
}
+
+# Record additional sources files that must be compiled along with the
+# main source file.
+
+proc dg-gpp-additional-sources { args } {
+ global additional_sources
+ set additional_sources [lindex $args 1]
+}
+
+# Record additional files -- other than source files -- that must be
+# present on the system where the compiler runs.
+
+proc dg-gpp-additional-files { args } {
+ global additional_files
+ set additional_files [lindex $args 1]
+}
+
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
set gpp_compile_options ""
-
+set additional_sources ""
+set additional_files ""
#
# g++_version -- extract and print the version number of the compiler
exec rm -f $rponame
}
- return [target_compile $source $dest $type $options]
+ global additional_sources
+ global additional_files
+ set to_download ""
+ if { $additional_sources != "" } then {
+ if [is_remote host] {
+ lappend options "additional_flags=$additional_sources"
+ }
+ regsub -all " " $additional_sources " [file dirname $source]/" additional_sources
+ if ![is_remote host] {
+ lappend options "additional_flags=$additional_sources"
+ }
+ set to_download [concat $to_download $additional_sources]
+ }
+ if { $additional_files != "" } then {
+ regsub -all " " $additional_files " [file dirname $source]/" additional_files
+ set to_download [concat $to_download $additional_files]
+ }
+ if [is_remote host] {
+ foreach file $to_download {
+ remote_download host $file
+ }
+ }
+
+ set result [target_compile $source $dest $type $options]
+
+ set additional_sources ""
+ set additional_files ""
+
+ return $result
}
#
+++ /dev/null
-# Copyright (C) 1988, 90, 91, 92, 1994, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# This file was written by Rob Savoye. (rob@cygnus.com)
-# With modifications by Mike Stump <mrs@cygnus.com>.
-
-# These tests come from the original DejaGnu test suite
-# developed at Cygnus Support. If this isn't deja gnu, I
-# don't know what is.
-#
-# Language independence is achieved by:
-#
-# 1) Using global $tool to indicate the language (eg: gcc, g++, etc.).
-# This should only be used to look up other objects. We don't want to
-# have to add code for each new language that is supported. If this is
-# done right, no code needs to be added here for each new language.
-#
-# 2) Passing compiler options in as arguments.
-#
-# We require a bit of smarts in our caller to isolate us from the vagaries of
-# each language. See old-deja.exp for the g++ example.
-
-# Useful subroutines.
-
-# process-option -- Look for and process a test harness option in the testcase.
-#
-# PROG is the pathname of the testcase.
-# OPTION is the string to look for.
-# MESSAGE is what to print if $verbose > 1.
-# FLAG_NAME is one of ERROR, WARNING, etc.
-# PATTERN is ???
-
-proc process-option { prog option message flag_name pattern } {
- global verbose
-
- set result ""
-
- set tmp [grep $prog "$option.*" line]
- if ![string match "" $tmp] then {
- foreach i $tmp {
- #send_user "Found: $i\n"
- set xfail_test 0
- set triplet_match 0
- regsub "\\*/$" [string trim $i] "" i
- if [regexp "LINE +\[0-9\]+" $i xopt] then {
- regsub "LINE" $xopt "" xopt;
- regsub "LINE +\[0-9\]+" $i "" i
- set i [lreplace $i 0 0 [expr "${xopt}-0"]];
- }
- if [regexp "XFAIL( +\[^ \]+-\[^ \]+-\[^ \]+)*" $i xopt] then {
- set xfail_test 1
- regsub "XFAIL( +\[^ \]+-\[^ \]+-\[^ \]+)*" $i "" i
- regsub "XFAIL" $xopt "" xopt
- if ![string match "" [string trim $xopt]] then {
- foreach triplet $xopt {
- if [istarget $triplet] {
- set triplet_match 1;
- break;
- }
- }
- } else {
- set triplet_match 1
- }
- }
- set compos [expr [llength $option] + 1] ;# Start of comment, if any
- if { $xfail_test && $triplet_match } then {
- lappend result [list [lindex $i 0] "X$flag_name" [lrange $i $compos end] "$pattern"]
- } else {
- lappend result [list [lindex $i 0] "$flag_name" [lrange $i $compos end] "$pattern"]
- }
- if { $verbose > 1 } then {
- if [string match "" [lrange $i $compos end]] then {
- send_user "Found $message for line [lindex $i 0]\n"
- } else {
- send_user "Found $message \"[lrange $i $compos end]\" for line [lindex $i 0]\n"
- }
- }
- }
- }
-
- #send_user "Returning: $result\n"
- return $result
-}
-
-# old-dejagnu-init -- set up some statistics collectors
-#
-# There currently isn't much to do, but always calling it allows us to add
-# enhancements without having to update our callers.
-# It must be run before calling `old-dejagnu'.
-
-proc old-dejagnu-init { } {
-}
-
-# old-dejagnu-stat -- print the stats of this run
-#
-# ??? This is deprecated, and can be removed.
-
-proc old-dejagnu-stat { } {
-}
-
-# old-dejagnu -- runs an old style DejaGnu test.
-#
-# Returns 0 if successful, 1 if their were any errors.
-# PROG is the full path name of the file to compile.
-#
-# CFLAGSX is the options to always pass to the compiler.
-#
-# DEFAULT_CFLAGS are additional options if the testcase has none.
-#
-# LIBS_VAR is the name of the global variable containing libraries (-lxxx's).
-# This is also ignored.
-#
-# LIBS is any additional libraries to link with. This *cannot* be specified
-# with the compiler flags because otherwise gcc will issue, for example, a
-# "-lg++ argument not used since linking not done" warning which will screw up
-# the test for excess errors. We could ignore such messages instead.
-#
-# Think of "cflags" here as "compiler flags", not "C compiler flags".
-
-proc old-dejagnu { compiler prog name cflagsx default_cflags libs } {
- global verbose
- global tool
- global subdir ;# eg: g++.old-dejagnu
- global host_triplet
- global tmpdir
-
- set runflag 1
- set execbug_flag 0
- set excessbug_flag 0
- set pattern ""
- set text "\[- A-Za-z0-9\.\;\"\_\:\'\`\(\)\!\#\=\+\?\&\*]*"
-
- if ![info exists tmpdir] then {
- set tmpdir "/tmp"
- }
-
-# look for keywords that change the compiler options
-#
-# There are two types of test, negative and affirmative. Negative
-# tests have the keyword of "ERROR - " or "WARNING - " on the line
-# expected to produce an error. This is followed by the pattern. If
-# the desired error or warning message appears, then the test passes.
-#
-# Affirmative test can have the following keywords "gets bogus error",
-# "causes invalid C code", "invalid assembly code", "causes abort",
-# "causes segfault", "causes linker error", "execution test fails". If
-# the pattern after the keyword matches, then the test is a failure.
-#
-# One can specify particular targets for expected failures of the above
-# keywords by putting "XFAIL target-triplet" after the keyword.
-#
-# Example:
-#
-# void f ()
-#{
-# int i[2], j;
-# A a (int (i[1]), j); // gets bogus error - late parsing XFAIL *-*-*
-# A b (int (i[1]), int j); // function
-# a.k = 0; // gets bogus error - late parsing XFAIL *-*-*
-# b (i, j);
-#}
-#
-# Note also, that one can add a comment with the keyword ("late parsing"
-# in the above example).
-#
-# If any of the tests contain the special pattern "FIXME -" that test is
-# not run because it will produce incorrect output.
-#
-# Testcases can supply special options to the compiler with a line containing
-# "Special.*Options: ...", where ".*" can be anything (eg: g++) and "..." are
-# the additional options to pass to the compiler. Nothing else may appear
-# after the options. IE: for a C testcase
-# /* Special Options: -fomit-frame-pointer */ /* Oops! */
-# is wrong,
-# /* Special Options: -fomit-frame-pointer */
-# is right. If no such Special Options are found, $default_cflags is used.
-# FIXME: Can there be multiple lines of these?
-#
-# Other keywords: "Build don't link:", "Build don't run:", "Build then link:",
-# "Additional sources: <file>.cc ..."
-
-# $name is now passed in.
-# set name "[file tail [file dirname $prog]]/[file tail $prog]"
-
- set tmp [grep $prog "FIXME -.*"]
- if ![string match "" $tmp] then {
- foreach i $tmp {
- warning "[file tail [file dirname $prog]]/[file tail $prog] [lrange $i 2 end]"
- }
- return 1
- }
-
- set tmp [lindex [grep $prog "Special.*Options:.*"] 0]
- set cflags ""
- set to_download ""
-
- regsub -all "\n\[^\n\]+(\n|$)" $tmp "\n" tmp
- set tmp [string trim $tmp]
- if ![string match "" $tmp] then {
- regsub "^.*Special.*Options:" $tmp "" tmp
- lappend cflags "additional_flags=$tmp"
- verbose "Adding special options $tmp" 2
- } else {
- lappend cflags "additional_flags=$default_cflags"
- }
-
- if { $cflagsx != "" } {
- lappend cflags "additional_flags=$cflagsx"
- }
-
- set tmp [lindex [grep $prog "Additional sources: .*"] 0]
- regsub -all "\n\[^\n\]+(\n|$)" $tmp "\n" tmp
- set tmp [string trim $tmp]
- if ![string match "" $tmp] then {
- regsub "^.*Additional.*sources:" $tmp "" tmp
- if [is_remote host] {
- lappend cflags "additional_flags=$tmp"
- }
- regsub -all " " $tmp " [file dirname $prog]/" tmp
- if ![is_remote host] {
- lappend cflags "additional_flags=$tmp"
- }
- set to_download [concat $to_download $tmp]
- verbose "Adding sources $tmp"
- }
-
- set tmp [lindex [grep $prog "Additional files: .*"] 0]
- regsub -all "\n\[^\n\]+(\n|$)" $tmp "\n" tmp
- set tmp [string trim $tmp]
- if ![string match "" $tmp] then {
- regsub "^.*Additional.*files:" $tmp "" tmp
- regsub -all " " $tmp " [file dirname $prog]/" tmp
- set to_download [concat $to_download $tmp]
- verbose "Downloading files $tmp"
- }
-
- lappend cflags "compiler=$compiler"
-
- regsub -all "\[./\]" "$name" "-" output;
- set output "$tmpdir/$output.exe";
- set compile_type "executable"
-
- set tmp [lindex [grep $prog "Build don.t link:"] 0]
- if ![string match "" $tmp] then {
- set compile_type "object"
- set runflag 0
- set output "$tmpdir/[file tail [file rootname $prog]].o"
- verbose "Will compile $prog to object" 3
- }
-
- set tmp [lindex [grep $prog "Build then link:"] 0]
- if ![string match "" $tmp] then {
- set compile_type "object"
- set runflag 2
- set final_output "$output"
- set output "$tmpdir/[file tail [file rootname $prog]].o"
- verbose "Will compile $prog to object, then link it" 3
- }
-
- set tmp [lindex [grep $prog "Build don.t run:"] 0]
- if ![string match "" $tmp] then {
- set runflag 0
- verbose "Will compile $prog to binary" 3
- }
-
- set tmp [grep $prog "Skip if (|not )feature:.*"];
- if { $tmp != "" } {
- foreach line $tmp {
- if [regexp "Skip if not feature" $line] {
- set not 1;
- } else {
- set not 0;
- }
- regsub "^.*Skip if (|not )feature:\[ \]*" "$line" "" i;
- set is_set 0;
- foreach j $i {
- if [target_info exists $j] {
- set is_set 1;
- break;
- }
- }
- if { $is_set != $not } {
- untested "$name: Test skipped: ${line}($j set)"
- return;
- }
- }
- }
-
- set tmp [grep $prog "Skip if (|not )target:.*"];
- if { $tmp != "" } {
- foreach line $tmp {
- if [regexp "Skip if not target:" $line] {
- set not 1;
- } else {
- set not 0;
- }
- regsub "^.*Skip if (|not )target:\[ \]*" "$line" "" i;
- set ist 0;
- foreach j $i {
- if [istarget $j] {
- set ist 1;
- break;
- }
- }
- if { $ist != $not } {
- untested "$name: Test skipped: ${line}"
- return;
- }
- }
- }
-
- if ![isnative] {
- set tmp [lindex [grep $prog "Skip if not native"] 0];
- if { $tmp != "" } {
- untested "$name: Test skipped because not native";
- return;
- }
- } else {
- set tmp [lindex [grep $prog "Skip if native"] 0];
- if { $tmp != "" } {
- untested "$name: Test skipped because native";
- return;
- }
- }
-
- lappend cflags "libs=$libs"
-
-#
-# Look for the other keywords and extract the error messages.
-# `message' contains all the things we found.
-# ??? We'd like to use lappend below instead of concat, but that doesn't
-# work (adds an extra level of nesting to $tmp).
-#
-
- set message ""
-
- set tmp [process-option $prog "ERROR - " "an error message" ERROR "$text error$text"]
- if ![string match "" $tmp] then {
- set runflag 0
- set message [concat $message $tmp]
- }
-
- set tmp [process-option $prog "WARNING - " "a warning message" WARNING "warning"]
- if ![string match "" $tmp] then {
- set runflag 0
- set message [concat $message $tmp]
- }
-
- set tmp [process-option $prog "gets bogus error" "a bogus error" BOGUS $text]
- if ![string match "" $tmp] then {
- set message [concat $message $tmp]
- }
-
- set tmp [process-option $prog "causes invalid C code" "a bad C translation" BADC $text]
- if ![string match "" $tmp] then {
- set message [concat $message $tmp]
- }
-
- set tmp [process-option $prog "invalid assembly code" "some invalid assembly code" BADASM $text]
- if ![string match "" $tmp] then {
- set message [concat $message $tmp]
- }
-
- set tmp [process-option $prog "causes abort" "an abort cause" ABORT $text]
- if ![string match "" $tmp] then {
- set message [concat $message $tmp]
- }
-
- set tmp [process-option $prog "causes segfault" "a segfault cause" SEGFAULT $text]
- if ![string match "" $tmp] then {
- set message [concat $message $tmp]
- }
-
- set tmp [process-option $prog "causes linker error" "a linker error" LINKER $text]
- if ![string match "" $tmp] then {
- set message [concat $message $tmp]
- }
-
- set tmp [process-option $prog "execution test fails" "an execution failure" EXECO $text]
- if ![string match "" $tmp] then {
- set execbug_flag 1
- set message [concat $message $tmp]
- warning "please use execution test - XFAIL *-*-* in $prog instead"
- }
-
- set tmp [process-option $prog "execution test - " "an excess error failure" EXEC $text]
- if ![string match "" $tmp] then {
- set message [concat $message $tmp]
- }
-
- set tmp [process-option $prog "excess errors test fails" "an excess error failure" EXCESSO $text]
- if ![string match "" $tmp] then {
- set excessbug_flag 1
- set message [concat $message $tmp]
- warning "please use excess errors test - XFAIL *-*-* in $prog instead"
- }
-
- set tmp [process-option $prog "excess errors test - " "an excess error failure" EXCESS $text]
- if ![string match "" $tmp] then {
- set message [concat $message $tmp]
- }
-
- set expect_crash \
- [process-option $prog "crash test - " "a crash" CRASH $text]
- if {$expect_crash != ""
- && [lindex [lindex $expect_crash 0] 1] == "XCRASH"} then {
- set expect_crash 1
- } else {
- set expect_crash 0
- }
-
-#
-# run the compiler and analyze the results
-#
- # Download any source or header files we might need.
- if [is_remote host] {
- foreach file $to_download {
- remote_download host $file
- }
- }
-
- # Since we don't check return status of the compiler, make sure
- # we can't run a.out when the compilation fails.
- remote_file build delete $output
- set comp_output [${tool}_target_compile $prog $output $compile_type $cflags]
- if { $runflag == 2 && [file exists $output] } then {
- set runflag 0
- set comp_output [concat $comp_output [${tool}_target_compile $output $final_output "executable" $cflags]]
- set output $final_output
- }
-
- # Delete things like "ld.so: warning" messages.
- set comp_output [prune_gcc_output [prune_warnings $comp_output]]
-
- if [regexp "\[Ii\]nternal (compiler )?error" $comp_output] then {
- if $expect_crash then {
- setup_xfail "*-*-*"
- }
- fail "$name caused compiler crash"
- remote_file build delete $output
- return 1
- }
-
- #send_user "\nold_dejagnu.exp: comp_output1 = :$comp_output:\n\n"
- #send_user "\nold_dejagnu.exp: message = :$message:\n\n"
- #send_user "\nold_dejagnu.exp: message length = [llength $message]\n\n"
-
- set last_line 0
- foreach i $message {
-
- #send_user "\nold_dejagnu.exp: i = :$i:\n\n"
-
- # Remove all error messages for the line [lindex $i 0]
- # in the source file. If we find any, success!
- set line [lindex $i 0]
- set pattern [lindex $i 2]
-
- # Multiple tests one one line don't work, because we remove all
- # messages on the line for the first test. So skip later ones.
- if { $line == $last_line } {
- continue
- }
- set last_line $line
-
- if [regsub -all "(^|\n)\[^\n\]+:$line:\[^\n\]*" $comp_output "" comp_output] {
- set comp_output [string trimleft $comp_output]
- set ok pass
- set uhoh fail
- } else {
- set ok fail
- set uhoh pass
- }
-
- case [lindex $i 1] {
- "ERROR" {
- $ok "$name $pattern (test for errors, line $line)"
- }
- "XERROR" {
- x$ok "$name $pattern (test for errors, line $line)"
- }
- "WARNING" {
- $ok "$name $pattern (test for warnings, line $line)"
- }
- "XWARNING" {
- x$ok "$name $pattern (test for warnings, line $line)"
- }
- "BOGUS" {
- $uhoh "$name $pattern (test for bogus messages, line $line)"
- }
- "XBOGUS" {
- x$uhoh "$name $pattern (test for bogus messages, line $line)"
- }
- "ABORT" {
- $uhoh "$name $pattern (test for compiler aborts, line $line)"
- }
- "XABORT" {
- x$uhoh "$name $pattern (test for compiler aborts, line $line)"
- }
- "SEGFAULT" {
- $uhoh "$name $pattern (test for compiler segfaults, line $line)"
- }
- "XSEGFAULT" {
- x$uhoh "$name $pattern (test for compiler segfaults, line $line)"
- }
- "LINKER" {
- $uhoh "$name $pattern (test for linker problems, line $line)"
- }
- "XLINKER" {
- x$uhoh "$name $pattern (test for linker problems, line $line)"
- }
- "BADC" {
- $uhoh "$name $pattern (test for Bad C code, line $line)"
- }
- "XBADC" {
- x$uhoh "$name $pattern (test for Bad C code, line $line)"
- }
- "BADASM" {
- $uhoh "$name $pattern (test for bad assembler, line $line)"
- }
- "XBADASM" {
- x$uhoh "$name $pattern (test for bad assembler, line $line)"
- }
- "XEXEC" {
- set execbug_flag 1
- }
- "XEXCESS" {
- set excessbug_flag 1
- }
- }
- #send_user "\nold_dejagnu.exp: comp_output2= :$comp_output:\n\n"
- }
- #send_user "\nold_dejagnu.exp: comp_output3 = :$comp_output:\n\n"
-
- #look to see if this is all thats left, if so, all messages have been handled
- #send_user "comp_output: $comp_output\n"
- regsub -all "(^|\n)\[^\n\]*: In (\[^\n\]*function|method|\[^\n\]*structor) \[^\n\]*" $comp_output "" comp_output
- regsub -all "(^|\n)\[^\n\]*: In instantiation of \[^\n\]*" $comp_output "" comp_output
- regsub -all "(^|\n)\[^\n\]*: instantiated from \[^\n\]*" $comp_output "" comp_output
- regsub -all "(^|\n)\[^\n\]*: At (top level|global scope):\[^\n\]*" $comp_output "" comp_output
- regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $comp_output "" comp_output
- regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $comp_output "" comp_output
- regsub -all "(^|\n)collect: re(compiling|linking)\[^\n\]*" $comp_output "" comp_output
-
- set unsupported_message [${tool}_check_unsupported_p $comp_output]
- if { $unsupported_message != "" } {
- unsupported "$name: $unsupported_message"
- return
- }
-
- # someone forgot to delete the extra lines
- regsub -all "\n+" $comp_output "\n" comp_output
- regsub "^\n+" $comp_output "" comp_output
- #send_user "comp_output: $comp_output\n"
-
- # excess errors
- if $excessbug_flag then {
- setup_xfail "*-*-*"
- }
- if ![string match "" $comp_output] then {
- fail "$name (test for excess errors)"
- send_log "$comp_output\n"
- } else {
- pass "$name (test for excess errors)"
- }
-
- # run the executable image
- if $runflag then {
- set executable $output
- if ![file exists $executable] then {
- # Since we couldn't run it, we consider it an expected failure,
- # so that test cases don't appear to disappear, and reappear.
- setup_xfail "*-*-*"
- fail "$name $pattern Execution test"
- } else {
- set status -1
- set result [eval [format "%s_load %s" $tool $executable]]
- set status [lindex $result 0];
- set output [lindex $result 1];
- if { $status == "pass" } {
- remote_file build delete $executable;
- }
- if { $execbug_flag || $excessbug_flag } then {
- setup_xfail "*-*-*"
- }
- $status "$name $pattern Execution test"
- }
- } else {
- verbose "deleting $output"
- remote_file build delete $output
- }
-
- return 0
-}