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 | android | using7 | .C | toolchain/gcc/gcc-4.9/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 | android | typedef18 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typedef18.C | 340 | utf_8 | b09a6dae97faa259ed5be887a5dd1914 | // Origin PR c++/40007
// { dg-do compile }
template<typename T>
struct x
{
protected:
typedef int type;
};
template<typename T>
struct y : public x<T>
{
typename x<T>::type z;
};
template<>
struct y<void> : public x<void>
{
typedef x<void>::type z;
};
template class y<int>; |
google | android | sfinae17 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/sfinae17.C | 601 | utf_8 | 2bc096ac62072d7fefd78642d341f372 | // The conversion from D* to B* is ambiguous, but that should not produce
// an error, it should remove the first f overload by SFINAE.
#define static_assert(TEST,STR) \
do { int ar[(TEST)?1:-1]; } while (0);
struct B {};
struct B1 : B {};
struct B2 : B {};
struct D : B1, B2 {};
template <class T> T create();
t... |
google | android | overload9 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/overload9.C | 342 | utf_8 | ef296b5932e0fe10416d5e48eb64ccb1 | // PR c++/32232
template <typename T> struct A;
template <typename T> struct B {};
template <typename T> A<T>& operator<<(A<T>&, const B<T>&);
template <typename T>
struct A
{
A<T>& operator<<(A<T>& (*)(A<T>&));
};
template <typename T> A<T>& foo(A<T>&);
extern A<char> c;
int main () {
c << (1, foo); // { dg-e... |
google | android | friend18 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/friend18.C | 377 | utf_8 | c8d90e11af5004983158fb9d1e72ccfc | // { dg-do run }
// PR 10158. implicit inline template friends ICE'd
template <int N> struct X
{
template <int M> friend int foo(X const &)
{
return N * 10000 + M;
}
};
X<1234> bring;
int main() {
return foo<5678> (bring) != 12345678;
} |
google | android | overload8 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/overload8.C | 90 | utf_8 | cb3fd3ad47dd95cf7f0463be80d0a9b3 | // PR c++/24915
struct A
{
template<int> void foo() {}
template<int> int foo() {}
};
|
google | android | crash58 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash58.C | 230 | utf_8 | d723188e66b53d1b47c72e45d36126b7 | //PR 26938
template<int, int = 0> struct A; // { dg-message "previous declaration" }
template<int> struct A // { dg-error "template" }
{
A();
};
A<0> a; // { dg-error "incomplete type" }
|
google | android | virtual2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/virtual2.C | 121 | utf_8 | cc0e6150c7129bf68a638d26a3d2f022 | // PR c++/51137
struct A {};
template<int> struct B : virtual A
{
void foo()
{
(new A(*this))->A::~A();
}
};
|
google | android | crash15 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash15.C | 112 | utf_8 | e50e217f7da35dc497156675b2547e44 | // PR c++/13310
struct A {};
template <typename> void foo()
{
A a;
a.foo<int>(); // { dg-error "" }
}
|
google | android | canon-type-4 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/canon-type-4.C | 311 | utf_8 | 6182badf792f2a554489f1b490e70bc3 | // Origin PR c++/39754
// { dg-do compile }
template<typename> struct A ;
template<typename T ,typename = A<T> > struct B { } ;
template<class W, class>
struct D
{
typedef W X;
A<X[2]> a;
} ;
template<class Y>
struct E
{
B<Y[2]> b;
};
E < int > e; |
google | android | static1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/static1.C | 112 | utf_8 | 0511bd747b9cf7ef36970e1f15d3bb0b | template <typename T> struct A
{
static const int t[1][1]={{0}}; // { dg-error "brace-enclosed|in-class" }
};
|
google | android | access2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/access2.C | 425 | utf_8 | bd880d8d2c138019357fe824987745e3 | // { dg-do compile }
// PR c++/5387
// Enforcing access of typename type.
template <class T> struct A {
typename T::X x; // { dg-error "this context" }
int f() { return T::i; } // { dg-error "this context" }
};
class B {
typedef int X; // { dg-error "private" }
static int i; // { dg-error "private" }... |
google | android | inherit | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/inherit.C | 187 | utf_8 | c20e3e284b8812faf677fcf9f596d821 | // { dg-do compile }
template<typename T>
struct X { void f() { } };
struct Z : X<int> { };
int main()
{
Z z;
z.X::f();
} |
google | android | explicit1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/explicit1.C | 230 | utf_8 | 610a5ce174887479710ddef7e050b0e9 | // { dg-do link }
// { dg-options "-fno-implicit-templates" }
template <class T> struct C {
~C();
};
template <class T> C<T>::~C() {}
struct X {
C<X> *p;
~X() { delete p; }
};
template class C<X>;
C<X> x;
int main () {}
|
google | android | friend21 | .C | toolchain/gcc/gcc-4.9/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 | android | spec38 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/spec38.C | 141 | utf_8 | 9c1722ea732af4ec943fd98d7161cf96 | // PR ipa/61659
// { dg-final { scan-assembler "_Z1fIiEvPT_" } }
template <typename T> inline void f (T *);
template <> void f (int *) { }
|
google | android | dependent-expr3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/dependent-expr3.C | 354 | utf_8 | c4e64e51072726ff978403b12d3456bd | // { dg-options -std=c++98 }
// { dg-do compile }
// PR c++/12573: COMPONENT_REFs must be inspected for dependness.
template <bool> struct S;
template <typename K> struct Y : K {
int x;
};
template <class T> struct Z {
S< (bool)(&static_cast<Y<T> *>(0)->x == 0) > // { dg-error "" }
s;
}; |
google | android | error6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/error6.C | 193 | utf_8 | 8f931fa8690071fcefc2b1d1d7483bfc | template<int n>
struct tento {
enum {value = 10*tento<n-1>::value};
};
struct tento<0> { // { dg-error "" }
enum {value=1};
};
int main() {
if (tento<4>::value != 10000) return -1;
}
|
google | android | error1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/error1.C | 350 | utf_8 | 21c90677bbfb74c29a346183dc8bc5a3 | // { dg-do compile }
// PR c++ 10219. ICE
template <class T> void make_pair(T x);
void foo(){
struct fps_chan_ID fps; // { dg-error "incomplete" "" }
make_pair(fps); // { dg-bogus "no matching function" "" }
} |
google | android | crash34 | .C | toolchain/gcc/gcc-4.9/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 | android | memfriend14 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/memfriend14.C | 1,005 | utf_8 | cd21edd34d2428c1c7c7904f894a44f7 | // { dg-do compile }
// Nested class template of class template as friend
template<class T> struct A
{
template <T t> struct B
{
void f();
};
};
template <class U> 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
{
... |
google | android | partial15 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/partial15.C | 480 | utf_8 | 007e963e6560ba4fd5ed5856096ee4cc | // PR c++/57043
// { dg-do link }
template<typename D> struct complex { };
template<typename Tp>
complex<Tp>
pow(const complex<Tp>& x, const complex<Tp>& y) { return complex<Tp>(); }
template<typename T, typename U>
struct promote_2 { typedef T type; };
template<typename Tp, typename Up>
complex<typename promote_2<... |
google | android | ptrmem19 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem19.C | 295 | utf_8 | 0560572d5223bb42d46f697f052023bb | // PR c++/40780
// { dg-do compile }
template <class T1, typename T2, typename T3>
struct A
{
typedef T2 (T1::*m) (T3);
A (m) {}
};
struct B;
struct C
{
void foo (B *);
};
typedef A <C, void, B *> D;
typedef void (C::*E) (B *);
struct F;
typedef void (C::*G) (F);
D d ((E) (G) & C::foo);
|
google | android | spec30 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/spec30.C | 176 | utf_8 | bcc1e7cd1681ae2c1d9e35cde8abbbc4 | // { dg-do compile }
template<int N>
inline int
foo (int a)
{
return a;
}
template<>
inline int
foo<0> (int a = 123) // { dg-error "default argument" }
{
return a + 1;
}
|
google | android | qualttp13 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/qualttp13.C | 433 | utf_8 | bbc53060e714151a182a421e8691abd5 | template <class U> struct A
{
template <class V> struct AA {
template <class T> struct B {
int i;
B() : i(1) {}
};
};
};
template <template <class> class TT> struct X
{
TT<int> y;
};
template <class T, class U> struct C
{
X<T::template AA<U>::template B> x;
};
int main()
{
C<A<char>, int> c;
} |
google | android | typedef32 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typedef32.C | 812 | utf_8 | eb9536bda0639eade20a999acdb363d0 | // Origin: PR c++/43704
// { dg-do compile }
template<typename T2, typename T3>
struct if_
{
typedef T2 type;
};
template<class I1>
struct iterator_restrict_traits
{
struct iterator_category {};
};
template<class T>
struct matrix
{
struct ci {struct ic {};};
class i {};
};
template<class M, class TRI>
struct... |
google | android | explicit-args3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/explicit-args3.C | 193 | utf_8 | d334f5ab9fec554290ec55f268b9b8bf | // PR c++/37177
template <class T>
struct A { };
template <class T>
void operator+(T, T); // { dg-error "class or enum" }
int main()
{
operator+<int>; // { dg-error "cannot resolve" }
}
|
google | android | typedef41 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typedef41.C | 93 | utf_8 | 780a09270b61e706722787bbc8a6e288 | // PR c++/59347
template<int> struct A
{
typedef int ::X; // { dg-error "" }
};
A<0> a;
|
google | android | typename7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typename7.C | 211 | utf_8 | 9108fc5e479d002dfe1d6280ab3a8e35 | // PR c++/17501
template<int> struct A;
template<> struct A<0>
{
struct B
{
struct C
{
typedef int D;
};
};
};
template<int I> struct E
{
typename A<I>::B::C::D i;
};
|
google | android | access26 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/access26.C | 183 | utf_8 | f9dd4a3bfc4ea867997925929a4567dc | // PR c++/45917
template < typename T >
struct A { static int i; };
class B { typedef int X; }; // { dg-error "private" }
void f() { A<B::X>::i = 0; } // { dg-error "this context" }
|
google | android | lookup8 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/lookup8.C | 267 | utf_8 | 97437823fade3b3d3a9381c8da0c575b | // PR c++/38030
// The call to f should be resolved at template definition time.
// { dg-do link }
struct B { };
struct D : public B { };
D d;
void f (B &) { }
template < class T >
void g ()
{
return f (d);
}
void f (D &);
int main ()
{
g<int> ();
return 0;
}
|
google | android | ttp18 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/ttp18.C | 122 | utf_8 | 51fb7506cb7843ab4fdf09b9c85c1544 | template <template <typename> class T>
void f(T<int>) {}
template <typename T>
union U {};
void g() {
f(U<int>());
}
|
google | android | typedef35 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typedef35.C | 724 | utf_8 | d447ec4608ca63e798d20ef66c21b002 | // Origin c++/45558
// { dg-do compile }
template <typename S, typename T>
struct C
{
template <typename U>
struct B
{
template <typename W>
struct E
{
explicit E(const W &x) : w(x) {}
const W &w;
};
};
};
struct F;
template <typename X>
struct D
{
D() {}
};
const D<F> g;
templa... |
google | android | stdarg1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/stdarg1.C | 880 | utf_8 | 5534aa0a36a8f30052a72e8b1e4c5748 | // PR c++/47022
// { dg-do compile }
// Suppress a warning that is irrelevant to the purpose of this test.
// { dg-options "-Wno-abi" { target arm_eabi } }
#include <cstdarg>
template <typename T>
void
f1 (T *p, va_list ap)
{
*p = va_arg (ap, long double);
*p += va_arg (ap, double);
}
template <typename T>
void
... |
google | android | pseudodtor3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/pseudodtor3.C | 692 | utf_8 | 69dadc247b07e815881873e024d0d50b | // PR c++/32241
// { dg-do compile }
struct A
{
typedef int T;
T &foo ();
A () { foo.~T (); } // { dg-error "10:does not have class type|expected" }
};
template <typename T> struct B
{
T &foo ();
B () { foo.~T (); } // { dg-error "10:invalid use of member" }
};
B<int> b;
template <typename T, typename S> ... |
google | android | using25 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/using25.C | 293 | utf_8 | 86d0cde4583e0865063c62ed09ffe0da | // PR c++/21682
namespace one {
template<typename T> void fun(T);
}
using one::fun;
template<typename T> void fun(T); // { dg-error "conflicts" }
template<typename T> void funr(T);
namespace oner {
template<typename T> void funr(T);
}
using oner::funr; // { dg-error "conflicts" }
|
google | android | void10 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/void10.C | 180 | utf_8 | b98f8ca68199027ec91aea21199d5807 | //PR c++/28736
template<void> struct A // { dg-error "not a valid type" }
{
template<typename> friend struct B;
};
template<typename> struct B {};
B<int> b;
|
google | android | memfriend12 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/memfriend12.C | 750 | utf_8 | 3efbba635759c97e9b452f6d5ba9696a | // { dg-do compile }
// Nested class of class template as friend
template<class T> struct A
{
struct B
{
void f();
};
};
template <class U> class C {
int i;
template<class T> friend struct A<T>::B;
};
template<class T> struct A<T*>
{
struct B
{
void f();
};
};
template<> struct A<char>
{
struc... |
google | android | crash72 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash72.C | 360 | utf_8 | 5af3f62d9558cd52f4d5aa70db89dd19 | // PR c++/29225
// { dg-do compile }
template <typename L, typename R> bool operator< (L x, R y);
struct T { int t (); };
class S {};
struct U
{
typedef int (T::* M) ();
M m;
bool operator() (S &x)
{
T a;
return (a.*m) < x; // { dg-error "invalid use of non-static member" }
}
};
void foo (S... |
google | android | virtual3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/virtual3.C | 200 | utf_8 | 80050623e3a03161c85c255ebddd41e9 | // PR c++/51620
template<int> class A
{
virtual ~A(); // { dg-error "non-deleted|private" }
};
struct B : A<0>, A<1> // { dg-error "deleted|context" }
{
B() {} // { dg-error "context" }
};
|
google | android | partial-specialization2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/partial-specialization2.C | 210 | utf_8 | 85762b85724149f8854c0c886e8d724f | // PR c++/54653
template <class T> struct A;
template <class T> struct A<T*> {
template <class U> struct B;
};
template <class T> struct A<T*>::B<T*> { }; // { dg-error "too few template-parameter-lists" }
|
google | android | crash116 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash116.C | 150 | utf_8 | 1ec1f2242385bbd641d2a127f8932ab5 | // PR c++/38634
template<int> struct A
{
A();
};
template<int N, char> A<N>::A() // { dg-error "template|required" }
{
struct B {};
}
A<0> a;
|
google | android | ptrmem3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem3.C | 340 | utf_8 | 171d82f45a76129388539c01e3212ec9 | template <typename T,double (T::*fun)() const>
struct I {
};
struct R {
R() { }
};
class H: public R {
public:
H(): R() { }
double& f() { return a; }
double f() const { return 1.0; }
double a;
};
struct A {
typedef I<H,&H::f> F;
A() { }
}; |
google | android | spec13 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/spec13.C | 207 | utf_8 | e9df140ef024c36c2a7761c13a353434 | // { dg-options "-w" }
template <typename T>
struct S {
int i;
template <typename U> void f(U) {}
};
template<>
template <typename U>
void S<int>::f(U) { i; }
void f() {
S<int> s;
s.f<int>(3);
}
|
google | android | operator12 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/operator12.C | 131 | utf_8 | 33665504734fdf4b39f0165ee4e84f64 | // PR c++/59707
struct T {
template<class D> operator D*() const;
};
void f(T x) {
x < x; // { dg-error "no match" }
}
|
google | android | arg7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/arg7.C | 304 | utf_8 | 9fda611eb6ff85fc5c7bbaaf0b553563 | // PR c++/27425, 34274
template<typename T> struct A
{
template<template<T> class> struct B {}; // { dg-error "void|mismatch|expected" }
// { dg-bogus "not supported" "" { target *-*-* } 5 }
template<T> struct C; // { dg-error "void" }
B<C> b;
};
A<void> a; // { dg-message "required" }
|
google | android | anon2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/anon2.C | 327 | utf_8 | 989ad07a7ee0d8ab918018598ad338ab | // PR c++/28279
// finish_static_data_member_decl was confused by the anonymous
// namespace causing TREE_PUBLIC to be unset
template<typename T>
struct is_pointer_impl {
static const bool value = true;
};
namespace {
class prefix_name_mapper {};
}
static const bool val = is_pointer_impl<prefix_name_mapper>::v... |
google | android | typedef16 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typedef16.C | 372 | utf_8 | 7af5e83153c54bd7a3a8638675111507 | // Origin PR c++/26693
// { dg-do compile }
struct C0
{
};
template<class T, class U>
struct C1
{
typedef C0 TypedefedC0;
template<class W>
void foo (TypedefedC0 *, W)
{
}
template<class W> C1 (W w)
{
TypedefedC0 c;
foo (&c, w);
}
};
C0 c0;
C1<int, char> c1 (&c0); |
google | android | inherit2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/inherit2.C | 344 | utf_8 | 13bd5309700c34e9e01c5bd7fd620d7b | // PR c++/5658
struct A {
typedef int iterator;
};
template <typename T>
struct B: public A {
template <typename U>
struct iterator {
};
B() { }
};
int main()
{
B<int> a;
} |
google | android | spec6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/spec6.C | 189 | utf_8 | b03b7960945086593b8859887c9f2b8e | template <bool, int> struct X {};
template <bool C> struct X<C,1> {
typedef double* type;
type foo () const;
};
template <bool C>
typename X<C,1>::type
X<C,1>::foo () const {}
|
google | android | void2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/void2.C | 143 | utf_8 | 28483e5e5ebefbb2745d92348d976139 | // PR c++/27496
// { dg-do compile }
template<int> struct A
{
template<void> friend class X; // { dg-error "void|valid type" }
};
A<0> a;
|
google | android | spec7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/spec7.C | 367 | utf_8 | c815e2045db2912ff4ac5e6626f81264 | // { dg-do compile }
// PR c++/6440: Specialization of member class template.
template<class T> struct A
{
template<class U> struct B {};
};
template<> template<class U>
struct A<int>::B
{
void f();
template <class V> void g(V);
};
template<> template<> template <class V> void A<int>::B<char>::g(V)
{
}
A<in... |
google | android | error51 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/error51.C | 199 | utf_8 | 3c08b15f6277a5473570a67c16790b25 | // PR c++/26572
template<int> void foo()
{
struct A; // { dg-error "declaration" }
struct B : A {}; // { dg-error "invalid use of incomplete" }
}
template void foo<0>();
|
google | android | incomplete6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/incomplete6.C | 320 | utf_8 | 680d8b21efe347eaf74be447cf3f4544 | // PR c++/48115
template<typename> struct templ { };
template<typename T> T declval();
typedef int (*F2)(...);
template<int> struct Int { };
template<typename F, typename T>
struct S
{
template<typename A>
Int<sizeof( declval<F>()(T()) )>
f(A);
};
int main()
{
S<F2, templ<int> >().f(0);
}
|
google | android | typedef30 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typedef30.C | 554 | utf_8 | b530d5da183724034637ef2b351372d2 | // Origin: PR c++/43206
// { dg-do compile }
template<class A> struct NumericTraits{ typedef A TInputImage;};
template<class B> class CovariantVector{};
template<class C> struct Image{ typedef C PixelType;};
template<class H, class E, class D>
class F {
typedef H G;
typedef
typename NumericTraits<typename G::Pix... |
google | android | sfinae11 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/sfinae11.C | 1,508 | utf_8 | 52303ab3e71ec37ab5f5099984d9715b | // DR 339
//
// Test of the use of the comma operator 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> struc... |
google | android | koenig3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/koenig3.C | 316 | utf_8 | 84d2678d3ce8241c254dd0501f0e4816 | // PR c++/13157
namespace aa
{
double abs(double);
long double abs(long double);
}
namespace fu
{
template <class T>
struct X
{};
template <class T>
X<T> test(X<T> x)
{
using ::aa::abs;
return abs(x);
}
template <class T>
X<T> abs(X<T>);
X<int> x;
X<int> z = test(x);
}
|
google | android | unify6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/unify6.C | 599 | utf_8 | 64a0956716b0f07d4c38edfd9b83783a | void Baz ();
template <typename T> void Foo1 (T *); // #1
template <typename T> void Foo1 (T const *a) {a (1);} // #2
template <typename T> T const *Foo2 (T *);
template <typename T> void Foo3 (T *, T const * = 0); // { dg-message "note" }
void Bar ()
{
Foo1 (&Baz); // #1
Foo2 (&Baz);
Foo3 (&Baz);
Foo3 (&Baz, &... |
google | android | crash43 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash43.C | 212 | utf_8 | 445602937029d55446b2a4e962079812 | // PR c++/24687
extern "C" {
template<typename _Tp> // { dg-error "C" }
struct ___is_pod {
enum {
__value = (sizeof(__gnu_internal::__test_type<_Tp>(0)))}; // { dg-error "declared|expected" }
|
google | android | new8 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/new8.C | 263 | utf_8 | b24f740838d028187b26372fe5358fca | // PR c++/34336
// { dg-do compile }
struct A;
template <class T>
struct S
{
T *m;
T &operator* () { return *m; }
};
struct B
{
B (const A &);
};
template <class T>
struct C
{
C ();
S<A> c;
};
template <class T>
C<T>::C ()
{
B *b = new B (*c);
}
|
google | android | sfinae3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/sfinae3.C | 334 | utf_8 | df17c39af3a33df1f3370cca4ca51b18 | // PR c++/24671
// { dg-do compile }
template<typename> struct A
{
typedef int X;
static const int i = 0;
};
template<typename> struct B
{
B(const B&);
typedef typename A<char[A<B>::i]>::X Y; // { dg-error "forbids zero-size array" }
template<typename T> B(T, Y);
};
B<int> b(0,0); // { dg-message "required... |
google | android | vtable2 | .C | toolchain/gcc/gcc-4.9/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<inn... |
google | android | access28 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/access28.C | 858 | utf_8 | f1f5a04f41640e7625de6d557491ab7d | // PR c++/49663
struct Nosm
{
int m_R;
};
namespace dx {
struct onc
{
typedef void(*Cb)();
onc(Cb cb);
};
struct grac
{
template<class Derived> static void once();
};
template<class Derived>
struct tonc : onc
{
tonc() : onc(&grac:... |
google | android | array27 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/array27.C | 206 | utf_8 | 3cb1ac965144a7e2ac355e9da62cbd89 | // PR c++/47808
// { dg-options "" }
template <typename T>
inline T abs (T const & x) { return x; }
template <typename T>
void f (T)
{
typedef int ai[(abs(0.1) > 0) ? 1 : -1];
}
int main()
{
f(1);
}
|
google | android | cond2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/cond2.C | 178 | utf_8 | cee015aea6aaf262f8a4bd6e5cba2962 | // PR c++/11962
// { dg-options "" }
template<int X> class c;
template<int X, int Y> int test(c<X ? : Y>&); // { dg-error "omitted" }
void test(c<2>*c2) {
test<0, 2>(*c2);
}
|
google | android | static22 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/static22.C | 157 | utf_8 | bae55093a55e080f11929eea52536a38 | // PR c++/26266
template<typename> struct A
{
static const int i = 1;
static const int j = i;
static const int k = int(j);
int x[k];
};
A<char> a;
|
google | android | canon-type-13 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/canon-type-13.C | 303 | utf_8 | cd9ee9fa890caf720c7949acb76887b6 | // { dg-do compile }
template<class T>
struct S0
{
};
template<class T>
struct S1
{
};
template<class T, template<class T> class A, template<class T> class B = A>
struct C
{
B<T> m;
};
void
foo()
{
C<int, S0> s;
S0<int> s0;
s.m = s0;
} |
google | android | local-fn1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/local-fn1.C | 104 | utf_8 | 29182ba864d966fb7660afbfb5b53867 | // PR c++/60605
template <typename T = int>
struct Foo {
void bar() {
void bug();
}
};
|
google | android | nontype6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/nontype6.C | 452 | utf_8 | 8d83959dfcae7f4db0064f352d0a81a3 | // { dg-do compile }
// Origin: <v dot haisman at sh dot cvut dot cz>
// PR c++/13957: Improved error message for type in template (when non-type
// is expected).
template <class T>
struct A
{
typedef int type;
};
template <class T>
void func(void)
{
(void)A<T>::type(); // { dg-error "non-type" "non-type" }
// ... |
google | android | error7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/error7.C | 145 | utf_8 | 3eacbecd65bcd0b71a23a9e2127f6e27 | // PR c++/13314
// { dg-options "-O2" }
struct A { template <int> struct B; };
struct A::B {}; // { dg-error "" }
A::B<0> b; // { dg-error "" }
|
google | android | error37 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/error37.C | 264 | utf_8 | 34ab2aefdfc2ee66c4a1c5d1830304e9 | // { dg-do compile }
// PR C++/29388
// We used to ICE in is_ancestor because we would use int as the context of foo
// but that is invalid.
template<int> struct A
{
typedef int T;
void foo();
};
template<int N> void A<N>::T::foo() {} // { dg-error "" }
|
google | android | explicit5 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/explicit5.C | 475 | utf_8 | bfbe469c91f678acc5c06f6a7a92f9c6 | // { dg-do compile }
// Failed to spot specialization using a template-id expr
template <typename n> class A {};
template <int m> class R {};
template <typename n, typename x> struct Trait { enum {m = sizeof (n)}; };
template <typename n, typename x> R<Trait<n,x>::m> f(A<x>);
template <> R<Trait<char,char>::m> f<char>(... |
google | android | friend25 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/friend25.C | 293 | utf_8 | 39dede1aeda6ca93984f81431de77fb6 | // { dg-do compile }
// PR c++/12369: ICE for specialization of member function template
// as friend in ordinary class.
struct A {
template<class T> T* make() { return new T(); }
};
struct B {
friend B* A::make< B >(); // (1)
}; |
google | android | anonunion2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/anonunion2.C | 75 | utf_8 | e24e587208bea5e0c0322cdeb130ec21 | template <int i>
struct S
{
S () { union { int a; }; a = 0; }
};
S<0> s;
|
google | android | static8 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/static8.C | 139 | utf_8 | 6dbdfa91bc4e4ea29a3ec7f4b44ba16f | // PR c++/17585
template <void (*p)(void)> struct S03 {};
class C03 {
public:
static void f(void) {}
void g(void) { S03<&f> s03; }
};
|
google | android | crash20 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash20.C | 322 | utf_8 | 7d60f1e42e3a0cb9fb843525c06fc428 | // { dg-do compile }
// ICE with incompletable type.
class INC;
template <typename T> class B {};
template<typename T> void Foo (B<T> &);
void Foo (INC &);
void Baz (INC *p)
{
Foo (*p);
} |
google | android | crash50 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash50.C | 148 | utf_8 | b775d6787ef17bc0e7018ea9b737dab4 | // PR c++/27398
// { dg-do compile }
struct A
{
template<int> void* foo(; // { dg-error "primary-expression|initialization|static|template" }
};
|
google | android | canon-type-7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/canon-type-7.C | 343 | utf_8 | d4dd1fcb5ba5fa6c770548eb750325c0 | // Origin PR c++/39754
// { dg-do compile }
struct Foo {};
template<typename> struct A ;
template<typename T ,typename = A<T> > struct B { } ;
template<class W, class>
struct D
{
typedef W X;
A<X (Foo::*) (X)> a ;
};
template<class Y>
struct E
{
B<Y (Foo::*) (Y)> b ;
};
E<int> e ; |
google | android | arg4 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/arg4.C | 109 | utf_8 | c306ff6eb2399c47b955c0f32952ba01 | // PR c++/23437
template <void (*p)()> struct S {
static const int i = 10;
};
void g();
int a[S<g>::i];
|
google | android | crash114 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash114.C | 100 | utf_8 | 9cf3fd890329936ea0594b310d9a64c1 | // PR c++/34892
template<int=..., int=0> struct A {}; // { dg-error "expected primary" }
A<0> a;
|
google | android | scope1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/scope1.C | 126 | utf_8 | b8b893e1844c502297d1e4e9591779ef | // PR 8327
template <class T>
class X
{
static const int a = 5;
static T b[a];
};
template <class T> T X<T>::b[X::a];
|
google | android | using28 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/using28.C | 275 | utf_8 | cb0bcba86115588eec939f8284e3cf91 | // PR c++/37140
struct C
{
static const int block_size = 1;
};
template <typename T> struct A {
typedef C type;
};
template <typename T> struct B : public A<T> {
using typename A<T>::type;
static const int block_size = type::block_size;
};
template class B<int>;
|
google | android | typedef28 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typedef28.C | 476 | utf_8 | 92286e7865372a4b9fb799f96e02fe6a | // Origin: PR c++/42820
// { dg-do compile }
template <class T> struct vector{};
struct Traits{struct Primitive{struct Id{};};};
template <class Tree, class Polyhedron> struct Tree_vs_naive
{
typedef typename Tree::Primitive Primitive;
void f() const
{
typedef vector<typename Primitive::Id> Id_vector;
}
... |
google | android | asm1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/asm1.C | 160 | utf_8 | b8d7ae2a709e06f2d49e19cfb00e77d3 | // PR c++/24761
// { dg-do compile }
template <int>
int f (int i)
{
asm ("# %0 %1" : "+r" (i));
return i;
}
int main ()
{
return f<0> (0) + f<1> (0);
}
|
google | android | nontype3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/nontype3.C | 1,056 | utf_8 | 2c3d3cb13e4af8be22483a8bb60a13d2 | // { dg-do compile }
// { dg-options -std=c++98 }
// Origin: <drow at gcc dot gnu dot org>,
// <giovannibajo at gcc dot gnu dot org>
// c++/13243: Template parameters of non integral or enumeration type can't be
// used for integral constant expressions. ADDR_EXPR and INDIRECT_REF are
// invalid too.
templat... |
google | android | typedef19 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typedef19.C | 340 | utf_8 | ec20f420bcfc33beb8df2d77cdb4fbc2 | // Origin PR c++/40007
// { dg-do compile }
class A
{
typedef int mytype; // { dg-error "'typedef int A::mytype' is private" }
};
template <class T>
class B : public A
{
};
template<class T>
class B<T*> : public A
{
mytype mem; // { dg-error "within this context" }
};
B<int*> b; |
google | android | pr23510 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/pr23510.C | 576 | utf_8 | 2508212bf0488ba173ec772a114e4626 | // { dg-do compile }
// { dg-options "-ftemplate-depth-15" }
template<unsigned int nFactor>
struct Factorial
{
enum { nValue = nFactor * Factorial<nFactor - 1>::nValue }; // { dg-error "depth exceeds maximum" "exceeds" }
// { dg-message "recursively required" "recurse" { target *-*-* } 6 }
// { dg-error "incomp... |
google | android | dtor5 | .C | toolchain/gcc/gcc-4.9/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 | android | friend11 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/friend11.C | 341 | utf_8 | c1eab5b806b63596b0fa26a471273823 | /* PR c++/53 */
/* { dg-do compile } */
template <class T>
struct A {
template <class U> class B;
// Did not compile with gcc-2.95.2 (linux i686) :-(
template <class S> template <class U> friend class A<S>::B;
};
template <class S> template <class U> class A<S>::B {
};
int main(){
A<double>::B<double>... |
google | android | ref6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/ref6.C | 240 | utf_8 | be5ada7fe947b5c46a81b039d0695560 | // PR c++/53816
template <typename T>
struct S { int v () const; };
template <typename T>
struct V : public S<T> {};
struct U
{
V<int> v;
template<typename T>
struct W
{
W (U const &x) { V<int> const &v = x.v; v.v(); }
};
};
|
google | android | inline1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/inline1.C | 484 | utf_8 | e11043be34a3a4669d6240f263aa30d2 | // { dg-do compile }
// { dg-options "-fno-default-inline -O0" }
// { dg-final { scan-assembler-not "\n_?_ZN1X3FooIiEEvT_\[: \t\n\]" } }
// PR 10047. bogus warning.
struct X
{
template <typename T> static void Foo (T) {}
};
extern template void X::Foo<int> (int); // extern, so don't emit it
int main () {
X::Foo (... |
google | android | array16 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/array16.C | 168 | utf_8 | 53d279c2d582bce6b0ed40786c57eb25 | // PR c++/28886
template<typename> struct A;
template<typename T, int N> struct A<T[N]> {};
template<typename T, int N> struct A<const T[N]> {};
A<const int[1]> a;
|
google | android | typedef13 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typedef13.C | 333 | utf_8 | 4cc56d549324ccc8454d729e8ff28a06 | // Origin: PR c++/26693
// { dg-do compile }
class A
{
typedef int mytype; // { dg-error "typedef int A::mytype' is private" }
};
template <class T> class B : public A
{
mytype mem; // { dg-error "within this context" }
};
B<int> b; // { dg-message "required from here" } |
google | android | pr29633 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/pr29633.C | 360 | utf_8 | ddd54fa2d302cf8f37c4512b75025445 | // PR c++/29633
template <typename T>
struct Class1
{
void testfn1(void);
};
template <typename T>
class Class2
{
public:
void testfn2(void)
{
Class1<T> * tc_a;
do
{
int x = 0;
}
while (tc_a && tc_a->testfn1); // { dg-error "invalid use of member" }
}
};
int main(void)
{
Class2<i... |
google | android | crash54 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash54.C | 129 | utf_8 | dc113f6f407f869c16ea1bfd3923f2c0 | //PR c++/28269
template<int> struct A;
struct __attribute__((unused)) A<0<; // { dg-error "template argument|unqualified-id" }
|
google | android | unify8 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/unify8.C | 479 | utf_8 | d04f9d4f8d36c0325245fb8a7df506ad | // { dg-do link }
// PR 21799: deduction of cvqualifiers on member functions was wrong
template <class T> void f (T &, void (T::*)() );
template <class T> void f (const T &, void (T::*)() const) {}
struct X {
void g() const {}
};
const X *x;
int main () {
f (*x, &X::g);
} |
google | android | qualttp17 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/qualttp17.C | 455 | utf_8 | f6386fff12139cd2f16e3ef57915da43 | // { dg-do compile }
// { dg-options "-fno-inline -fabi-version=1 -Wno-abi" }
struct A
{
template <class T> class B {};
};
template <template <class> class TT> struct X
{
};
template <class T> void f(X<T::template B>)
{
}
int main()
{
X<A::B> x;
f<A>(x);
}
// { dg-final { scan-assembler "\n_?_Z1fI1AEv1XIN1T1BEE\[: \... |
google | android | crash68 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash68.C | 328 | utf_8 | c1f00d9dd86a49d2de34225f9a691ce2 | // PR c++/33035
template<class A>
struct a {
template<class B>
struct b {
template<class C>
void f()
{
struct g
{
~g() {}
};
}
... |
google | android | error9 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/error9.C | 85 | utf_8 | 6c82c4d5cc4e1f6f70e1b41aa6299b35 | // PR c++/10926
struct Foo
{
template <int i>
~Foo(); // { dg-error "" }
};
|
google | android | ptrmem21 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem21.C | 627 | utf_8 | d789c4b198aaf983e81643a1d995a8da | // PR c++/43868
// { dg-options "-g" }
struct Foo
{
virtual void do_something() = 0;
};
template <typename T>
struct Foo_impl;
template <typename R, typename O>
struct Foo_impl<R (O::*)() const> : public Foo
{
struct Helper
{
typedef int Some_type;
operator Some_type () const { return 0; ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.