+2011-11-09 Jason Merrill <jason@redhat.com>
+
+ * Makefile.def (language=c++): Remove check-c++0x.
+ * Makefile.in (check-gcc-c++): Regenerate.
+
2011-11-08 Richard Henderson <rth@redhat.com>
* configure.ac: Test for libitm directory present first.
dependencies = { module=configure-target-libgfortran; on=all-target-libquadmath; };
languages = { language=c; gcc-check-target=check-gcc; };
-languages = { language=c++; gcc-check-target="check-c++ check-c++0x";
+languages = { language=c++; gcc-check-target=check-c++;
lib-check-target=check-target-libstdc++-v3;
lib-check-target=check-target-libmudflap-c++; };
languages = { language=fortran; gcc-check-target=check-fortran;
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
- (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++ check-c++0x);
+ (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-c++);
check-c++: check-gcc-c++ check-target-libstdc++-v3 check-target-libmudflap-c++
.PHONY: check-gcc-fortran check-fortran
2011-11-09 Jason Merrill <jason@redhat.com>
+ * Make-lang.in (check_g++_parallelize): Add dg-torture.exp.
+ (check-c++0x): Obsolete.
+
* pt.c (invalid_nontype_parm_type_p): Avoid printing "<type error>".
* pt.c (convert_nontype_argument): Only integral arguments
check-c++ : check-g++
# Run the testsute in C++0x mode.
check-c++0x:
- $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) --extra_opts,-std=gnu++0x" \
- TESTSUITEDIR="$(TESTSUITEDIR).c++0x" check-g++
+ @echo Normal 'make check' now runs the testsuite in C++11 mode as well as C++98.
# Run the testsuite with garbage collection at every opportunity.
check-g++-strict-gc:
$(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) --extra_opts,--param,ggc-min-heapsize=0,--param,ggc-min-expand=0" \
lang_checks += check-g++
lang_checks_parallelized += check-g++
# For description see comment above check_gcc_parallelize in gcc/Makefile.in.
-check_g++_parallelize = old-deja.exp dg.exp
+check_g++_parallelize = old-deja.exp dg.exp dg-torture.exp
#\f
# Install hooks:
-2011-11-09 Jason Merrill <jason@redhat.com>
+2011-11-08 Jason Merrill <jason@redhat.com>
+
+ Run most C++ tests in both C++98 and C++11 modes.
+ * lib/target-supports.exp (check_effective_target_c++11): New.
+ (check_effective_target_c++98): New.
+ * lib/g++-dg.exp (g++-dg-runtest): New.
+ * g++.dg/dg.exp: Use g++-dg-runtest.
+ * g++.dg/charset/charset.exp: Likewise.
+ * g++.dg/debug/dwarf2/dwarf2.exp: Likewise.
+ * g++.dg/dfp/dfp.exp: Likewise.
+ * g++.dg/gcov/gcov.exp: Likewise.
+ * g++.dg/gomp/gomp.exp: Likewise.
+ * g++.dg/graphite/graphite.exp: Likewise.
+ * g++.dg/tls/tls.exp: Likewise.
+ * g++.dg/tm/tm.exp: Likewise.
+ * g++.dg/vect/vect.exp: Likewise.
+ * g++.old-deja/old-deja.exp: Likewise.
+ * g++.dg/simulate-thread/simulate-thread.exp: Pass -std flags
+ with some of the torture options.
+ * g++.dg/abi/mangle4.C: Move to template/nontype25.C.
+ * g++.dg/template/sfinae6_neg.C: Add C++11 error.
+ * g++.dg/init/null1.C: Only run in C++98.
+ * g++.dg/warn/Wconversion-null-3.C: Likewise.
+ * g++.old-deja/g++.benjamin/p12475.C: Likewise.
+ * g++.old-deja/g++.brendan/crash64.C: Likewise.
+ * g++.old-deja/g++.other/anon9.C: Likewise.
+ * g++.old-deja/g++.other/linkage1.C: Likewise.
+ * g++.old-deja/g++.other/linkage2.C: Likewise.
+ * g++.old-deja/g++.pt/t29.C: Likewise.
+ * g++.old-deja/g++.pt/t30.C: Likewise.
+ * g++.dg/cpp0x/variadic60.C: Only error in C++98.
+ * g++.dg/ext/anon-struct4.C: Likewise.
+ * g++.dg/init/brace2.C: Likewise.
+ * g++.dg/init/brace6.C: Likewise.
+ * g++.dg/other/anon3.C: Likewise.
+ * g++.dg/template/arg2.C: Likewise.
+ * g++.old-deja/g++.brendan/cvt1.C: Likewise.
+ * g++.old-deja/g++.brendan/enum11.C: Likewise.
+ * g++.old-deja/g++.brendan/enum8.C: Likewise.
+ * g++.old-deja/g++.brendan/enum9.C: Likewise.
+ * g++.old-deja/g++.brendan/friend3.C: Likewise.
+ * g++.old-deja/g++.brendan/init2.C: Likewise.
+ * g++.old-deja/g++.brendan/init4.C: Likewise.
+ * g++.old-deja/g++.brendan/misc14.C: Likewise.
+ * g++.old-deja/g++.jason/cond.C: Likewise.
+ * g++.old-deja/g++.law/init1.C: Likewise.
+ * g++.old-deja/g++.law/operators32.C: Likewise.
+ * g++.old-deja/g++.pt/enum6.C: Likewise.
+ * g++.old-deja/g++.pt/explicit70.C: Likewise.
+ * g++.old-deja/g++.pt/ptrmem6.C: Likewise.
* g++.dg/eh/new1.C: Adjust for C++11 mode.
* g++.dg/init/new11.C: Likewise.
dg-init
# Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,cc,S} ]] \
- "" $DEFAULT_CHARSETCFLAGS
+g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,cc,S} ]] \
+ $DEFAULT_CHARSETCFLAGS
# All done.
dg-finish
-template<typename... Args> class tuple; // { dg-error "variadic templates" }
+template<typename... Args> class tuple; // { dg-error "variadic templates" "" { target c++98 } }
if { ! [string match "*: target system does not support the * debug format*" \
$comp_output] } {
remove-build-file "trivial.S"
- dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C $srcdir/c-c++-common/dwarf2/*.c]] \
- "" $DEFAULT_CFLAGS
+ g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C $srcdir/c-c++-common/dwarf2/*.c]] \
+ $DEFAULT_CFLAGS
}
# All done.
dg-init
# Main loop. Run the tests that are specific to C++.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[C]] \
- "" $DEFAULT_CXXFLAGS
+g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[C]] \
+ $DEFAULT_CXXFLAGS
# Run tests that are shared with C testing.
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/dfp/*.c]] \
- "" $DEFAULT_CXXFLAGS
+g++-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/dfp/*.c]] \
+ $DEFAULT_CXXFLAGS
# All done.
dg-finish
# 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"
+ set DEFAULT_CXXFLAGS " -pedantic-errors -Wno-long-long"
}
# Initialize `dg'.
set tests [prune $tests $srcdir/$subdir/simulate-thread/*]
# Main loop.
-dg-runtest $tests "" $DEFAULT_CXXFLAGS
+g++-dg-runtest $tests $DEFAULT_CXXFLAGS
# C/C++ common tests.
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/*.\[cSi\]]] \
- "" ""
+g++-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/*.\[cSi\]]] \
+ ""
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cpp/*.\[cS\]]] \
- "" ""
+g++-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/cpp/*.\[cS\]]] \
+ ""
# All done.
// PR c++/14401
struct { struct { int& i ; } bar ; } foo ; // { dg-error "uninitialized" "uninit" }
-// { dg-warning "anonymous" "anon" { target *-*-* } 3 }
+// { dg-warning "anonymous" "anon" { target c++98 } 3 }
// { dg-message "should be initialized" "ref-uninit" { target *-*-* } 3 }
}
# Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] "" ""
+g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] ""
dg-finish
dg-init
# Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C $srcdir/c-c++-common/gomp/*.c]] "" "-fopenmp"
+g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C $srcdir/c-c++-common/gomp/*.c]] "-fopenmp"
# All done.
dg-finish
# Tests to be compiled.
set dg-do-what-default compile
-dg-runtest $scop_files "" "-O2 -fgraphite -fdump-tree-graphite-all"
-dg-runtest $id_files "" "-O2 -fgraphite-identity -ffast-math"
+g++-dg-runtest $scop_files "-O2 -fgraphite -fdump-tree-graphite-all"
+g++-dg-runtest $id_files "-O2 -fgraphite-identity -ffast-math"
# Tests to be run.
set dg-do-what-default run
-dg-runtest $run_id_files "" "-O2 -fgraphite-identity"
-dg-runtest $interchange_files "" "-O2 -floop-interchange -fno-loop-block -fno-loop-strip-mine -ffast-math -fdump-tree-graphite-all"
-dg-runtest $block_files "" "-O2 -floop-block -fno-loop-strip-mine -fno-loop-interchange -ffast-math -fdump-tree-graphite-all"
+g++-dg-runtest $run_id_files "-O2 -fgraphite-identity"
+g++-dg-runtest $interchange_files "-O2 -floop-interchange -fno-loop-block -fno-loop-strip-mine -ffast-math -fdump-tree-graphite-all"
+g++-dg-runtest $block_files "-O2 -floop-block -fno-loop-strip-mine -fno-loop-interchange -ffast-math -fdump-tree-graphite-all"
# The default action for the rest of the files is 'compile'.
set dg-do-what-default compile
foreach f $run_id_files {lremove wait_to_run_files $f}
foreach f $interchange_files {lremove wait_to_run_files $f}
foreach f $block_files {lremove wait_to_run_files $f}
-dg-runtest $wait_to_run_files "" "-ansi -pedantic-errors"
+g++-dg-runtest $wait_to_run_files " -pedantic-errors"
# Clean up.
set dg-do-what-default ${save-dg-do-what-default}
int a = 2;
int b = { 2,3 }; // { dg-error "requires one element in initializer" }
int c = { { 2 } } ; // { dg-error "braces around scalar initializer" }
-int d = {}; // { dg-error "initializer" }
+int d = {}; // { dg-error "initializer" "" { target c++98 } }
{
int i = { 1 };
int j = { 1, 2 }; /* { dg-error "requires one element" } */
- A a = { 6 }; /* { dg-error "initialize" } */
+ A a = { 6 }; /* { dg-error "initialize" "" { target c++98 } } */
B b = { 6 }; /* { dg-error "" } */
C c = { 6 }; /* { dg-error "too many initializers" } */
D d = { 6 };
// PR c++/16489
+// { dg-do compile { target c++98 } }
const int NULL = 0;
int main() {
- double* p = NULL;
+ double* p = NULL;
}
// { dg-do compile }
-enum { a = 3 } x; // { dg-warning "anonymous type" }
+enum { a = 3 } x; // { dg-warning "anonymous type" "" { target c++98 } }
set-torture-options [list \
{ -O0 -g } \
{ -O1 -g } \
- { -O2 -g } \
- { -O3 -g } \
+ { -O2 -g -std=c++98 } \
+ { -O3 -g -std=c++11 } \
{ -Os -g } ]
if [gdb-exists] {
void fn ()
{
class L {};
- X<L> f; // { dg-error "uses local type|trying to instantiate|no type|invalid type" "" }
+ X<L> f; // { dg-error "uses local type|trying to instantiate|no type|invalid type" "" { target c++98 } }
}
-// Test mangling of type casts
// { dg-do compile }
class A {};
template<const B* b> class D {};
template<B* b> class E {};
-template<const B* b> void f(D<b> &, C<static_cast<const A*>(b)> &) {} // { dg-error "" }
-template<const B* b> void g(D<b> &, E<const_cast<B*>(b)> &) {} // { dg-error "" }
+template<const B* b> void f(D<b> &, C<static_cast<const A*>(b)> &) {} // { dg-error "" "" { target c++98 } }
+template<const B* b> void g(D<b> &, E<const_cast<B*>(b)> &) {} // { dg-error "" "" { target c++98 } }
B b;
{
C<static_cast<const A*>(&b)> c; // { dg-error "" }
D<&b> d;
- E<const_cast<B*>(&b)> e; // { dg-error "" }
- f(d, c);
+ E<const_cast<B*>(&b)> e; // { dg-error "" "" { target c++98 } }
+ f(d, c); // { dg-error "" "" { target c++11 } }
g(d, e);
}
-
template<typename F, typename T1, typename T2>
typename enable_if<sizeof(create_a<F>()(create_a<T1>(), create_a<T2>()), 1),
yes_type>::type
- check_is_callable2(type<F>, type<T1>, type<T2>);
+ check_is_callable2(type<F>, type<T1>, type<T2>); // { dg-error "within this context" "" { target c++11 } }
no_type check_is_callable2(...);
# 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"
+ set DEFAULT_CXXFLAGS " -pedantic-errors -Wno-long-long"
}
# Initialize `dg'.
dg-init
# Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] "" $DEFAULT_CXXFLAGS
+g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] $DEFAULT_CXXFLAGS
# All done.
dg-finish
# 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"
+ set DEFAULT_CXXFLAGS " -pedantic-errors -Wno-long-long"
}
# Initialize `dg'.
dg-init
# Run the tests that are shared with C.
-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/tm/*.c]] \
- "" $DEFAULT_CXXFLAGS
+g++-dg-runtest [lsort [glob -nocomplain $srcdir/c-c++-common/tm/*.c]] \
+ $DEFAULT_CXXFLAGS
# Run the C++ only tests.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] \
- "" $DEFAULT_CXXFLAGS
+g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] \
+ $DEFAULT_CXXFLAGS
# All done.
dg-finish
dg-init
# Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.{c,cc,S} ]] \
- "" $DEFAULT_VECTCFLAGS
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-pr*.{c,cc,S} ]] \
- "" $VECT_SLP_CFLAGS
+g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.{c,cc,S} ]] \
+ $DEFAULT_VECTCFLAGS
+g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-pr*.{c,cc,S} ]] \
+ $VECT_SLP_CFLAGS
#### Tests with special options
global SAVED_DEFAULT_VECTCFLAGS
# --param max-aliased-vops=0
set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
lappend DEFAULT_VECTCFLAGS "--param max-aliased-vops=0"
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/param-max-aliased*.\[cS\]]] \
- "" $DEFAULT_VECTCFLAGS
+g++-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/param-max-aliased*.\[cS\]]] \
+ $DEFAULT_VECTCFLAGS
# Clean up.
set dg-do-what-default ${save-dg-do-what-default}
// PR c++/48420
+// { dg-do compile { target c++98 } }
void foo(int* p);
-// { dg-do assemble }
+// { dg-do assemble { target c++98 } }
// prms-id: 12475
#include <limits.h>
-// { dg-do assemble }
+// { dg-do assemble { target c++98 } }
// GROUPS passed old-abort
typedef __SIZE_TYPE__ size_t;
typedef void (*RF_Ptr)(void *);
class Thing
{
public:
- typedef enum { GOOD_THING, BAD_THING, } ThingType ; // { dg-error "" } comma
+ typedef enum { GOOD_THING, BAD_THING, } ThingType ; // { dg-error "" "comma" { target c++98 } }
Thing (ThingType type) : thingType (type) { }
~Thing () { }
private:
class Group
{
public:
- typedef enum { THIS_GROUP, THAT_GROUP, } GroupType ; // { dg-error "" } comma
+ typedef enum { THIS_GROUP, THAT_GROUP, } GroupType ; // { dg-error "" "comma" { target c++98 } }
Group (GroupType type) : groupType (type), groupCount (0) { }
~Group () { }
void append (Thing* const &entry) { groupCount ++ ; }
{
oneMask = 0x0000FFFF,
twoMask = 0x000F0000,
- thiMask = 0xFFF00000, // { dg-error "comma at end" }
+ thiMask = 0xFFF00000, // { dg-error "comma at end" "" { target c++98 } }
};
unsigned int foo;
enum foo1_enum
{
ENUM1,
- ENUM2, // { dg-error "comma at end" }
+ ENUM2, // { dg-error "comma at end" "" { target c++98 } }
};
};
// GROUPS passed enums
enum fig {
figgy,
- pudding, // { dg-error "comma at end" }
+ pudding, // { dg-error "comma at end" "" { target c++98 } }
};
class X {
friend class A;
enum {
- bEnum = 1, // { dg-error "comma at end" }
+ bEnum = 1, // { dg-error "comma at end" "" { target c++98 } }
};
int bArray[ bEnum ];
// GROUPS passed initialization
// this should give an error in require_required_type about not
// being allowed to have an initializer list in an argument list.
-int f(int a = {1});// { dg-error "" } .*
+int f(int a = {1});// { dg-error "" "" { target c++98 } }
// GROUPS passed initialization
struct CharList { int i; };
-const CharList& terminals = { 1 }; // { dg-error "initializer lists" } c++0x
+const CharList& terminals = { 1 }; // { dg-error "initializer lists" "" { target c++98 } }
public:
enum e {
New // { dg-error "conflicts with previous" }
- , // { dg-error "comma at end" }
+ , // { dg-error "comma at end" "" { target c++98 } }
};
static int New(int); // { dg-error "declaration of" }
// { dg-error "is initialized like a variable" "var" { target *-*-* } 51 }
;
- if (int a[2] = {1, 2}) // { dg-error "extended init" }
+ if (int a[2] = {1, 2}) // { dg-error "extended init" "" { target c++98 } }
;
}
class bar {
public:
- 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;
+ foo f[3] = { 1, 2, 3 }; // works: f[0] = 1, f[1] = 2, f[2] = 3 // { dg-error "" "" { target c++98 } } ANSI C++ forbids initialization of member f;
};
class bar2 {
public:
- foo f[3] = { foo(1), foo(2), foo(3) }; // { dg-error "" } ANSI C++ forbids initialization of member f;
+ foo f[3] = { foo(1), foo(2), foo(3) }; // { dg-error "" "" { target c++98 } } ANSI C++ forbids initialization of member f;
// does not compile -- error: field initializer is not constant
};
//
template <class T>
-void ffree(long rows, T** array) // { dg-message "note" }
+void ffree(long rows, T** array)
{
for( long i = 0; i < rows; i++ )
delete [] array[i]; // delete row
}
template <class T>
-T** allocate2d(long d1, long d2, T**& array) // { dg-message "note" }
+T** allocate2d(long d1, long d2, T**& array)
{
if( allocate1d(d1, array) != 0 )
{
};
foo **f2;
-allocate2d(d1, d2, f2);// { dg-error "" } type.*// ERROR - trying to.*
-// { dg-message "candidate" "candidate note" { target *-*-* } 52 }
-ffree(d1, f2);// { dg-error "" } type.*// ERROR - trying to.*
-// { dg-message "candidate" "candidate note" { target *-*-* } 54 }
+allocate2d(d1, d2, f2);// { dg-error "" "" { target c++98 } }
+ffree(d1, f2);// { dg-error "" "" { target c++98 } }
}
-// { dg-do assemble }
+// { dg-do assemble { target c++98 } }
// Test that we properly diagnose an attempt to use an anonymous class
// in declaring an external function.
-// { dg-do assemble }
+// { dg-do assemble { target c++98 } }
typedef struct {
int i;
} *p;
-// { dg-do assemble }
+// { dg-do assemble { target c++98 } }
// From: Klaus-Georg Adams <Klaus-Georg.Adams@chemie.uni-karlsruhe.de>
extern "C"
{
{
enum tern { H, L, X, U };
- vector<tern> ternvec; // { dg-error "" } composed from a local type
+ vector<tern> ternvec; // { dg-error "" "" { target c++98 } } composed from a local type
}
template void fn(int);
template class S<double>;
template class S<double>; // { dg-error "duplicate explicit instantiation" }
-extern template void f(double); // { dg-error "extern" } extern not allowed
+extern template void f(double); // { dg-error "extern" "" { target c++98 } }
inline template class S<float>; // { dg-error "inline" } inline not allowed
template <class T>
};
template <void (A::*)() >
-void g() {} // { dg-message "void g" }
+void g() {}
template <int A::*>
-void h() {} // { dg-message "void h" }
+void h() {}
int main() {
g<&A::f>();
h<&A::i>();
g<&B::f>(); // { dg-error "" }
- // { dg-message "candidate" "candidate note" { target *-*-* } 24 }
h<&B::j>(); // { dg-error "" }
- // { dg-message "candidate" "candidate note" { target *-*-* } 26 }
- g<(void (A::*)()) &A::f>(); // { dg-error "" }
- // { dg-message "candidate" "candidate note" { target *-*-* } 28 }
- h<(int A::*) &A::i>(); // { dg-error "" }
- // { dg-message "candidate" "candidate note" { target *-*-* } 30 }
+ g<(void (A::*)()) &A::f>(); // { dg-error "" "" { xfail c++11 } }
+ h<(int A::*) &A::i>(); // { dg-error "" "" { xfail c++11 } }
g<(void (A::*)()) &B::f>(); // { dg-error "" }
- // { dg-message "candidate" "candidate note" { target *-*-* } 32 }
h<(int A::*) &B::j>(); // { dg-error "" }
- // { dg-message "candidate" "candidate note" { target *-*-* } 34 }
- g<(void (A::*)()) 0>(); // { dg-error "" }
- // { dg-message "candidate" "candidate note" { target *-*-* } 36 }
- h<(int A::*) 0>(); // { dg-error "" }
- // { dg-message "candidate" "candidate note" { target *-*-* } 38 }
+ g<(void (A::*)()) 0>(); // { dg-error "" "" { target c++98 } }
+ h<(int A::*) 0>(); // { dg-error "" "" { target c++98 } }
return 0;
}
-// { dg-do assemble }
+// { dg-do assemble { target c++98 } }
template <class X, int n> X f (auto X (*x)[n]) { return (*x)[n/2]; }
extern int i[30];
-// { dg-do assemble }
+// { dg-do assemble { target c++98 } }
template <class X, int n> X f (auto X (*x)[n]) { return (*x)[n/2]; }
extern int i[30], i2[33];
# 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"
+ set DEFAULT_CXXFLAGS " -pedantic-errors -Wno-long-long"
}
# Initialize `dg'.
set tests [lsort [find $srcdir/$subdir *.C]]
# Main loop.
-dg-runtest $tests "" $DEFAULT_CXXFLAGS
+g++-dg-runtest $tests $DEFAULT_CXXFLAGS
# All done.
dg-finish
proc g++-dg-prune { system text } {
return [gcc-dg-prune $system $text]
}
+
+# Modified dg-runtest that runs tests in both C++98 and C++11 modes
+# unless they specifically specify one or the other.
+proc g++-dg-runtest { testcases default-extra-flags } {
+ global runtests
+
+ foreach test $testcases {
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $test] {
+ continue
+ }
+
+ # If the testcase specifies a standard, use that one.
+ # If not, run it under both standards, allowing GNU extensions
+ # if there's a dg-options line.
+ if ![search_for $test "-std=*++"] {
+ if [search_for $test "dg-options"] {
+ set option_list { -std=gnu++98 -std=gnu++11 }
+ } else {
+ set option_list { -std=c++98 -std=c++11 }
+ }
+ } else {
+ set option_list { "" }
+ }
+
+ set nshort [file tail [file dirname $test]]/[file tail $test]
+
+ foreach flags $option_list {
+ verbose "Testing $nshort, $flags" 1
+ dg-test $test $flags ${default-extra-flags}
+ }
+ }
+}
return 0
}
+# Check which language standard is active by checking for the presence of
+# one of the C++11 -std flags. This assumes that the default for the
+# compiler is C++98, and that there will never be multiple -std= arguments
+# on the command line.
+proc check_effective_target_c++11 { } {
+ if ![check_effective_target_c++] {
+ return 0
+ }
+ return [check-flags { { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }]
+}
+
+proc check_effective_target_c++98 { } {
+ if ![check_effective_target_c++] {
+ return 0
+ }
+ return [check-flags { { } { } { } { -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11 } }]
+}
+
# Return 1 if expensive testcases should be run.
proc check_effective_target_run_expensive_tests { } {