plateform
stringclasses
1 value
repo_name
stringclasses
2 values
name
stringlengths
1
78
ext
stringclasses
2 values
path
stringlengths
15
1.11k
size
int64
1
8.55M
source_encoding
stringclasses
11 values
md5
stringlengths
32
32
text
stringlengths
0
8.49M
google
chromium
spec10
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec10.C
471
utf_8
ad21a3b2ad2780aa2209396893143af3
// { dg-do run } // PR c++/10940: Problem handling parameter list for static member // that is a specialization of a member template of a template class. template<int b> class o { public: template<typename T> static void do_add(T* p, T v); }; template<> template<typename T> inline void o<32>::do_add(T* p, T v) { *p += v; } int main() { int a = 0x1000; o<32>().do_add<int>(&a, 0x2000); return (a != 0x3000); }
google
chromium
sfinae9
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sfinae9.C
7,906
utf_8
a9f3ce4ee662be853b285ba58e2dfe52
// DR 339 // // Test of the use of various assignment operators with SFINAE // Boilerplate helpers typedef char yes_type; struct no_type { char data[2]; }; template<typename T> T create_a(); template<typename T> struct type { }; template<bool, typename T = void> struct enable_if { typedef T type; }; template<typename T> struct enable_if<false, T> { }; #define JOIN( X, Y ) DO_JOIN( X, Y ) #define DO_JOIN( X, Y ) DO_JOIN2(X,Y) #define DO_JOIN2( X, Y ) X##Y #define DEFINE_INFIX_BINARY_TRAIT(Name,Op) \ template<typename T, typename U> \ typename enable_if<(sizeof(create_a<T>() Op create_a<U>(), 1) > 0), \ yes_type>::type \ JOIN(check_,Name)(type<T>, type<U>); \ \ no_type JOIN(check_,Name)(...); \ \ template<typename T, typename U = T> \ struct Name \ { \ static const bool value = \ (sizeof(JOIN(check_,Name)(type<T&>(), type<U>())) == sizeof(yes_type)); \ } #ifdef __GXX_EXPERIMENTAL_CXX0X__ # define STATIC_ASSERT(Expr) static_assert(Expr, #Expr) #else # define STATIC_ASSERT(Expr) int JOIN(a,__LINE__)[Expr? 1 : -1] #endif struct Y { Y& operator=(Y&); }; struct X { X& operator=(Y); X& operator+=(X); X& operator-=(X); X& operator*=(X); X& operator/=(X); X& operator%=(X); X& operator^=(X); X& operator&=(X); X& operator|=(X); X& operator<<=(X); X& operator>>=(X); }; struct Z { }; // is_assignable DEFINE_INFIX_BINARY_TRAIT(is_assignable, =); STATIC_ASSERT((is_assignable<int>::value)); STATIC_ASSERT((is_assignable<int, long>::value)); STATIC_ASSERT((is_assignable<X>::value)); STATIC_ASSERT((!is_assignable<int*, int>::value)); STATIC_ASSERT((is_assignable<int*>::value)); STATIC_ASSERT((is_assignable<X, Y>::value)); STATIC_ASSERT((!is_assignable<X, Z>::value)); STATIC_ASSERT((!is_assignable<Y>::value)); STATIC_ASSERT((!is_assignable<const int, long>::value)); // has_plus_assign DEFINE_INFIX_BINARY_TRAIT(has_plus_assign, +=); X& operator+=(X&, Y); STATIC_ASSERT((has_plus_assign<int>::value)); STATIC_ASSERT((has_plus_assign<int, long>::value)); STATIC_ASSERT((has_plus_assign<X>::value)); STATIC_ASSERT((has_plus_assign<int*, int>::value)); STATIC_ASSERT((!has_plus_assign<int*>::value)); STATIC_ASSERT((has_plus_assign<X, Y>::value)); STATIC_ASSERT((!has_plus_assign<X, Z>::value)); STATIC_ASSERT((!has_plus_assign<Y>::value)); STATIC_ASSERT((!has_plus_assign<const int, long>::value)); // has_minus_assign DEFINE_INFIX_BINARY_TRAIT(has_minus_assign, -=); X& operator-=(X&, Y); STATIC_ASSERT((has_minus_assign<int>::value)); STATIC_ASSERT((has_minus_assign<int, long>::value)); STATIC_ASSERT((has_minus_assign<X>::value)); STATIC_ASSERT((has_minus_assign<int*, int>::value)); STATIC_ASSERT((!has_minus_assign<int*>::value)); STATIC_ASSERT((has_minus_assign<X, Y>::value)); STATIC_ASSERT((!has_minus_assign<X, Z>::value)); STATIC_ASSERT((!has_minus_assign<Y>::value)); STATIC_ASSERT((!has_minus_assign<int X::*>::value)); STATIC_ASSERT((!has_minus_assign<const int, long>::value)); // has_multiply_assign DEFINE_INFIX_BINARY_TRAIT(has_multiply_assign, *=); X& operator*=(X&, Y); STATIC_ASSERT((has_multiply_assign<int>::value)); STATIC_ASSERT((has_multiply_assign<int, long>::value)); STATIC_ASSERT((has_multiply_assign<X>::value)); STATIC_ASSERT((!has_multiply_assign<int*, int>::value)); STATIC_ASSERT((!has_multiply_assign<int*>::value)); STATIC_ASSERT((has_multiply_assign<X, Y>::value)); STATIC_ASSERT((!has_multiply_assign<X, Z>::value)); STATIC_ASSERT((!has_multiply_assign<Y>::value)); STATIC_ASSERT((!has_multiply_assign<int X::*>::value)); STATIC_ASSERT((!has_multiply_assign<const int, long>::value)); // has_divide_assign DEFINE_INFIX_BINARY_TRAIT(has_divide_assign, /=); X& operator/=(X&, Y); STATIC_ASSERT((has_divide_assign<int>::value)); STATIC_ASSERT((has_divide_assign<int, long>::value)); STATIC_ASSERT((has_divide_assign<X>::value)); STATIC_ASSERT((!has_divide_assign<int*, int>::value)); STATIC_ASSERT((!has_divide_assign<int*>::value)); STATIC_ASSERT((has_divide_assign<X, Y>::value)); STATIC_ASSERT((!has_divide_assign<X, Z>::value)); STATIC_ASSERT((!has_divide_assign<Y>::value)); STATIC_ASSERT((!has_divide_assign<int X::*>::value)); // has_remainder_assign DEFINE_INFIX_BINARY_TRAIT(has_remainder_assign, %=); X& operator%=(X&, Y); STATIC_ASSERT((has_remainder_assign<int>::value)); STATIC_ASSERT((has_remainder_assign<int, long>::value)); STATIC_ASSERT((!has_remainder_assign<float>::value)); STATIC_ASSERT((has_remainder_assign<X>::value)); STATIC_ASSERT((!has_remainder_assign<int*, int>::value)); STATIC_ASSERT((!has_remainder_assign<int*>::value)); STATIC_ASSERT((has_remainder_assign<X, Y>::value)); STATIC_ASSERT((!has_remainder_assign<X, Z>::value)); STATIC_ASSERT((!has_remainder_assign<Y>::value)); STATIC_ASSERT((!has_remainder_assign<int X::*>::value)); // has_xor_assign DEFINE_INFIX_BINARY_TRAIT(has_xor_assign, ^=); X& operator^=(X&, Y); STATIC_ASSERT((has_xor_assign<int>::value)); STATIC_ASSERT((has_xor_assign<int, long>::value)); STATIC_ASSERT((!has_xor_assign<float>::value)); STATIC_ASSERT((has_xor_assign<X>::value)); STATIC_ASSERT((!has_xor_assign<int*, int>::value)); STATIC_ASSERT((!has_xor_assign<int*>::value)); STATIC_ASSERT((has_xor_assign<X, Y>::value)); STATIC_ASSERT((!has_xor_assign<X, Z>::value)); STATIC_ASSERT((!has_xor_assign<Y>::value)); STATIC_ASSERT((!has_xor_assign<int X::*>::value)); // has_bitand_assign DEFINE_INFIX_BINARY_TRAIT(has_bitand_assign, &=); X& operator&=(X&, Y); STATIC_ASSERT((has_bitand_assign<int>::value)); STATIC_ASSERT((has_bitand_assign<int, long>::value)); STATIC_ASSERT((!has_bitand_assign<float>::value)); STATIC_ASSERT((has_bitand_assign<X>::value)); STATIC_ASSERT((!has_bitand_assign<int*, int>::value)); STATIC_ASSERT((!has_bitand_assign<int*>::value)); STATIC_ASSERT((has_bitand_assign<X, Y>::value)); STATIC_ASSERT((!has_bitand_assign<X, Z>::value)); STATIC_ASSERT((!has_bitand_assign<Y>::value)); STATIC_ASSERT((!has_bitand_assign<int X::*>::value)); // has_bitor_assign DEFINE_INFIX_BINARY_TRAIT(has_bitor_assign, |=); X& operator|=(X&, Y); STATIC_ASSERT((has_bitor_assign<int>::value)); STATIC_ASSERT((has_bitor_assign<int, long>::value)); STATIC_ASSERT((!has_bitor_assign<float>::value)); STATIC_ASSERT((has_bitor_assign<X>::value)); STATIC_ASSERT((!has_bitor_assign<int*, int>::value)); STATIC_ASSERT((!has_bitor_assign<int*>::value)); STATIC_ASSERT((has_bitor_assign<X, Y>::value)); STATIC_ASSERT((!has_bitor_assign<X, Z>::value)); STATIC_ASSERT((!has_bitor_assign<Y>::value)); STATIC_ASSERT((!has_bitor_assign<int X::*>::value)); // has_left_shift_assign DEFINE_INFIX_BINARY_TRAIT(has_left_shift_assign, <<=); X& operator<<=(X&, Y); STATIC_ASSERT((has_left_shift_assign<int>::value)); STATIC_ASSERT((has_left_shift_assign<int, long>::value)); STATIC_ASSERT((!has_left_shift_assign<float>::value)); STATIC_ASSERT((has_left_shift_assign<X>::value)); STATIC_ASSERT((!has_left_shift_assign<int*, int>::value)); STATIC_ASSERT((!has_left_shift_assign<int*>::value)); STATIC_ASSERT((has_left_shift_assign<X, Y>::value)); STATIC_ASSERT((!has_left_shift_assign<X, Z>::value)); STATIC_ASSERT((!has_left_shift_assign<Y>::value)); STATIC_ASSERT((!has_left_shift_assign<int X::*>::value)); // has_right_shift_assign DEFINE_INFIX_BINARY_TRAIT(has_right_shift_assign, >>=); X& operator>>=(X&, Y); STATIC_ASSERT((has_right_shift_assign<int>::value)); STATIC_ASSERT((has_right_shift_assign<int, long>::value)); STATIC_ASSERT((!has_right_shift_assign<float>::value)); STATIC_ASSERT((has_right_shift_assign<X>::value)); STATIC_ASSERT((!has_right_shift_assign<int*, int>::value)); STATIC_ASSERT((!has_right_shift_assign<int*>::value)); STATIC_ASSERT((has_right_shift_assign<X, Y>::value)); STATIC_ASSERT((!has_right_shift_assign<X, Z>::value)); STATIC_ASSERT((!has_right_shift_assign<Y>::value)); STATIC_ASSERT((!has_right_shift_assign<int X::*>::value));
google
chromium
typedef7
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typedef7.C
225
utf_8
e5348f6294a6577651589b520086d43e
// An intermediate version of the fix for c++/19407 broke this example. struct A { typedef struct { int i; } S; }; template <class T> struct B: public A { template <class U> static S f (); }; template struct B<int>;
google
chromium
memfriend4
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memfriend4.C
847
utf_8
9e0baac902249d16ec8e8d97a1ab2371
// { dg-do compile } // Member function of class template as friend template<class T> struct A { template <T t> void f(); }; class C { int i; template<class T> template <T t> friend void A<T>::f(); }; template<class T> struct A<T*> { template <T* t> void f(); }; template<> struct A<char> { template <char t> void f(); }; template<class T> template <T t> void A<T>::f() { C c; c.i = 0; } template<class T> template <T* t> void A<T*>::f() { C c; c.i = 0; } template <char t> void A<char>::f() { C c; c.i = 0; } template <> void A<char>::f<'b'>() { C c; c.i = 0; } int d2 = 0; int main() { A<int> a1; a1.f<0>(); A<int *> a2; a2.f<&d2>(); A<char> a3; a3.f<'a'>(); a3.f<'b'>(); }
google
chromium
nontype5
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nontype5.C
293
utf_8
d37a5a77843c5b66c3d3566383b07dd6
// { dg-do compile } // PR c++/13797: ICE invalid nontype template parameter template <int> struct A { typedef A<0> B; template <B> struct C {}; // { dg-error "not a valid type" } }; A<0> a;
google
chromium
defarg12
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/defarg12.C
161
utf_8
7c114463066844468387ccd37081c2dd
// PR c++/35828 // { dg-options "-std=c++0x" } template < typename > struct A ; template < template < typename > class = A > void test () { test (); }
google
chromium
friend31
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend31.C
587
utf_8
ca5a98ee9de24f0adf4f6d6da6ea4315
// { dg-do compile } // PR c++/15410: Declaration of friend class template with wrong // template parameter. template <typename T, typename U> struct F; // { dg-message "previous declaration" } class W { template<int i> friend class F; // { dg-error "template parameter" } int x; // { dg-error "private" } }; template <typename T, typename U> struct F { void Look(W& w) { w.x = 3; } // { dg-error "within this context" } }; int main() { W w; F<char, bool> f; f.Look(w); return 0; }
google
chromium
crash34
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash34.C
310
utf_8
431d941aad4b31a51b29e3dc961a7556
// { dg-do compile } // PR c++/20028 // We used to crash when referencing TYPE_SIZE_UNIT of the messed-up // type used for x, because it was not initialized. class Foo; template <typename T> class Foo { }; // { dg-error "not a template type" } Foo<int> x; // { dg-error "not a template|incomplete type" }
google
chromium
friend50
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend50.C
157
utf_8
111cbc72ece5729acf873d2dfae640fd
// PR c++/34399 template<int> struct X { void foo(); }; struct Y { template<long N> friend void X<N>::X::foo(); // { dg-error "declared as friend" } };
google
chromium
local4
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/local4.C
123
utf_8
2f2d0e45d76b00761833641d3df47beb
// PR c++/17413 template <typename T> void foo() {} int main () { struct S {}; foo<S> (); // { dg-error "match" } }
google
chromium
call6
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/call6.C
230
utf_8
e3d27e71e5cdf1b6216b87f64c98c15c
// PR c++/38577 // { dg-do compile } struct A { static A *bar (); }; struct B : public A { static void baz (); }; template <class T> void foo () { (static_cast<B *> (A::bar ()))->baz (); } void bar () { foo<int> (); }
google
chromium
unify3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/unify3.C
286
utf_8
16808e8b62429d390bc5719fd2009b5c
// Test unifying SCOPE_REF. // { dg-do compile } template <int n> class A {}; template <int m> class R {}; template <int n> struct Trait { enum {m = n}; }; template <int n> R<Trait<n>::m> f(A<n>); template <> R<1> f(A<1>) {return R<1>();}
google
chromium
crash89
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash89.C
146
utf_8
6034281ee9d39b43ef106b314de26f05
// PR c++/34397 template<typename T, int = T()[0]> struct A { typedef A<T> B; }; A<int> a; // { dg-error "subscripted|template|declaration" }
google
chromium
local3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/local3.C
157
utf_8
e254df20b082728d0e04a8e1b3b18557
template<class T> void f(const T&) { struct B { void g (T); }; B b; } void g() { f(42); }
google
chromium
static6
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static6.C
197
utf_8
40796a2389c81fb63a7c826d2e3a06af
// PR c++/13969 struct B { static const int N=10; }; template <int> struct X {}; template <typename> struct S { static const int N = B::N; X<N> x; }; template class S<float>;
google
chromium
crash62
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash62.C
109
utf_8
adc7a5c414a143f0cadb9db916df6769
// PR c++/29728 template<int> void foo() { int a[] = { X: 0 }; // { dg-error "designated initializer" } }
google
chromium
dtor5
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/dtor5.C
264
utf_8
6df398ccb1fe455e5493303db41ea421
// PR c++/23287 template <class T> struct A { int i; ~A(); }; template <class T> void f(A<T> *ap) { ap->~A(); } template <class T> void g(A<T> *ap) { ap->~B(); // { dg-error "destructor name" } } int main() { f(new A<int>); g(new A<int>); }
google
chromium
sfinae2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sfinae2.C
321
utf_8
c49f3a4b9653daf3e8eaa17ba7b488de
// PR c++/19989 // Don't instantiate a function template if it would generate an // array of size zero. // { dg-do compile } template<int T> struct cl { const static int value = T; }; template<int I> void fn (char (*) [cl<I>::value] = 0 ); void foo (void) { fn<0> (); // { dg-error "no matching function" } }
google
chromium
ttp8
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp8.C
408
utf_8
ad156dec50f1d7aecc0ad4207046c838
// { dg-do compile } // Contributed by: Niall Douglas <s_gccbugzilla at netprod dot com> // PR c++/14284: Failure to select specialization template<typename> struct S; template<template<class> class> struct I {}; template<class, int> struct Match; template<template<class> class C> struct Match<I<C>, 0> {}; template<template<class> class C, int i> struct Match<I<C>, i>; Match<I<S>, 0> v;
google
chromium
error5
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error5.C
149
utf_8
a988dc6a097a8766258a32544791c7db
template <typename T> struct X<T*> { // { dg-error "not a template" } typedef int Y; }; extern struct Z<int> s; // { dg-error "not a template" }
google
chromium
access15
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access15.C
328
utf_8
fc82819a276388c85441dd10835850d1
// { dg-do compile } // Bug 17149: ICE with TEMPLATE_TYPE_PARM template <class super, int (super::tdata::*member)() const = &super::tdata::operator()> struct x {};
google
chromium
error20
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error20.C
88
utf_8
c76b01c2f7357d4400cd8e049826cc38
// PR c++/25439 template<int> struct A; template<> int A<0>; // { dg-error "invalid" }
google
chromium
ptrmem17
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ptrmem17.C
150
utf_8
c9cd6927c7a0605bf286009431494170
// PR c++/28346 template<int> struct A { int& i; A(); ~A() { &A::i; } // { dg-error "reference" } }; A<0> a; // { dg-message "instantiated" }
google
chromium
dependent-expr2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/dependent-expr2.C
351
utf_8
5c363f74bcfd32858f0d7daa76f3d56b
// { dg-do compile } // PR 11704. ICE struct A { int foo() { return 5; } }; template <class T> // If B is not template it works struct B { bool bar(A& a) { return a.foo == 0; // { dg-error "" "" } } };
google
chromium
instantiate5
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/instantiate5.C
445
utf_8
b639d3c5d35ce1b7e70fd8c25573ed57
// { dg-do compile } // PR c++/11616: Incorrect line number in diagnostics template <int> struct A { static const int i=0; }; int baz() { return A<0>::i; } struct B { static void foo (int); // { dg-message "candidates" } }; template <typename T> struct C { virtual void bar() const { T::foo(); } // { dg-error "no matching function" } }; C<B> c; // { dg-message "instantiated" }
google
chromium
crash48
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash48.C
221
utf_8
acafc697faf6ec3734ae2c55fafef289
// PR c++/11471 // { dg-do compile } template<typename T> struct A { typedef typename T::X X; }; template<typename T> A<T>::X::X() {} // { dg-error "no type|invalid use|not a type" }
google
chromium
pr4926-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/pr4926-1.C
350
utf_8
698fef868c92929bbef3fe847bfc6295
// PR c++/4926 // { dg-do compile } template <unsigned> struct X { typedef int Type; }; template <typename T> struct Y { char array[1]; }; template<typename T> Y<T> P(T); // acts as "Y<typeof(T)>" struct F { int operator()() const; }; template <typename T> typename X<sizeof(P( T()() ).array)>::Type foo(); void bar () { foo<F>(); }
google
chromium
ptrmem13
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ptrmem13.C
121
utf_8
97ddc530a1bd61b06c131cfdf61adbec
// PR c++/20734 struct A; void blah(int A::*); struct A{ int a; }; template<typename T> void hoho(){ blah(&A::a); }
google
chromium
cond2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/cond2.C
178
utf_8
4336c9181e48a94368c9c6bbf4270562
// PR c++/11962 // { dg-options "" } template<int X> class c; template<int X, int Y> int test(c<X ? : Y>&); void test(c<2>*c2) { test<0, 2>(*c2); // { dg-error "omitted" } }
google
chromium
using14
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/using14.C
322
utf_8
063fba6fdfdc0802ef2fd77e8b729b31
// PR c++/26102 template <class T> struct B1 { int i(); }; struct B2 { int i(); }; template <class T> struct C : public B1<T>, public B2 { using B2::i; void f() { i(); // should be accepted i.i(); // { dg-error "member" } } }; int main() { C<int> c; c.f(); // { dg-message "instantiated" } }
google
chromium
koenig6
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/koenig6.C
436
utf_8
d7b45350c258784a47a153c1dedc979d
// PR c++/38850 template <typename VType> class Vector2 { private: VType c_[2]; public: typedef Vector2<VType> Self; Vector2(const VType x, const VType y) { c_[0] = x; c_[1] = y; } friend inline Self Max(const Self &v1, const Self &v2) { return Self(v1.c_[0], v1.c_[1]); } }; template <class T> Vector2<float> foo(T x) { Vector2<float> y(0,0); return Max(y, y); } int main() { foo(3); return 0; }
google
chromium
access13
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access13.C
332
utf_8
76f5c8b19b7f609c01aedaee827b1931
// { dg-do compile } // PR c++/13262: Access checking during instantiation of static data // member. template <typename T> class Aclass { private: Aclass() {} static Aclass instance; }; template <typename T> Aclass<T> Aclass<T>::instance; template class Aclass<int>;
google
chromium
crash11
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash11.C
275
utf_8
5fdda9a20dcbd6e2fccb01f28292529e
// { dg-do compile } // PR c++/7939: ICE for invalid function parameter after template // substitution. template <class T, class U> void foo(T, U) {} template <class T> void foo<T,void>(T, void) {} // { dg-error "incomplete|invalid|partial" }
google
chromium
error17
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error17.C
259
utf_8
b7e781bfa2896c01e3edc6159e2359e9
// PR c++/20153 template <typename T> void foo() { union { struct { }; }; // { dg-error "prohibits anonymous struct" "anon" } // { dg-error "not inside" "not inside" { target *-*-* } 7 } // { dg-warning "no members" "no members" { target *-*-* } 7 } }
google
chromium
array1-1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/array1-1.C
418
utf_8
99d7b1deba3ad5e11fcbd2dc7d70e9ee
// { dg-do compile } // { dg-options "-fabi-version=1" } // PR c++/12774 Array domains compared unequal void Foo(double r[3][3]) { } void Baz() { double m[3][3]; Foo(m); } template <class T> void Bar() { double m[3][3]; Foo(m); } int main() { Baz(); Bar<int>(); return 0; }
google
chromium
enum3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/enum3.C
299
utf_8
dfe8fe9abce8be55414485a111a8c15f
// PR c++/17327 enum E { E0, E1 }; template <class T,class U> class A {}; template <class T> void f(A<E,T>) {} // We used to issue a "sorry" message. By using an explicit error // message below, we make sure that we will not match "sorry". template void f(A<int,E>); // { dg-error "template-id" }
google
chromium
dependent-expr1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/dependent-expr1.C
552
utf_8
4e28ad3da9cf0f80841dd7ac6a9a0233
// { dg-do compile } // PR c++ 9779. ICE struct I { }; void Foo (int); namespace std { template <typename X> void Baz (I *x) { Foo (sizeof (I)); Foo (sizeof (x)); Foo (__alignof__ (I)); Foo (__alignof__ (x)); Foo (x->~I ()); // { dg-error "" } // Foo (typeid (I)); Foo (delete x); // { dg-error "" } Foo (delete[] x); // { dg-error "" } Foo (throw x); // { dg-error "" } } }
google
chromium
crash51
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash51.C
270
utf_8
81f57567c6c2e784acb94f07d2c3b51e
// PR c++/26496 template< typename _Generator> int generate_n(_Generator __gen); struct Distribution { }; typedef double (Distribution::* Pstd_mem)(); int main(void) { Distribution* rng; Pstd_mem ptr; generate_n(rng->*ptr); // { dg-error "non-static member" } }
google
chromium
decl2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/decl2.C
207
utf_8
05e0d875681f42cc0eb951378ac07bd0
// PR c++/16162 template <int N> struct O { struct I { template <typename T> struct II { void f(); }; }; }; template <int N> template <typename T> void O<N>::I::II<T>::f () {}
google
chromium
access9
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access9.C
401
utf_8
7834be58b513cdde90c14c885e21ae63
// { dg-do compile } // Template instantiate during deferred access check template <void (*)(int)> struct C { typedef int Y; }; template <class T> void f(typename T::X) { } class A { typedef int X; template <class T> friend void f(typename T::X); }; C<&f<A> >::Y g(int);
google
chromium
subst1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/subst1.C
549
utf_8
65ffda86719727c560bb58b2ddc37078
// { dg-do compile } // PR 7718. ICE. template <typename OBJECT> void default_initializer(const OBJECT &) { } template <typename OBJECT, void init_function(const OBJECT &)> class cContainer { public: template <typename INITIALIZER> void Add(const INITIALIZER &initializer) { init_function(initializer); } }; int main() { cContainer<int, default_initializer<int> > c; c.Add<int>(42); return 0; }
google
chromium
crash14
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash14.C
129
utf_8
bbe78250be1aa09c9f8b33a962c068bb
template <int T> class foo { public: foo() { } class Z { };}; template <int I[2]> void dep7(foo<I[0]> *) { } // { dg-error "" }
google
chromium
crash26
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash26.C
238
utf_8
17d811daa3052b89558edc8df7e9ee0e
// { dg-do compile } // PR c++/18471: ICE redeclaration of typedef as class template typedef int X; // { dg-error "previous" } template<X> struct X {}; // { dg-error "typedef-name" }
google
chromium
ttp5
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp5.C
402
utf_8
786176b167efb2fb05f5876afccf4ea7
// { dg-do compile } // PR c++/8772: Incorrect diagnostics for template template parameter // mismatch template <int> struct A { template <int> struct B { enum { v = 1 }; }; }; template <template <int> class F> struct C { enum { v = F<1>::v || 2 }; }; template <int n> struct D { enum { v = C<A<n>::B>::v }; // { dg-error "mismatch|class template" } };
google
chromium
alignof1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/alignof1.C
152
utf_8
98629e0464be5ba2c3ca56190b5b6f48
template<typename T> int my_alignof() { return __alignof__(T); } template<typename> struct X { }; int main() { return my_alignof<X<void> >(); }
google
chromium
friend49
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend49.C
228
utf_8
6d77be24cb0cbaa83d42b95befcf027c
// PR c++/29054 // { dg-do compile } struct A { template <typename T, typename U> static void create (U) {} }; struct B { friend void A::create <B, const char *> (const char *); }; int main () { A::create<B>("test"); }
google
chromium
overload5
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/overload5.C
511
utf_8
71fab915b19ad597865cbe790d6ee455
// PR c++/22621 struct foo { typedef int (*fun)(int); static int f(int); // overload between static & non-static int f(); static int g(int); // non-overloaded static }; template<foo::fun> struct f_obj { // something .. }; f_obj<&foo::f> a; // OK f_obj<foo::f> b; // OK (note: a and b are of the same type) int foo::f() { f_obj<&foo::f> a; // OK f_obj<foo::f> b; // ERROR: foo::f cannot be a constant expression f_obj<&foo::g> c; // OK f_obj<foo::g> d; // OK }
google
chromium
sfinae6_neg
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sfinae6_neg.C
1,302
utf_8
e54e8bfeb41272da8a3ce8638ca6f9de
// DR 339 // // Test of the use of the function call operator with SFINAE typedef char yes_type; struct no_type { char data[2]; }; template<typename T> T create_a(); template<typename T> struct type { }; template<bool, typename T = void> struct enable_if { typedef T type; }; template<typename T> struct enable_if<false, T> { }; 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>); no_type check_is_callable2(...); template<typename F, typename T1, typename T2 = T1> struct is_callable2 { static const bool value = (sizeof(check_is_callable2(type<F>(), type<T1>(), type<T2>())) == sizeof(yes_type)); // { dg-error "within this context" } }; #define JOIN( X, Y ) DO_JOIN( X, Y ) #define DO_JOIN( X, Y ) DO_JOIN2(X,Y) #define DO_JOIN2( X, Y ) X##Y #ifdef __GXX_EXPERIMENTAL_CXX0X__ # define STATIC_ASSERT(Expr) static_assert(Expr, #Expr) #else # define STATIC_ASSERT(Expr) int JOIN(a,__LINE__)[Expr? 1 : -1] #endif struct A; struct B; struct A { A(B); }; struct B { B(A); }; struct F { void operator()(A, A); private: void operator()(B, B); // { dg-error "is private" } }; STATIC_ASSERT((is_callable2<F, B, B>::value));
google
chromium
instantiate10
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/instantiate10.C
972
utf_8
b6f93db83699b516b0d1578a6c9649ac
/* PR c++/39242, xplicit instantiation declaration prohibits implicit instantiation of non-inline functions. */ /* { dg-do compile } */ /* { dg-options "-O" } */ class Rep { public: void unref() const { } static void unref (const Rep * obj_r) { obj_r->unref(); } }; template<typename _Tp, typename _Bt = _Tp> class RepPtrStore { _Tp * _obj; void _assign( _Tp * new_r ); public: ~RepPtrStore() { _assign( 0 ); } }; template<typename _Tp,typename _Bt> void RepPtrStore<_Tp,_Bt>::_assign( _Tp * new_r ) { Rep::unref( _obj ); } class RepPtrBase { }; template<typename _Bt> class PtrBase : public RepPtrBase { }; template<typename _Tp, typename _Bt = _Tp> class Ptr : public PtrBase<_Bt> { RepPtrStore<_Tp,_Bt> _ptr; }; class YCode; class YStatement; typedef Ptr<YStatement,YCode> YStatementPtr; extern template class RepPtrStore<YStatement,YCode>; class ExecutionEnvironment { YStatementPtr m_statement; ~ExecutionEnvironment() { }; };
google
chromium
ptrmem8
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ptrmem8.C
672
utf_8
64c9195ca42e95f4d54b1dd3a351d2f7
// { dg-do compile } // Origin: <marco dot franzen at bigfoot dot com> // PR c++/10126: Handle ptmf default conversions while matching a template // argument struct B { int I () const; int I (); }; struct D : B {}; template <int (D::*fun)() const> int Get(); int main () { Get<&B::I>(); // { dg-error "not a valid template argument" "not valid" } // { dg-error "no match" "no match" { target *-*-* } 18 } // { dg-message "note" "note" { target *-*-* } 18 } Get<&D::I>(); // { dg-error "not a valid template argument" "not valid" } // { dg-error "no match" "no match" { target *-*-* } 21 } // { dg-message "note" "note" { target *-*-* } 21 } }
google
chromium
typename5
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typename5.C
445
utf_8
657b2e18e1c5bda47ab17e796163c009
// { dg-do compile } // PR c++/2513: typename handling when scope is dependent as // described in DR108. template <bool flag> struct Select { typedef int Result; }; template <template<class> class Pred> struct FindType { typedef typename Select<true>::Result Result; }; template <int bits> struct Int { template<typename T> struct RightSize {}; typedef typename FindType<RightSize>::Result type; };
google
chromium
non-dependent2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/non-dependent2.C
314
utf_8
3ce6c8331c1ddbc56b2c89ca07992343
//PR c++/11070 // Used to ICE template <bool b> struct X { template <typename T> static int* execute(int* x) { return x; } }; template <typename T> void foo() { static bool const same = true; X<same>::execute<int> (0); } template void foo<int> ();
google
chromium
using8
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/using8.C
283
utf_8
4b82993be36fd76cdb24298731b1c1e6
// { dg-do compile } // PR c++/9810: Access checking for member function template // appeared in using declaration. struct A { template<class R> void F(R) {} }; struct B: private A { using A::F; }; int main() { B b; b.F(3); }
google
chromium
memfriend7
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memfriend7.C
2,512
utf_8
d9ef8eda8f360f09c825812e861cd7f4
// { dg-do compile } // Member function of class template as friend // Erroneous case: mismatch during specialization template <class T> struct A { template <class U> void f(U); void g(); void h(); void i(int); template <T t> void j(); }; class C { int ii; // { dg-error "private" } template <class U> template <class V> friend void A<U>::f(V); template <class U> friend void A<U>::g(); template <class U> friend void A<U>::h(); template <class U> friend void A<U>::i(int); template <class U> template <U t> friend void A<U>::j(); }; template <class T> struct A<T*> { void f(int); template <class U> void g(); int h(); void i(char); template <int> void j(); }; template <class T> void A<T*>::f(int) { C c; c.ii = 0; // { dg-error "context" } } template <class T> template <class U> void A<T*>::g() { C c; c.ii = 0; // { dg-error "context" } } template <class T> int A<T*>::h() { C c; c.ii = 0; // { dg-error "context" } } template <class T> void A<T*>::i(char) { C c; c.ii = 0; // { dg-error "context" } } template <class T> template <int> void A<T*>::j() { C c; c.ii = 0; // { dg-error "context" } } template <> struct A<char> { void f(int); template <class U> void g(); int h(); void i(char); template <int> void j(); }; void A<char>::f(int) { C c; c.ii = 0; // { dg-error "context" } } template <class U> void A<char>::g() { C c; c.ii = 0; // { dg-error "context" } } template <> void A<char>::g<int>() { C c; c.ii = 0; // { dg-error "context" } } int A<char>::h() { C c; c.ii = 0; // { dg-error "context" } } void A<char>::i(char) { C c; c.ii = 0; // { dg-error "context" } } template <int> void A<char>::j() { C c; c.ii = 0; // { dg-error "context" } } template <> void A<char>::j<0>() { C c; c.ii = 0; // { dg-error "context" } } int main() { A<int *> a1; a1.f(0); // { dg-message "instantiated" } a1.g<char>(); // { dg-message "instantiated" } a1.g<int>(); // { dg-message "instantiated" } a1.h(); // { dg-message "instantiated" } a1.i('a'); // { dg-message "instantiated" } a1.j<1>(); // { dg-message "instantiated" } A<char> a2; a2.f(0); a2.g<char>(); // { dg-message "instantiated" } a2.g<int>(); a2.h(); a2.i('a'); a2.j<1>(); // { dg-message "instantiated" } a2.j<0>(); }
google
chromium
friend8
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend8.C
223
utf_8
ceb858e95982ac0af2e9168f31aea229
template <int N> struct ivector { template <int r, int c> friend void mult_mv (); }; template struct ivector<3>; template <int r, int c> void mult_mv () { c; } void get_local_point_pos () { mult_mv<7, 3> (); }
google
chromium
operator6
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/operator6.C
94
utf_8
b5bc56bf214d4c012ea8de74a6dea853
// PR c++/27315 // { dg-do compile } template void operator+; // { dg-error "non-function" }
google
chromium
array20
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/array20.C
150
utf_8
dbd20d81c325cee68179c0a4fd156f81
// PR c++/38950 template <typename T, T N> void f(T(&)[N]); int main() { int x[2]; unsigned int y[2]; f(x); // works f(y); // ICE }
google
chromium
typename11
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typename11.C
158
utf_8
420551b6ca8dd7f866b6e96a62a9f7a0
// PR c++/28999 namespace N { template<int> void foo(); } template<int> struct A { friend void typename N::foo<0>(); // { dg-error "type|expected" } };
google
chromium
array5
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/array5.C
114
utf_8
c557bdb58ff52b9fc368185880923627
// PR c++/15427 template<class T> struct A { T foo; }; template<class T> struct B { A<int> _squares[2]; };
google
chromium
void7
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/void7.C
184
utf_8
507e9e60c4e8d6cbeaf93b654efa9b91
//PR c++/28741 template<void> struct A // { dg-error "not a valid type" } { static int i; }; A<0> a; // { dg-error "invalid type|not a valid type" }
google
chromium
static25
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static25.C
143
utf_8
7b985567967838ede5e338abace5eafc
// PR c++/27819 struct A { static const char i = 1; }; template<int> struct B { static const int j = A::i; int x[int(j)]; }; B<0> b;
google
chromium
lookup1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/lookup1.C
176
utf_8
858241029bc9c5f2b0eb96ca1ff057a8
template <class T0> class A { public: class B; }; template <class T0> class A<T0>::B { public: class C; }; template <class T0> class A<T0>::B::C { public: A<T0> &a; };
google
chromium
dtor1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/dtor1.C
85
utf_8
c10faccbba72797e793c4697fe233f9c
struct A {}; template <typename T> struct B { B() { A().A::~A(); } }; B<void> b;
google
chromium
nontype7
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nontype7.C
314
utf_8
cee023670861be047d45f0aa6daa937f
// { dg-do compile } // Origin: C++ standard, [temp.arg.nontype]/2 template<class T, char* p> struct X { X(); X(const char* q) { /* ... */ } }; char p[] = "Vivisectionist"; X<int,"Studebaker"> x1; // { dg-error "string literal" } X<int, p> x2; // { dg-bogus "" "additional errors" { xfail *-*-* } 11 }
google
chromium
repo8
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/repo8.C
283
utf_8
55004d02bb6a19901a4c070ccb53f631
// PR c++/34340 // { dg-options "-frepo" } // { dg-final { cleanup-repo-files } } // { dg-require-host-local "" } struct A { int a; }; template <typename T> struct D { static const A b; }; template<typename T> const A D<T>::b = { 2 }; const A *x = &D<A>::b; int main () { }
google
chromium
using7
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/using7.C
408
utf_8
b84e1ff61ee65ba43655de5d69616da1
// { dg-do compile } // PR 9447. Using decls in reopened template classes. template <typename> struct A { int i; }; template <typename T> struct B : public A<T> { using A<T>::i; int foo() const; }; struct C {}; template <typename T> int B<T>::foo() const { return i; }
google
chromium
explicit-instantiation3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/explicit-instantiation3.C
549
utf_8
7c2daced476ed6b72c25a10611af9a2c
// { dg-do compile } // Origin: <sebor at roguewave dot com> // c++/8266: Explicit instantiation of a template outside its namespace is // broken namespace N { template <class T> T foo (T) { return T (); } struct A { template <int N> struct B {}; }; template <int M> struct C {}; template double foo(double); template float foo<float>(float); template struct A::B<0>; template struct C<0>; } template int N::foo(int); template char N::foo<char>(char); template struct N::A::B<1>; template struct N::C<1>;
google
chromium
error42
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error42.C
375
utf_8
0f72e7f5b78f19b4c40b2fd681e5db21
// PR c++/40372 // { dg-do compile } template <int> struct A { int i; // { dg-error "invalid use of non-static data member" } friend void foo () { int x[i]; // { dg-error "from this location" } } }; struct B { int j; // { dg-error "invalid use of non-static data member" } friend int bar () { return j; // { dg-error "from this location" } } };
google
chromium
lookup4
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/lookup4.C
154
utf_8
9932d99ab28768093ab672853377af03
// PR c++/13950 template <class T> struct Base {}; template <class T> struct Derived: public Base<T> { typename Derived::template Base<double>* p1; };
google
chromium
crash29
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash29.C
115
utf_8
ceec3c489e5f321a136749ba214020ac
// PR c++/18512 template <int> struct A {}; struct B : A<0> { void foo() { this->A<0>; } // { dg-error "" } };
google
chromium
new1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/new1.C
628
utf_8
57b33208329c8d10ea904c3d123076a9
// { dg-do run } // { dg-options "-O2" } struct Aint { ~Aint (); Aint (); }; Aint::Aint () {} Aint::~Aint () {} static int count; template <class T> struct A { unsigned Blksize() const; void f() { new T[Blksize()]; } }; template <class T> unsigned A<T>::Blksize () const { count++; return 1; } int main () { A<Aint> a; a.f(); return count != 1; }
google
chromium
koenig1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/koenig1.C
130
utf_8
6dfc1674746db8a02b5504e177f5aca0
namespace NS { struct C {}; } template <class T> void bar() { T t; foo (t); } template void bar<NS::C> ();
google
chromium
vtable2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/vtable2.C
497
utf_8
d55a534d0d8361d48d4f9895d5fb658a
// Use a small template instantiation depth to speed up testing // { dg-options "-ftemplate-depth-5" } // { dg-do compile } // PR c++/6749: Infinite loop generating vtable. template <class T> struct inner {}; template <class T> struct parent { virtual void f() // { dg-error "instantiation depth" } { parent<inner<T> > p; }; }; template struct parent<int>;
google
chromium
friend21
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend21.C
260
utf_8
7ccd2fc3b3e573a3074eaf2980b008c9
// { dg-do compile } // PR c++/5421: ICE for specialization of member function template // as friend. struct B { template <class T> void b(); }; template <class T> class A { friend void B::b<T>(); }; static A<int> a;
google
chromium
ttp2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp2.C
354
utf_8
55545b6f734664ea7227a639a1393d4f
// { dg-do compile } template <class U> struct Alloc {}; template <class T, class U = Alloc<T> > struct Vector {}; template <template <class T, class U = Alloc<T> > class TT> struct C { TT<int> tt; }; int main() { C<Vector> c; }
google
chromium
inherit4
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/inherit4.C
224
utf_8
2b089e52426f6150cf26e18b4ada5122
// PR c++/21008, DR 515 struct A { int foo_; }; template <typename T> struct B: public A { }; template <typename T> struct C: B<T> { int foo() { return A::foo_; // #1 } }; int f(C<int>* p) { return p->foo(); }
google
chromium
dependent-expr5
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/dependent-expr5.C
2,873
utf_8
fd7e2040a44f325511b326911d8584c7
// { dg-do compile } // inspired in the failure reported in Red Hat bugzilla #168260. template<class F> void bind(F f) {} template<class F> void bindm(F f) {} template<class F, class T> void bindm(F (T::*f)(void)) {} // { dg-message "note" } template<class F> void bindn(F f) {} template<class F, class T> void bindn(F (*f)(T)) {} template<class F> void bindb(F f) {} template<class F, class T> void bindb(F (*f)(T)) {} // { dg-message "note" } template<class F, class T> void bindb(F (T::*f)(void)) {} // { dg-message "note" } struct foo { static int baist; int bait; void barf (); static void barf (int); struct bar { static int baikst; int baikt; void bark (); static void bark (int); bar() { bind (&baist); bind (&foo::baist); bind (&bait); // { dg-error "nonstatic data member" } bind (&foo::bait); bind (&baikst); bind (&bar::baikst); bind (&baikt); // ok, this->baikt bind (&bar::baikt); bind (&barf); // { dg-error "no matching function" } bind (&foo::barf); // { dg-error "no matching function" } bindm (&barf); // { dg-error "no matching function" } bindm (&foo::barf); bindn (&barf); bindn (&foo::barf); bindb (&barf); bindb (&foo::barf); // { dg-error "ambiguous" } bind (&bark); // { dg-error "no matching function" } bind (&bar::bark); // { dg-error "no matching function" } bindm (&bark); // { dg-error "no matching function" } bindm (&bar::bark); bindn (&bark); bindn (&bar::bark); bindb (&bark); bindb (&bar::bark); // { dg-error "ambiguous" } } }; template <typename T> struct barT { static int baikst; int baikt; void bark (); static void bark (int); barT() { bind (&baist); bind (&foo::baist); bind (&bait); // { dg-error "nonstatic data member" } bind (&foo::bait); bind (&baikst); bind (&barT::baikst); bind (&baikt); // ok, this->baikt bind (&barT::baikt); bind (&barf); // { dg-error "no matching function" } bind (&foo::barf); // { dg-error "no matching function" } bindm (&barf); // { dg-error "no matching function" } bindm (&foo::barf); bindn (&barf); bindn (&foo::barf); bindb (&barf); bindb (&foo::barf); // { dg-error "ambiguous" } bind (&bark); // { dg-error "no matching function" } bind (&barT::bark); // { dg-error "no matching function" } bindm (&bark); // { dg-error "no matching function" } bindm (&barT::bark); bindn (&bark); bindn (&barT::bark); bindb (&bark); bindb (&barT::bark); // { dg-error "ambiguous" } } }; bar bard; barT<void> bart; } bad;
google
chromium
conv10
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/conv10.C
119
utf_8
2c3b429768e3e6f954114fbd126e3122
// PR c++/41994 template<typename T> struct A { operator T(); A() { T (A::*f)() = &A::operator T; } }; A<int> a;
google
chromium
nontype12
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nontype12.C
1,185
utf_8
a0f2ec309e5aecd4ba09aa8df96fcfb2
// PR c++/20172 template<typename T> struct A { template<T> int foo(); // { dg-error "double" } template<template<T> class> int bar(); // { dg-error "double" } template<T> struct X; // { dg-error "double" } }; A<char> a1; A<double> a2; // { dg-message "instantiated" } template<typename T> struct B { template<double> int foo(); // { dg-error "double" } template<template<double> class> int bar(); // { dg-error "double" } template<double> struct X; // { dg-error "double" } }; template<void> int foo(); // { dg-error "void" } template<template<void> class> int bar(); // { dg-error "void" } template<void> struct X; // { dg-error "void" } template<typename T> struct C { template<T> int foo(); // { dg-error "double" } }; template<typename T> int baz(T) { C<T> c; } // { dg-message "instantiated" } void foobar() { baz(1.2); // { dg-message "instantiated" } }
google
chromium
memfriend13
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memfriend13.C
1,021
utf_8
c4970b1b6d217a07e47b93130aff29c2
// { dg-do compile } // Nested class template of class template as friend template <class T> struct A { template <class U> struct B { void f(); }; }; template <class V> class C { int i; template <class T> template <class U> friend struct A<T>::B; }; template <class T> struct A<T*> { template <class U> struct B { void f(); }; }; template <> struct A<char> { template <class U> struct B { void f(); }; }; template <class T> template <class U> void A<T>::B<U>::f() { C<int> c; c.i = 0; } template <class T> template <class U> void A<T*>::B<U>::f() { C<int> c; c.i = 0; } template <class U> void A<char>::B<U>::f() { C<int> c; c.i = 0; } template <> void A<char>::B<int>::f() { C<int> c; c.i = 0; } int main() { A<int>::B<int> b1; b1.f(); A<int *>::B<int> b2; b2.f(); A<char>::B<char> b3; b3.f(); A<char>::B<int> b4; b4.f(); }
google
chromium
cast1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/cast1.C
451
utf_8
dae4547b0ed98c262ad1adff2778e177
// { dg-do compile } struct A { void foo(); }; template<int> void bar(A& a) { const_cast<A&>(a).foo(); static_cast<A&>(a).foo(); reinterpret_cast<A&>(a).foo(); ((A&)a).foo(); } template void bar<0>(A& a);
google
chromium
dependent-args1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/dependent-args1.C
221
utf_8
ddb49979db2f8e8e7e883106ad0c150c
// PR c++/27582 // { dg-do compile } struct A { template<int> void foo(); }; template<int N, void (A::*)() = &A::foo<N> > struct B {}; B<int> b; // { dg-error "type/value mismatch|expected a constant|invalid type" }
google
chromium
meminit2
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/meminit2.C
694
utf_8
49a8526a10802f5f264eca9873b6546a
// { dg-do compile } // Origin: Mark Anders <mark dot a dot anders at intel dot com> // PR c++/15503: disambiguators in base classes and mem-initializers template <typename K1> struct O { template <typename K2> struct I {}; }; template <typename T> struct A : typename O<T>::template I<int> { // { dg-error "keyword 'typename' not allowed" } A() : typename O<T>::template I<int>() // { dg-error "keyword 'typename' not allowed" } {} }; template <typename T> struct B : O<T>::template I<int> { B() : O<T>::I<int>() // { dg-error "used as template|it is a template" "" } {} }; // { dg-bogus "end of input" "bogus token skipping in the parser" { xfail *-*-* } 17 }
google
chromium
array9
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/array9.C
277
utf_8
9ff0e683b6d55fee7915dd8f28470138
// PR c++/18429 int subtrees = 4; template< class T > struct Tree { Tree* L[subtrees]; // { dg-error "" } Tree* R[subtrees]; // { dg-error "" } ~Tree() { delete [] L[0]; // { dg-error "" } delete [] R[0]; // { dg-error "" } } }; void f() { Tree<int> t; }
google
chromium
using9
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/using9.C
359
utf_8
43e4887ef35fe0c5873b07345814a3d3
// { dg-do compile } // PR c++/17154: Using declaration in partial class template specialization. template <int numrows, class T> struct A { void test_A() {} }; template <int numrows, class T> struct B {}; template <class T> struct B <3, T> : public A <3, T> { using A <3, T>::test_A; void test_B_spec() { test_A(); } };
google
chromium
memfriend11
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memfriend11.C
966
utf_8
63a099d4fd981493045dce1eefbf9723
// { dg-do compile } // Nested class template of class template as friend template<class T> struct A { template <T t> struct B { void f(); }; }; class C { int i; template<class T> template <T t> friend struct A<T>::B; }; template<class T> struct A<T*> { template <T* t> struct B { void f(); }; }; template<> struct A<char> { template <char t> struct B { void f(); }; }; template<class T> template <T t> void A<T>::B<t>::f() { C c; c.i = 0; } template<class T> template <T* t> void A<T*>::B<t>::f() { C c; c.i = 0; } template <char t> void A<char>::B<t>::f() { C c; c.i = 0; } template <> void A<char>::B<'b'>::f() { C c; c.i = 0; } int d2 = 0; int main() { A<int>::B<0> b1; b1.f(); A<int *>::B<&d2> b2; b2.f(); A<char>::B<'a'> b3; b3.f(); A<char>::B<'b'> b4; b4.f(); }
google
chromium
static17
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static17.C
225
utf_8
a65d6e5ddc2f69a204f701eb15bc324b
// PR c++/23896 template <int> struct X {}; template <typename T> struct length { static const int value = 2; }; template <typename T> void foo () { sizeof(X<length<T>::value>); } template void foo<int>();
google
chromium
crash13
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash13.C
381
utf_8
588678cade6e53d056d1108f6b09d1c5
// { dg-do compile } // PR c++/11076: ICE for invalid access declaration containing typename. template<typename, typename T=void> struct A { typedef A<T,T> B; }; template <typename T> struct C { typedef typename A<T>::B X; X::Y; // { dg-error "not a base type" } }; C<void> c; // { dg-message "instantiated" }
google
chromium
static11
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static11.C
90
utf_8
d208baa6490e1bda86ed7140d7cc233b
// PR c++/19826 template<typename T> struct A { static const T i = 1; char a[i]; };
google
chromium
operator3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/operator3.C
119
utf_8
51da64bb1a35e2d4a874ecc36ed30236
// PR c++/15640 struct A { void foo(void); }; template <int> void bar() { A a; a + a.foo; // { dg-error "" } }
google
chromium
access3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access3.C
309
utf_8
80cb6cf2868cfe0fc932fd23dedab9c0
// { dg-do compile } // PR c++/5387 // Enforcing access of typename type. template <class T> struct A { typename T::template X<int> x; // { dg-error "this context" } }; class B { template <class T> class X {}; // { dg-error "private" } }; int main() { A<B> ab; // { dg-message "instantiated" } }
google
chromium
cond3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/cond3.C
230
utf_8
3dfcddf50f883d0eabd3e0a6a6f3be44
// PR c++/13833 struct X { template <typename T> X & operator << (const T &t); X & operator<< (int& (*p) (int&)); }; X x; template <int> void foo () { x << (1 ? "ok" : "failed"); } template void foo<1>();
google
chromium
ref3
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ref3.C
185
utf_8
a81ad4984bc13a3fb8207d93cbc5f827
// PR c++/28341 template<const int&> struct A {}; template<typename T> struct B { A<(T)0> b; // { dg-error "constant" } A<T(0)> a; // { dg-error "constant" } }; B<const int&> b;
google
chromium
member4
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/member4.C
582
utf_8
7f0db13593e12c1671ab63412653ea6c
// { dg-do compile } // Contributed by Matty T. <mattyt-bugzilla at tpg dot com dot au> // PR c++/13813 [DR206]: Check semantic constraints of members of // non-dependent type at instantiation time. // DR206 explains that this is ill-formed, no diagnostic required. We emit // a diagnostic instead. class E; template < class A > class Z { A a; E e; // { dg-error "incomplete type" } }; // Nested classes are always dependent names. template < class A > class Y { class F; F e; // { dg-bogus "" "nested classes are always dependent, see DR108 and DR224" } };
google
chromium
void13
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/void13.C
129
utf_8
562f64a462f01cebdb6f2624c9cbaf03
// PR c++/30299 struct A { int i; }; template<void> struct B : A // { dg-error "not a valid type" } { B() { this->i; } };
google
chromium
operator10
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/operator10.C
156
utf_8
c61ec35d8c732936734ce075a02dc2a3
// PR c++/30535 struct A {}; template<A, typename T> int operator-(A, T); // { dg-error "not a valid type" } int i = A() - 0; // { dg-error "no match" }
google
chromium
using4
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/using4.C
553
utf_8
cd698ebd98a80f55920d17ae629b4d9b
// { dg-do run } // PR 9447. Using decls in template classes. template <class T> struct Foo { int k (float) {return 1;} }; struct Baz { int k (int) {return 2;} }; template <class T> struct Bar : public Foo<T> , Baz { using Foo<T>::k; using Baz::k; int foo() { if (k (1.0f) != 1) return 1; if (k (1) != 2) return 2; return 0; } }; int main() { Bar<int> bar; return bar.foo(); }
google
chromium
overload10
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/overload10.C
245
utf_8
bb3445a10b57fa4869bad1f1cb774ecd
// PR c++40342 template <typename T1, typename T2> int f(T1 *, const T2 *); // { dg-error "" } template <typename T1, typename T2> int f(const T1 *, T2 *); // { dg-error "" } int (*p)(const int *, const int *) = f; // { dg-error "ambiguous" }
google
chromium
access16
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access16.C
214
utf_8
2f37ed40bca28851af33f3bafa4181d9
// PR c++/23842 struct S; extern S *p; template <class T> int f(T*, int y = ((T*)p)->x) { return y; } struct S { private: int x; template <class U> friend int f(U*, int); }; int g() { return f(p); }
google
chromium
varmod1
.C
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/varmod1.C
130
utf_8
371fd451d6e75ee687f0678fffede3d0
// { dg-options "-w" } template<typename T> void foo(T); void bar() { int i; int A[i][i]; foo(A); // { dg-error "" } }