diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/other')
-rw-r--r-- | gcc/testsuite/g++.dg/other/anon3.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/first-global.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/i386-2.C | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/i386-3.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/i386-5.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/i386-6.C | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/i386-7.C | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/linkage2.C | 31 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/offsetof6.C | 26 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/ptrmem10.C | 29 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/ptrmem11.C | 21 |
11 files changed, 95 insertions, 41 deletions
diff --git a/gcc/testsuite/g++.dg/other/anon3.C b/gcc/testsuite/g++.dg/other/anon3.C index 87cbfb544cd..87116eb8901 100644 --- a/gcc/testsuite/g++.dg/other/anon3.C +++ b/gcc/testsuite/g++.dg/other/anon3.C @@ -4,4 +4,4 @@ // { dg-do compile } -enum { a = 3 } x; +enum { a = 3 } x; // { dg-warning "anonymous type" } diff --git a/gcc/testsuite/g++.dg/other/first-global.C b/gcc/testsuite/g++.dg/other/first-global.C index a993a9d5175..0f39a8abb73 100644 --- a/gcc/testsuite/g++.dg/other/first-global.C +++ b/gcc/testsuite/g++.dg/other/first-global.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-fpie" { target { ! nonpic } } } */ +/* { dg-add-options bind_pic_locally } */ /* { dg-final { scan-assembler "_GLOBAL__I(_|_65535_0_)foobar" } } */ struct foo { foo (); }; diff --git a/gcc/testsuite/g++.dg/other/i386-2.C b/gcc/testsuite/g++.dg/other/i386-2.C index 4c9579d07cd..1ef6b2775d8 100644 --- a/gcc/testsuite/g++.dg/other/i386-2.C +++ b/gcc/testsuite/g++.dg/other/i386-2.C @@ -1,8 +1,9 @@ -/* Test that {,x,e,p,t,s,w,a,i}mmintrin.h, fma4intrin.h, mm3dnow.h and +/* Test that {,x,e,p,t,s,w,a,i}mmintrin.h, fma4intrin.h, xopintrin.h, mm3dnow.h and mm_malloc.h are usable with -O -pedantic-errors. */ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ -/* { dg-options "-O -pedantic-errors -march=k8 -m3dnow -mavx -msse4a -mfma4 -maes -mpclmul" } */ +/* { dg-options "-O -pedantic-errors -march=k8 -m3dnow -mavx -msse4a -mfma4 -mxop -maes -mpclmul" } */ #include <x86intrin.h> int dummy; + diff --git a/gcc/testsuite/g++.dg/other/i386-3.C b/gcc/testsuite/g++.dg/other/i386-3.C index b9e89169ccb..df33af8bbd9 100644 --- a/gcc/testsuite/g++.dg/other/i386-3.C +++ b/gcc/testsuite/g++.dg/other/i386-3.C @@ -1,6 +1,6 @@ -/* Test that {,x,e,p,t,s,w,a,i}mmintrin.h, fma4intrin.h, mm3dnow.h and +/* Test that {,x,e,p,t,s,w,a,i}mmintrin.h, fma4intrin.h, mm3dnow.h, xopintrin.h and mm_malloc.h are usable with -O -fkeep-inline-functions. */ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ -/* { dg-options "-O -fkeep-inline-functions -march=k8 -m3dnow -mavx -msse4a -mfma4 -maes -mpclmul" } */ +/* { dg-options "-O -fkeep-inline-functions -march=k8 -m3dnow -mavx -msse4a -mfma4 -mxop -maes -mpclmul" } */ #include <x86intrin.h> diff --git a/gcc/testsuite/g++.dg/other/i386-5.C b/gcc/testsuite/g++.dg/other/i386-5.C index 6dcb2d3b0d0..383aae365bb 100644 --- a/gcc/testsuite/g++.dg/other/i386-5.C +++ b/gcc/testsuite/g++.dg/other/i386-5.C @@ -1,6 +1,6 @@ -/* Test that {,x,e,p,t,s,w,a,i}mmintrin.h, fma4intrin.h, mm3dnow.h and +/* Test that {,x,e,p,t,s,w,a,i}mmintrin.h, fma4intrin.h, xopintrin.h, mm3dnow.h and mm_malloc.h are usable with -O -fkeep-inline-functions. */ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ -/* { dg-options "-O -fkeep-inline-functions -march=k8 -m3dnow -mavx -msse4a -mfma4 -maes -mpclmul" } */ +/* { dg-options "-O -fkeep-inline-functions -march=k8 -m3dnow -mavx -msse4a -mfma4 -mxop -maes -mpclmul" } */ #include <x86intrin.h> diff --git a/gcc/testsuite/g++.dg/other/i386-6.C b/gcc/testsuite/g++.dg/other/i386-6.C index 4c9579d07cd..2bd4609d671 100644 --- a/gcc/testsuite/g++.dg/other/i386-6.C +++ b/gcc/testsuite/g++.dg/other/i386-6.C @@ -1,7 +1,7 @@ -/* Test that {,x,e,p,t,s,w,a,i}mmintrin.h, fma4intrin.h, mm3dnow.h and +/* Test that {,x,e,p,t,s,w,a,i}mmintrin.h, fma4intrin.h, xopintrin.h, mm3dnow.h and mm_malloc.h are usable with -O -pedantic-errors. */ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ -/* { dg-options "-O -pedantic-errors -march=k8 -m3dnow -mavx -msse4a -mfma4 -maes -mpclmul" } */ +/* { dg-options "-O -pedantic-errors -march=k8 -m3dnow -mavx -msse4a -mfma4 -mxop -maes -mpclmul" } */ #include <x86intrin.h> diff --git a/gcc/testsuite/g++.dg/other/i386-7.C b/gcc/testsuite/g++.dg/other/i386-7.C new file mode 100644 index 00000000000..e2ad51e528d --- /dev/null +++ b/gcc/testsuite/g++.dg/other/i386-7.C @@ -0,0 +1,8 @@ +/* Test that x86intrin.h is usable with -O -pedantic-errors. */ +/* We were using SSE4.2 builtins without the extension available. */ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O -pedantic-errors" } */ + +#include <x86intrin.h> + +int dummy; diff --git a/gcc/testsuite/g++.dg/other/linkage2.C b/gcc/testsuite/g++.dg/other/linkage2.C deleted file mode 100644 index 4e3e6f1eab3..00000000000 --- a/gcc/testsuite/g++.dg/other/linkage2.C +++ /dev/null @@ -1,31 +0,0 @@ -// DR 743: A type without linkage shall not be used as the type of a -// variable or function with linkage, unless -// o the variable or function has extern "C" linkage (7.5 [dcl.link]), or -// o the variable or function is not used (3.2 [basic.def.odr]) or is -// defined in the same translation unit. - -template <typename T> struct B { - void g(T){} - void h(T); // { dg-error "never defined" } - friend void i(B, T){} - static T t1; // { dg-error "never defined" } - static T t2; -}; - -template <typename T> T B<T>::t2 = { }; - -enum {} e1; // OK, defined -extern enum {} e2; // { dg-error "never defined" } -extern "C" enum {} e3; // OK, extern "C" - -void f() { - struct A { int x; }; // no linkage - A a = {1}; - B<A> ba; // declares B<A>::g(A) and B<A>::h(A) - ba.t1 = a; // error, B<T>::t never defined - ba.t2 = a; // OK - ba.g(a); // OK - ba.h(a); // error, B<T>::h never defined - i(ba, a); // OK - e1+e2+e3; -} diff --git a/gcc/testsuite/g++.dg/other/offsetof6.C b/gcc/testsuite/g++.dg/other/offsetof6.C new file mode 100644 index 00000000000..b77d1b99a77 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/offsetof6.C @@ -0,0 +1,26 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin PR c++/38699 +// { dg-do compile } + +template<class T> +struct A +{ + const T *p; +}; + +struct B +{ + A<int> a; +}; + +template class A<char>; + +void +f0 () +{ + __builtin_offsetof(A<char>, p); // OK + __builtin_offsetof(A<char>, p[1]); // { dg-error "non constant address" } + __builtin_offsetof(B, a.p); // OK + __builtin_offsetof(B, a.p[1]); // { dg-error "non constant address" } +} + diff --git a/gcc/testsuite/g++.dg/other/ptrmem10.C b/gcc/testsuite/g++.dg/other/ptrmem10.C new file mode 100644 index 00000000000..4b8c40ac8ec --- /dev/null +++ b/gcc/testsuite/g++.dg/other/ptrmem10.C @@ -0,0 +1,29 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin PR c++/37093 + +template <class C, void (C::*M) ()> +static +void foo(void *obj) +{ + C *p = static_cast<C*>(obj); + (p->*M)(); +} + +template <class C> +static void +bar(C *c, void (C::*m) ()) +{ + foo<C,m>((void *)c);// { dg-error "(not a valid template arg|pointer-to-member|no matching fun)" } +} + +struct S +{ + void baz () {} +}; + +int +main () +{ + S a; + bar(&a, &S::baz); +} diff --git a/gcc/testsuite/g++.dg/other/ptrmem11.C b/gcc/testsuite/g++.dg/other/ptrmem11.C new file mode 100644 index 00000000000..a850c55c40a --- /dev/null +++ b/gcc/testsuite/g++.dg/other/ptrmem11.C @@ -0,0 +1,21 @@ +// Contributed by Dodji Seketeli <dodji@redhat.com> +// Origin PR c++/37093 + +struct A {}; + +template <int A::* p> +int +foo(A* q) +{ + return q->*p; +} + +template <typename T> +int +bar(int T::* p) +{ + return foo<p>(0);// { dg-error "(not a valid template arg|no matching func|pointer-to-member)" } +} + +int i = bar<A>(0); + |