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/template/crash53.C: Likewise.
* g++.dg/template/void9.C: Likewise.
int ret = 1;
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);
return ptr;
#include <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)
abort();
return operator new (bytes);
struct A
{
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);
};
+
+// 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:" }
}
};
+// It's OK to error or not on line 6.
+// { dg-prune-output ":6:" }
// 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" static void c(); // { dg-error "linkage" }
extern "C" extern void d(); // { dg-error "linkage" }
int foo()
{
- typedef auto int bar; // { dg-error "conflicting" }
+ typedef auto int bar; // { dg-error "conflicting|two or more data types" }
}
// 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 <static int T> struct C {}; // { dg-error "storage class specified" }
template <register int T> struct D {}; // { dg-error "storage class specified" }
void foo()
{
__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'" } */
register __thread int l4; /* { dg-error "multiple storage classes" } */
}
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" } */
}
{
std::auto_ptr<A> p;
};
+
+// { dg-prune-output "auto_ptr. is deprecated" }
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.
p = malloc (s);
// track new and delete
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);
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;
B::B(A) { }
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;
return (void *) std::malloc (size);
B::B(A) { throw 1; }
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;
return (void *) std::malloc (size);
extern "C" void *malloc (std::size_t);
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)
s = siz;
else
#include <stddef.h>
#include <new>
struct Foo {
+#if __cplusplus <= 199711L
friend void* operator new(size_t) throw (std::bad_alloc);
+#else
+ friend void* operator new(size_t);
+#endif
friend void operator delete(void*) throw ();
Foo();
~Foo();
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);
--fail;
return (void*) 0;
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;
_exit(0);
return p;
int special;
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)
return &space;