diff options
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/error2.C | 9 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/graphite/graphite.exp | 61 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/koenig8.C | 14 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/name-clash4.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/crash53.C | 13 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/error17.C | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/tc1/dr147.C | 22 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/dtor7.C | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/explicit-args2.C | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/spec15.C | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/stmtexpr2.C | 26 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr42183.C | 51 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/tree-ssa/pr41905.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/tree-ssa/pr41906.C | 12 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/tree-ssa/pr41961.C | 15 |
15 files changed, 230 insertions, 18 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/error2.C b/gcc/testsuite/g++.dg/cpp0x/error2.C new file mode 100644 index 00000000000..ca681eb2f79 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/error2.C @@ -0,0 +1,9 @@ +// PR c++/38656 +// { dg-options "-std=c++0x" } + +template<int> int foo(); + +template<typename F> void bar(F f) +{ + f((foo<0>()=0)...); // { dg-error "pattern '\\(foo\\<0\\>\\)\\(\\)=0'" } +} diff --git a/gcc/testsuite/g++.dg/graphite/graphite.exp b/gcc/testsuite/g++.dg/graphite/graphite.exp index d1993a2e805..ba7c8ccec89 100644 --- a/gcc/testsuite/g++.dg/graphite/graphite.exp +++ b/gcc/testsuite/g++.dg/graphite/graphite.exp @@ -23,23 +23,68 @@ if ![check_effective_target_fgraphite] { return } +# Remove VALUE from LIST_VARIABLE. +proc lremove {list_variable value} { + upvar 1 $list_variable var + set idx [lsearch -exact $var $value] + set var [lreplace $var $idx $idx] +} + # The default action for a test is 'compile'. Save current default. global dg-do-what-default set save-dg-do-what-default ${dg-do-what-default} set dg-do-what-default compile -# If a testcase doesn't have special options, use these. -global DEFAULT_CFLAGS -if ![info exists DEFAULT_CFLAGS] then { - set DEFAULT_CFLAGS " -ansi -pedantic-errors" -} - # Initialize `dg'. dg-init # Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.C]] \ - "" $DEFAULT_CFLAGS + +set wait_to_run_files [lsort [glob -nocomplain $srcdir/$subdir/*.C ] ] + +# Flags using for block-* files. +set DEFAULT_FLAGS_GRAPHITE_BLOCK "-O2 -floop-block -fno-loop-strip-mine \ + -fno-loop-interchange -fdump-tree-graphite-all" +set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.C ] ] +dg-runtest $block_files "" $DEFAULT_FLAGS_GRAPHITE_BLOCK +foreach block_file $block_files {lremove wait_to_run_files $block_file} + +# Flags using for id-* files. +set DEFAULT_FLAGS_GRAPHITE_IDENTITY "-O2 -fgraphite-identity" +set id_files [lsort [glob -nocomplain $srcdir/$subdir/id-*.C ] ] +dg-runtest $id_files "" $DEFAULT_FLAGS_GRAPHITE_IDENTITY +foreach id_file $id_files {lremove wait_to_run_files $id_file} + +# Flags using for interchange-* files. +set DEFAULT_FLAGS_GRAPHITE_INTERCHANGE "-O2 -fdump-tree-graphite-all \ + -floop-interchange -fno-loop-block -fno-loop-strip-mine -ffast-math" +set interchange_files [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.C ] ] +dg-runtest $interchange_files "" $DEFAULT_FLAGS_GRAPHITE_INTERCHANGE +foreach interchange_file $interchange_files {lremove wait_to_run_files $interchange_file} + +# Flags using for scop-* files. +set DEFAULT_FLAGS_GRAPHITE_SCOP "-O2 -fgraphite -fdump-tree-graphite-all" +set scop_files [lsort [glob -nocomplain $srcdir/$subdir/scop-*.C ] ] +dg-runtest $scop_files "" $DEFAULT_FLAGS_GRAPHITE_SCOP +foreach scop_file $scop_files {lremove wait_to_run_files $scop_file} + + +# Schedule now the tests to be run. +set dg-do-what-default run + +# Flags using for run-id-* files. +set DEFAULT_FLAGS_RUN_ID "-O2 -fgraphite-identity" +set run_id_files [lsort [glob -nocomplain $srcdir/$subdir/run-id-*.C ] ] +dg-runtest $run_id_files "" $DEFAULT_FLAGS_RUN_ID +foreach run_id_file $run_id_files {lremove wait_to_run_files $run_id_file} + + +# The default action for the rest of the files is 'compile'. +set dg-do-what-default compile + +# Flags using for other files. +set DEFAULT_FLAGS_GRAPHITE "-ansi -pedantic-errors" +dg-runtest $wait_to_run_files "" $DEFAULT_FLAGS_GRAPHITE # Clean up. set dg-do-what-default ${save-dg-do-what-default} diff --git a/gcc/testsuite/g++.dg/lookup/koenig8.C b/gcc/testsuite/g++.dg/lookup/koenig8.C new file mode 100644 index 00000000000..b5558552dc5 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/koenig8.C @@ -0,0 +1,14 @@ +// PR c++/42026, DR 239 +// The local extern declaration prevents arg-dependent lookup. +// { dg-do link } + +namespace NS { + class T { }; + void g(T, int); +} +NS::T parm; +void g(NS::T, float) { } +int main() { + extern void g(NS::T, float); + g(parm, 1); +} diff --git a/gcc/testsuite/g++.dg/lookup/name-clash4.C b/gcc/testsuite/g++.dg/lookup/name-clash4.C index d6c6d97bbc1..490f7500ec6 100644 --- a/gcc/testsuite/g++.dg/lookup/name-clash4.C +++ b/gcc/testsuite/g++.dg/lookup/name-clash4.C @@ -9,4 +9,4 @@ struct A template<int> struct A {}; // { dg-error "same name" } }; -A::A<0> a; // { dg-error "not a template|invalid use of constructor" } +A::A<0> a; // { dg-error "not a template|constructor" } diff --git a/gcc/testsuite/g++.dg/parse/crash53.C b/gcc/testsuite/g++.dg/parse/crash53.C new file mode 100644 index 00000000000..de6d412f1d1 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/crash53.C @@ -0,0 +1,13 @@ +// PR c++/35112 + +namespace X { struct A; } // { dg-error "struct X::A" } +namespace Y { struct A; } // { dg-error "struct Y::A" } +namespace Z { struct A; } // { dg-error "struct Z::A" } +namespace W { struct A; } // { dg-error "struct W::A" } + +using namespace X; +using namespace Y; +using namespace Z; +using namespace W; + +A* p; // { dg-error "reference to 'A' is ambiguous|'A' does not name a type" } diff --git a/gcc/testsuite/g++.dg/parse/error17.C b/gcc/testsuite/g++.dg/parse/error17.C index 4cd4044e3d0..b308c912f1e 100644 --- a/gcc/testsuite/g++.dg/parse/error17.C +++ b/gcc/testsuite/g++.dg/parse/error17.C @@ -2,10 +2,8 @@ // PR c++/16965 template <typename T> struct B { - static int Bar(T); // { dg-error "14:candidates are: " "1" } - // { dg-error "14:with T = int" "2" { target *-*-* } 5 } + static int Bar(T); // { dg-error "14:candidates are: |with T = int" } }; struct D : B<int>, B<char> {}; -int i2 = D::Bar(2); // { dg-error "13:reference to 'Bar' is ambiguous" } -// { dg-error "10:reference to 'Bar' is ambiguous" "2" { target *-*-* } 10 } +int i2 = D::Bar(2); // { dg-error "10:reference to 'Bar' is ambiguous" } diff --git a/gcc/testsuite/g++.dg/tc1/dr147.C b/gcc/testsuite/g++.dg/tc1/dr147.C index 9c90d982f5f..9006be9e180 100644 --- a/gcc/testsuite/g++.dg/tc1/dr147.C +++ b/gcc/testsuite/g++.dg/tc1/dr147.C @@ -11,8 +11,12 @@ A::A() { } B::B() { } B::A ba; -A::A a; // { dg-error "" "the injected-class-name can never be found through qualified lookup" } +A::A a; // { dg-error "constructor" "the injected-class-name can never be found through qualified lookup" } +void f() +{ + A::A a; // { dg-error "constructor" } +} // { dg-error "" "" { target *-*-* } 18 } error cascade } namespace N2 { @@ -26,6 +30,22 @@ template <class T> struct A { template <class T2> A(T2); static A x; }; +template<> template <> A<char>::A<char>(char); template<> A<int>::A<int>(A<int>::x); // { dg-error "" "this is an invalid declaration of the constructor" } } + +// But DR 318 says that in situations where a type is syntactically +// required, lookup finds it. + +struct C +{ + C(); + typedef int T; +}; +struct C::C c; +C::C::T t; +struct D: C::C +{ + D(): C::C() { } +}; diff --git a/gcc/testsuite/g++.dg/template/dtor7.C b/gcc/testsuite/g++.dg/template/dtor7.C index 0dac69e8948..e96f56397eb 100644 --- a/gcc/testsuite/g++.dg/template/dtor7.C +++ b/gcc/testsuite/g++.dg/template/dtor7.C @@ -1,10 +1,10 @@ // PR c++/40373 // { dg-compile } -struct A; // { dg-bogus "candidates are" "" { xfail *-*-* } } +struct A; namespace { - struct A; // { dg-bogus "struct" "" { xfail *-*-* } } + struct A; } struct B {}; @@ -20,5 +20,3 @@ bar () { foo (B ()); // { dg-bogus "instantiated from here" "" { xfail *-*-* } } } - -// { dg-bogus "is ambiguous" "" { xfail *-*-* } 15 } diff --git a/gcc/testsuite/g++.dg/template/explicit-args2.C b/gcc/testsuite/g++.dg/template/explicit-args2.C index cd53b456dcc..d37b734202d 100644 --- a/gcc/testsuite/g++.dg/template/explicit-args2.C +++ b/gcc/testsuite/g++.dg/template/explicit-args2.C @@ -1,6 +1,8 @@ // PR c++/37177 // { dg-options -std=c++0x } +#include <typeinfo> + namespace N1 { template<class T> bool foo(); @@ -21,18 +23,22 @@ int main() { (void)(&S::bar<int>); decltype(&S::bar<int>) a; + typeid(&S::bar<int>); (void*)(&S::foo<int>); (void)(&S::foo<int>); decltype(&S::foo<int>) b; + typeid(&S::foo<int>); (void*)(&N1::foo<int>); (void)(&N1::foo<int>); decltype(&N1::foo<int>) c; + typeid(&N1::foo<int>); (void*)(&foo<int>); (void)(&foo<int>); decltype(&foo<int>) d; + typeid(&foo<int>); &foo<int> == 0; } diff --git a/gcc/testsuite/g++.dg/template/spec15.C b/gcc/testsuite/g++.dg/template/spec15.C index fcf4ecb904d..37fbc08e37e 100644 --- a/gcc/testsuite/g++.dg/template/spec15.C +++ b/gcc/testsuite/g++.dg/template/spec15.C @@ -19,6 +19,7 @@ struct A<float> { }; template <> void A<int>::f (int); // { dg-error "" } +// { dg-message "need 2" "" { target *-*-* } 21 } template <> template <> void A<int>::f (int); template <> void A<int>::f2 (int); diff --git a/gcc/testsuite/g++.dg/template/stmtexpr2.C b/gcc/testsuite/g++.dg/template/stmtexpr2.C new file mode 100644 index 00000000000..ef29b43c59f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/stmtexpr2.C @@ -0,0 +1,26 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin: PR c++/36408 +// { dg-options "" } +// { dg-do compile } + +template<int> +void +foo() +{ + int i = ({ }); // { dg-error "void value not ignored" } +} + +template<int> +void +bar() +{ + int i = ({ ({}); }); // { dg-error "void value not ignored" } +} + +int +main () +{ + foo<0> (); + bar<0> (); +} + diff --git a/gcc/testsuite/g++.dg/torture/pr42183.C b/gcc/testsuite/g++.dg/torture/pr42183.C new file mode 100644 index 00000000000..375b37f0c66 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr42183.C @@ -0,0 +1,51 @@ +// { dg-do compile } + +class IntSize { +public: + IntSize(int width, int height) : m_width(width), m_height(height) { } + int m_width, m_height; +}; +class IntPoint { +public: + IntPoint(int x, int y) : m_x(x), m_y(y) { } + int m_x, m_y; +}; +class IntRect { +public: + IntRect(int x, int y, int width, int height) + : m_location(IntPoint(x, y)), m_size(IntSize(width, height)) { } + void intersect(const IntRect&); + IntPoint m_location; + IntSize m_size; +}; +inline IntRect intersection(const IntRect& a, const IntRect& b) { + IntRect c = a; + c.intersect(b); + return c; +} +class RenderObject { +public: + int contentWidth() const { } + int contentHeight() const { } + virtual int xPos() const { } + virtual int yPos() const { } + virtual int paddingTop() const; + virtual int paddingLeft() const; + virtual int borderTop() const { } + virtual int borderLeft() const { } +}; +class RenderMenuList : public RenderObject { + virtual IntRect controlClipRect(int tx, int ty) const; + RenderObject* m_innerBlock; +}; +IntRect RenderMenuList::controlClipRect(int tx, int ty) const { + IntRect outerBox(tx + borderLeft() + paddingLeft(), + ty + borderTop() + paddingTop(), + contentWidth(), contentHeight()); + IntRect innerBox(tx + m_innerBlock->xPos() + m_innerBlock->paddingLeft(), + ty + m_innerBlock->yPos() + m_innerBlock->paddingTop(), + m_innerBlock->contentWidth(), + m_innerBlock->contentHeight()); + return intersection(outerBox, innerBox); +} + diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr41905.C b/gcc/testsuite/g++.dg/tree-ssa/pr41905.C new file mode 100644 index 00000000000..4424ce8d23d --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr41905.C @@ -0,0 +1,4 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +int foo() __attribute__((noreturn)); +int bar() { return foo(); } diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr41906.C b/gcc/testsuite/g++.dg/tree-ssa/pr41906.C new file mode 100644 index 00000000000..321d33aeace --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr41906.C @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-fpermissive -w" } */ +/* We aren't interested in the warning, but in the ICE. */ +void foo(); +extern void abort (void); + +void bar() +{ + try { foo(); } + catch (...) {} + catch (int) {abort ();} +} diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr41961.C b/gcc/testsuite/g++.dg/tree-ssa/pr41961.C new file mode 100644 index 00000000000..229e7d4b939 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr41961.C @@ -0,0 +1,15 @@ +// { dg-do compile } +// { dg-require-effective-target pthread } +// { dg-options "-O3 -ftree-parallelize-loops=2" } + +struct A +{ + char c[17]; + void foo(); +}; + +void A::foo() +{ + for (int i = 0; i < 17; ++i) + c[i] = 0; +} |