Commit 754ca643 by Jason Merrill Committed by Jason Merrill

* [various.C]: Adjust for C++11 mode.

From-SVN: r181221
parent bc3e284b
2011-11-09 Jason Merrill <jason@redhat.com> 2011-11-09 Jason Merrill <jason@redhat.com>
* g++.dg/eh/new1.C: Adjust for C++11 mode.
* g++.dg/init/new11.C: Likewise.
* g++.dg/init/pr29571.C: Likewise.
* g++.dg/lookup/forscope2.C: Likewise.
* g++.dg/parse/linkage1.C: Likewise.
* g++.dg/parse/typedef8.C: Likewise.
* g++.dg/template/error44.C: Likewise.
* g++.dg/tls/diag-2.C: Likewise.
* g++.dg/tls/diag-4.C: Likewise.
* g++.dg/warn/anonymous-namespace-3.C: Likewise.
* g++.old-deja/g++.abi/arraynew.C: Likewise.
* g++.old-deja/g++.abi/cxa_vec.C: Likewise.
* g++.old-deja/g++.brendan/new3.C: Likewise.
* g++.old-deja/g++.eh/new1.C: Likewise.
* g++.old-deja/g++.eh/new2.C: Likewise.
* g++.old-deja/g++.jason/new.C: Likewise.
* g++.old-deja/g++.law/friend1.C: Likewise.
* g++.old-deja/g++.mike/net46.C: Likewise.
* g++.old-deja/g++.mike/p755.C: Likewise.
* g++.old-deja/g++.other/new6.C: Likewise.
* g++.dg/cpp0x/variadic74.C: Adjust diags. * g++.dg/cpp0x/variadic74.C: Adjust diags.
* g++.dg/template/crash53.C: Likewise. * g++.dg/template/crash53.C: Likewise.
* g++.dg/template/void9.C: Likewise. * g++.dg/template/void9.C: Likewise.
......
...@@ -9,7 +9,10 @@ ...@@ -9,7 +9,10 @@
int ret = 1; int ret = 1;
void *ptr; void *ptr;
void * operator new[] (std::size_t s) throw (std::bad_alloc) void * operator new[] (std::size_t s)
#if __cplusplus <= 199711L
throw (std::bad_alloc)
#endif
{ {
ptr = operator new (s); ptr = operator new (s);
return ptr; return ptr;
......
...@@ -5,7 +5,11 @@ ...@@ -5,7 +5,11 @@
#include <new> #include <new>
bool abort_new; bool abort_new;
void *operator new[](size_t bytes) throw (std::bad_alloc) { void *operator new[](size_t bytes)
#if __cplusplus <= 199711L
throw (std::bad_alloc)
#endif
{
if (abort_new) if (abort_new)
abort(); abort();
return operator new (bytes); return operator new (bytes);
......
...@@ -3,6 +3,11 @@ ...@@ -3,6 +3,11 @@
struct A struct A
{ {
static const int i = 0/0 + ""; // { dg-warning "division by zero" } static const int i = 0/0 + ""; // { dg-warning "division by zero" }
// { dg-error "field initializer is not constant|not a constant-expression" "" { target *-*-* } 5 } // { dg-error "constant|conversion|initializ" "" { target *-*-* } 5 }
static const int j = int(i); static const int j = int(i);
}; };
// Currently G++ complains about a non-constant initializer for 'j' in
// C++11 mode, but not C++98. Either way is correct because it depends on
// the erroneous initializer for i, so don't require the error.
// { dg-prune-output ":7:" }
...@@ -7,3 +7,5 @@ struct S { ...@@ -7,3 +7,5 @@ struct S {
} }
}; };
// It's OK to error or not on line 6.
// { dg-prune-output ":6:" }
// PR c++/26068 // PR c++/26068
extern "C" auto int a; // { dg-error "linkage" } extern "C" auto int a; // { dg-error "linkage|two or more data types" }
extern "C" register int b; // { dg-error "linkage" } extern "C" register int b; // { dg-error "linkage" }
extern "C" static void c(); // { dg-error "linkage" } extern "C" static void c(); // { dg-error "linkage" }
extern "C" extern void d(); // { dg-error "linkage" } extern "C" extern void d(); // { dg-error "linkage" }
......
...@@ -7,5 +7,5 @@ static typedef int a; // { dg-error "conflicting" } ...@@ -7,5 +7,5 @@ static typedef int a; // { dg-error "conflicting" }
int foo() int foo()
{ {
typedef auto int bar; // { dg-error "conflicting" } typedef auto int bar; // { dg-error "conflicting|two or more data types" }
} }
// PR c++/32056 // PR c++/32056
template <auto int T> struct A {}; // { dg-error "storage class specified" } template <auto int T> struct A {}; // { dg-error "storage class specified|two or more" }
template <extern int T> struct B {}; // { dg-error "storage class specified" } template <extern int T> struct B {}; // { dg-error "storage class specified" }
template <static int T> struct C {}; // { dg-error "storage class specified" } template <static int T> struct C {}; // { dg-error "storage class specified" }
template <register int T> struct D {}; // { dg-error "storage class specified" } template <register int T> struct D {}; // { dg-error "storage class specified" }
......
...@@ -9,7 +9,7 @@ typedef __thread int g4; /* { dg-error "multiple storage classes" } */ ...@@ -9,7 +9,7 @@ typedef __thread int g4; /* { dg-error "multiple storage classes" } */
void foo() void foo()
{ {
__thread int l1; /* { dg-error "implicitly auto and declared '__thread'" } */ __thread int l1; /* { dg-error "implicitly auto and declared '__thread'" } */
auto __thread int l2; /* { dg-error "multiple storage classes" } */ auto __thread int l2; /* { dg-error "multiple storage classes|data types" } */
__thread extern int l3; /* { dg-error "'__thread' before 'extern'" } */ __thread extern int l3; /* { dg-error "'__thread' before 'extern'" } */
register __thread int l4; /* { dg-error "multiple storage classes" } */ register __thread int l4; /* { dg-error "multiple storage classes" } */
} }
......
...@@ -5,6 +5,6 @@ __thread typedef int g4; /* { dg-error "multiple storage classes" } */ ...@@ -5,6 +5,6 @@ __thread typedef int g4; /* { dg-error "multiple storage classes" } */
void foo() void foo()
{ {
__thread auto int l2; /* { dg-error "multiple storage classes" } */ __thread auto int l2; /* { dg-error "multiple storage classes|data types" } */
__thread register int l4; /* { dg-error "multiple storage classes" } */ __thread register int l4; /* { dg-error "multiple storage classes" } */
} }
...@@ -11,3 +11,5 @@ struct C // { dg-warning "uses the anonymous namespace" } ...@@ -11,3 +11,5 @@ struct C // { dg-warning "uses the anonymous namespace" }
{ {
std::auto_ptr<A> p; std::auto_ptr<A> p;
}; };
// { dg-prune-output "auto_ptr. is deprecated" }
...@@ -8,7 +8,10 @@ ...@@ -8,7 +8,10 @@
void* p; void* p;
void* operator new[](size_t s) throw (std::bad_alloc) void* operator new[](size_t s)
#if __cplusplus <= 199711L
throw (std::bad_alloc)
#endif
{ {
// Record the base of the last array allocated. // Record the base of the last array allocated.
p = malloc (s); p = malloc (s);
......
...@@ -54,7 +54,10 @@ static abi::__cxa_cdtor_return_type dtor (void *x) ...@@ -54,7 +54,10 @@ static abi::__cxa_cdtor_return_type dtor (void *x)
// track new and delete // track new and delete
static int blocks = 0; static int blocks = 0;
void *operator new[] (std::size_t size) throw (std::bad_alloc) void *operator new[] (std::size_t size)
#if __cplusplus <= 199711L
throw (std::bad_alloc)
#endif
{ {
void *ptr = malloc (size); void *ptr = malloc (size);
......
...@@ -12,7 +12,11 @@ ...@@ -12,7 +12,11 @@
int pass = 0; int pass = 0;
void *operator new(size_t sz) throw (std::bad_alloc) { void *operator new(size_t sz)
#if __cplusplus <= 199711L
throw (std::bad_alloc)
#endif
{
void *p; void *p;
......
...@@ -32,7 +32,10 @@ A::~A() { created = 0; } ...@@ -32,7 +32,10 @@ A::~A() { created = 0; }
B::B(A) { } B::B(A) { }
void foo (B*) { throw 1; } void foo (B*) { throw 1; }
void* operator new (size_t size) throw (std::bad_alloc) void* operator new (size_t size)
#if __cplusplus <= 199711L
throw (std::bad_alloc)
#endif
{ {
++newed; ++newed;
return (void *) std::malloc (size); return (void *) std::malloc (size);
......
...@@ -33,7 +33,10 @@ A::~A() { created = 0; } ...@@ -33,7 +33,10 @@ A::~A() { created = 0; }
B::B(A) { throw 1; } B::B(A) { throw 1; }
void foo (B*) { } void foo (B*) { }
void* operator new (size_t size) throw (std::bad_alloc) void* operator new (size_t size)
#if __cplusplus <= 199711L
throw (std::bad_alloc)
#endif
{ {
++newed; ++newed;
return (void *) std::malloc (size); return (void *) std::malloc (size);
......
...@@ -6,7 +6,11 @@ extern "C" int printf (const char *, ...); ...@@ -6,7 +6,11 @@ extern "C" int printf (const char *, ...);
extern "C" void *malloc (std::size_t); extern "C" void *malloc (std::size_t);
std::size_t s; std::size_t s;
void * operator new (std::size_t siz) throw (std::bad_alloc) { void * operator new (std::size_t siz)
#if __cplusplus <= 199711L
throw (std::bad_alloc)
#endif
{
if (s == 0) if (s == 0)
s = siz; s = siz;
else else
......
...@@ -9,7 +9,11 @@ ...@@ -9,7 +9,11 @@
#include <stddef.h> #include <stddef.h>
#include <new> #include <new>
struct Foo { struct Foo {
#if __cplusplus <= 199711L
friend void* operator new(size_t) throw (std::bad_alloc); friend void* operator new(size_t) throw (std::bad_alloc);
#else
friend void* operator new(size_t);
#endif
friend void operator delete(void*) throw (); friend void operator delete(void*) throw ();
Foo(); Foo();
~Foo(); ~Foo();
......
...@@ -8,7 +8,11 @@ int fail = 1; ...@@ -8,7 +8,11 @@ int fail = 1;
int in_main = 0; int in_main = 0;
void *operator new(size_t size) throw (std::bad_alloc) { void *operator new(size_t size)
#if __cplusplus <= 199711L
throw (std::bad_alloc)
#endif
{
if (!in_main) return malloc (size); if (!in_main) return malloc (size);
--fail; --fail;
return (void*) 0; return (void*) 0;
......
...@@ -6,7 +6,11 @@ ...@@ -6,7 +6,11 @@
extern "C" void _exit(int); extern "C" void _exit(int);
void* operator new(std::size_t sz) throw (std::bad_alloc) { void* operator new(std::size_t sz)
#if __cplusplus <= 199711L
throw (std::bad_alloc)
#endif
{
void* p = 0; void* p = 0;
_exit(0); _exit(0);
return p; return p;
......
...@@ -8,7 +8,10 @@ extern "C" void *malloc (size_t); ...@@ -8,7 +8,10 @@ extern "C" void *malloc (size_t);
int special; int special;
int space = 0xdeadbeef; int space = 0xdeadbeef;
void *operator new (size_t size) throw (bad_alloc) void *operator new (size_t size)
#if __cplusplus <= 199711L
throw (std::bad_alloc)
#endif
{ {
if (special) if (special)
return &space; return &space;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment