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 | memclass4 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/memclass4.C | 1,076 | utf_8 | 459bb772f22194a2eec4a3d69444edf3 | // Origin: PR c++/42824
// { dg-do compile }
template<int T>
class int_ {
};
template<int T, int T2>
class Unit {
public:
Unit(const Unit<T, T2>& other) {}
};
template<int T>
class Quan {
public:
Quan(void) {}
template<int T2>
Quan(double value, Unit<T, T2> unit) {}
};
typedef Quan<0> Scalar;
templ... |
google | android | sfinae5 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/sfinae5.C | 964 | utf_8 | d489a85672b2d956beff65b15b095039 | // DR 339
//
// Test of the use of member functions with SFINAE
typedef char yes_type;
struct no_type { char data[2]; };
template<typename T> T create_a();
template<bool, typename T = void> struct enable_if { typedef T type; };
template<typename T> struct enable_if<false, T> { };
template<typename T>
typename ena... |
google | android | memfriend15 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/memfriend15.C | 526 | utf_8 | 2f6bfd79513e89f2607e42561cd9acaa | // { dg-do compile }
// Nested class of class template as friend
template<class T> struct A
{
struct B1
{
};
struct B2
{
void f();
};
};
class C {
int i; // { dg-error "private" }
template<class T> friend struct A<T>::B1;
};
template<class T> void A<T>::B2::f()
{
C c;
c.i = 0; // { dg-error "con... |
google | android | nontype10 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/nontype10.C | 246 | utf_8 | e9af055ac6a0774b7565e0722c861adb | // { dg-do compile }
// Contributed by: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
#include <cstddef>
template <int T> struct A {};
template <void* T> struct B {};
A<NULL> a; // { dg-warning "NULL" }
B<NULL> b; // { dg-error "" }
|
google | android | crash101 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/crash101.C | 173 | utf_8 | 565c1bfc2d04d65f64253e16e35798d9 | // PR c++/44039
struct locale { };
template<class charT>
void
foo()
{ locale::locale(); } // { dg-error "cannot call|function-style" }
void
bar()
{ foo<char>(); }
|
google | android | canon-type-8 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/canon-type-8.C | 1,604 | utf_8 | 14a090fd842facce354c55bdb935647d | // PR c++/45984
// We were getting different canonical types for matching types because
// TYPE_ALIGN wasn't propagated to all the variants fast enough.
// { dg-options "" }
typedef __SIZE_TYPE__ size_t;
enum { chunk_size = 16 };
typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
typedef float... |
google | android | virtual4 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/virtual4.C | 248 | utf_8 | e8e64daa7b3951eb853a386477a44c63 | // PR c++/56243
struct A
{
virtual int String ();
};
struct F: A { };
struct G
{
F value;
};
struct D
{
template <int>
void Verify()
{
G x;
F& name = x.value;
name.String();
}
};
int main()
{
D d;
d.Verify<42>();
}
|
google | android | using29 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/using29.C | 356 | utf_8 | 97d5663b600fcdde53f2a0e991d27e6e | // PR c++/58047
template <int N>
struct print_arg { };
struct const_holder {
static const int CONSTANT = 42;
};
template <typename T>
struct identity {
typedef T type;
};
template <class T>
struct test_case : public identity<T> {
using typename identity<T>::type;
print_arg<type::CONSTANT> printer;
};
templ... |
google | android | cond | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/cond.C | 424 | utf_8 | 3f33c9a7b6007a62a4f60e27a3126fc3 | // PR c++/8080
// Bug: the transformation in finish_while_stmt_cond produced something
// that tsubst_expr handled badly. Fixed by not doing the transformation
// while parsing a template.
class TObject {};
struct TIter {
TObject *operator()();
};
template<class T>
void get_root_object(TIter& iobj) {
... |
google | android | inherit5 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/inherit5.C | 106 | utf_8 | c617d0614fa2c65ab23502fc466e2592 | struct A
{
template<int> void foo();
};
template<int N> struct B : A
{
B() { foo<N>(); }
};
B<0> b;
|
google | android | qualttp10 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/qualttp10.C | 292 | utf_8 | cf85da2c6ae4bcc2396f5f90e574f5cd | // { dg-do compile }
template <template <class> class TT> class C {
};
template <class T> struct D {
template <class U> class B {};
C<D<T>::template B> c;
};
D<int> d; |
google | android | typename8 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/typename8.C | 125 | utf_8 | a991f3b843fb36ef428fd3261f7cd8d6 | // PR c++/18738
namespace foo {
typedef int my_type;
}
template<typename T>
struct A {
typename foo::my_type bar();
};
|
google | android | using19 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/using19.C | 119 | utf_8 | 536e84362ae1859fc60fb98478875a43 | // PR c++/23211
// { dg-do compile }
struct A { int x; };
template <class T>
struct B: A
{
using T::x;
};
B<A> b;
|
google | android | lookup4 | .C | toolchain/gcc/gcc-4.8.3/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 | android | nontype21 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/nontype21.C | 178 | utf_8 | 523cd29e1a9c6006086eba2e934e53d4 | // PR c++/47705
template<char const * const x> class Something { };
extern char const xyz;
class SomethingElse:public Something<xyz> { }; // { dg-error "xyz. is a variable" }
|
google | android | typedef36 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/typedef36.C | 352 | utf_8 | e59bfbf54a4970ef59795380e9748f1c | // Origin: PR c++/45606
// { dg-do compile }
template<class T, class U = int>
struct S0
{
typedef int const_iterator;
};
template<class T>
struct Test
{
typedef S0<T> SAlias;
typedef typename SAlias::const_iterator const_iterator;
const_iterator begin ();
};
template<class T>
typename S0<T>::const_iterator
T... |
google | android | cond8 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/cond8.C | 133 | utf_8 | adb866a1e01955c650d2072de4ab9016 | // PR c++/51318
enum { e0, e1 };
template<bool B, int = B ? e0 : e1> struct A {};
template<typename T> struct B
{
A<T::X> a;
};
|
google | android | sfinae19 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/sfinae19.C | 1,047 | utf_8 | defcae158cfa0bf28425c808da6cab35 | // PR c++/44907
struct A { };
struct B
: public A { };
struct C
: public A { };
struct D
: public B, public C { };
template<bool, typename T = void> struct enable_if { typedef T type; };
template<typename T> struct enable_if<false, T> { };
template<typename From, typename To>
class mini_is_convertible
{
t... |
google | android | crash87 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/crash87.C | 314 | utf_8 | 3bc6fcf9c80c2cc5aa0d5c1c4ec47445 | // Origin: PR c++/38357
// { dg-do compile }
class BUG
{
public:
bool name() { return true; }
};
template <bool T>
struct BUG1_5
{
};
template <bool name>
class BUG2 : BUG
{
public:
typedef BUG1_5<name> ptr; // { dg-error "could not convert template argument" }
};
int main()
{
BUG2<false> b;
return 0;
}
|
google | android | mem-partial1 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/mem-partial1.C | 289 | utf_8 | 20021d29d7752d6eac42fc721092a468 | // PR c++/14032
template <typename T> struct outer {
template <typename T2, typename U>
struct inner {
static int f() { return inner<T,int>::N; };
};
template <typename U>
struct inner<T,U> {
static const int N = 1;
};
};
int i = outer<int>::inner<double,int>::f();
|
google | android | error3 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/error3.C | 113 | utf_8 | 0e96862a75ffea6e3b8357e5251534dd | // PR 12762
template <typename> struct A { A() {}};
typedef A<int> Ac;
Ac<double> a; // { dg-error "template" }
|
google | android | const4 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/const4.C | 135 | utf_8 | 54628fbcc903705b1f2ac3e7f67e0ea7 | // PR c++/48657
template<unsigned> struct A { typedef int T; };
template<unsigned> void f()
{
const unsigned D = 4;
A<D>::T t;
}
|
google | android | scope3 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/scope3.C | 170 | utf_8 | a7bf058a51ee7236a37311a73bf15c69 | // PR c++/41038
struct S
{
int size() const;
};
template<typename T>
struct Packer
{
int foo() {
return Packer::var.size();
}
const S& var;
};
|
google | android | instantiate3 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/instantiate3.C | 455 | utf_8 | 4e1ed3ad23d254ecb6d55d14a7797518 | // { dg-do compile }
// PR c++/7639
// ICE when accessing member with incomplete type.
class ACE_Null_Mutex; // { dg-error "forward declaration" }
template <class TYPE>
struct ACE_Cleanup_Adapter
{
TYPE &object ()
{ return object_; } // { dg-error "invalid" }
TYPE object_; // { dg-error "incomplete type" }
};
te... |
google | android | friend5 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/friend5.C | 183 | utf_8 | c9137614e9385e52c606c2d6e976e585 | // { dg-do compile }
namespace NS { template <typename number> class C; }
template <typename T> class X {
template <typename N> friend class NS::C;
};
template class X<int>;
|
google | android | qualified-id4 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/qualified-id4.C | 218 | utf_8 | 28aaef5d5b00c58669547efbbb5d1f13 | // PR c++/48593
template <typename T> struct foo
{
T data;
};
template<typename T> struct bar: public foo<T>
{
void some_func()
{
T* ptr = &(foo<T>::data);
}
};
int main()
{
bar<int>().some_func();
}
|
google | android | void5 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/void5.C | 102 | utf_8 | 29bdbfbe89710bff6d9ae0b64b0d06f5 | //PR c++/28640
template<void> struct A; // { dg-error "not a valid type" }
template<int> struct A;
|
google | android | error25 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/error25.C | 426 | utf_8 | 88e5836eca5b1d6a4995747486ad482a | // PR c++/31923
template<class T>
static void f1 ();
template<>
static void f1<void> (); // { dg-error "explicit template specialization cannot have a storage class" }
template<class T>
extern void f2 ();
template<>
extern void f2<void> (); // { dg-error "explicit template specialization cannot have a storage cla... |
google | android | access1 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/access1.C | 400 | utf_8 | 1c360b630dc5835068452f918bda8fb6 | // { dg-do compile }
// It is legal to specialize a template with a different class-key.
template<typename T> class X;
template<typename T> struct X<T *>
{
int i;
};
template<> struct X<int>
{
int i;
};
void foo ()
{
X<int *> xip;
X<int> xi;
xip.i;
xi.i;
} |
google | android | static9 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/static9.C | 156 | utf_8 | 015388506c66b2ace5fdc5fdfb038d4a | // PR c++/17524
template<typename T> struct A
{
static const T i = 0; // { dg-error "declared void" "void" }
};
A<void> a; // { dg-message "required" }
|
google | android | error19 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/error19.C | 269 | utf_8 | c141fe6a264c757500f6ee4ed30842f6 | // PR c++/23293
template < typename > struct P;
struct S;
void *unrelated_function()
{
typedef S K;
P < K > * p;
return p;
}
template < typename U >
void generate_warning()
{
U::x(); // { dg-error "P<S>" }
}
int main()
{
generate_warning< P < S > >();
}
|
google | android | memfriend17 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/memfriend17.C | 736 | utf_8 | e332cbd440f56b59e50c307b5f9d0e84 | // { dg-do compile }
// PR c++/13495: Nested class as template friend.
template<typename T>
class A{
public:
class B
{
void func1(void);
void func2(void);
};
};
template<typename Q>
class F1
{
friend class A<Q>::B;
enum { foo = 0 }; // { dg-error "private" }
};
template<typename Q>
c... |
google | android | typedef31 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/typedef31.C | 345 | utf_8 | 7d9df5543e66a309fcf55d85d3d98ca3 | // Origin: PR c++/43558
// { dg-do compile }
class Compressible;
template <class T, class EngineTag> class Engine;
template <class T>
class Engine<T, Compressible>
{
public:
typedef T Element_t;
//Element_t read(int);
T read(int);
};
template <class T>
T Engine<T, Compressible>::read(int)
{
}
Engin... |
google | android | using13 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/using13.C | 166 | utf_8 | acded0229c96d99f990ffa1d7bc1d123 | //PR c++/28051
template<int> struct A {};
template<int N> struct B : A<N>
{
using A<N>::operator typename A<N>::X; // { dg-error "no type named" }
};
B<0> b;
|
google | android | crash30 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/crash30.C | 268 | utf_8 | 4a6fae58852a7d58b5b482d48d97d11f | // PR c++/19034
template< bool C > struct B
{
};
template<typename S> int foo();
template<typename S> int foo1();
template<typename T> struct bar : public B <(sizeof(foo<T>()) == 1)>
{
};
template<typename T> struct bar1 : public B <(sizeof(foo1<T>()) == 1)>
{
};
|
google | android | conv1 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/conv1.C | 618 | utf_8 | 32f254d8ff7fc2dadfbb4100169c8710 | // { dg-do compile }
// PR 4361. Template conversion operators were not overloaded.
template <class T> struct Second;
template<class T> struct First
{
int Foo ();
template <class U> operator Second<U>();
template <class U> operator First<U>();
};
template <class T> int First<T>::Foo ()
{} // This is here to ma... |
google | android | static2 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/static2.C | 153 | utf_8 | aa3092ca5ce677694305032fa51a9486 | class A;
template<int A::* P>
class B
{
public:
static int A::* const p = P; // { dg-error "" }
};
class A
{
public:
int dummy;
B<&A::dummy> d;
};
|
google | android | ttp14 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/ttp14.C | 292 | utf_8 | a99b4acb0aa2cbfbcb364a40252b33e0 | // { dg-do compile }
// PR c++/18276: Template substitution of template template parameter
template<template<int> class> struct A;
template<int> struct B
{
template<template<int> class> friend class A;
};
B<0> b; |
google | android | static31 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/static31.C | 393 | utf_8 | 0a00544e785dd73fd42954ca54bb51e0 | // PR c++/32674
class C
{
static const int j = 3;
};
template<int> class A
{
static const int i1;
static const int i2;
static const int i3;
static const int i4;
};
template<int N> const int A<N>::i1(C::j);
template<int N> const int A<N>::i2 = C::j;
template<int N> const int A<N>::i3(C::j, 5); // { dg-error... |
google | android | vla2 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/vla2.C | 190 | utf_8 | 90a46ed40bed54c5195c9fe7b289492d | // PR c++/28879
// { dg-do compile }
// { dg-options "" }
struct A
{
static int i;
int j;
};
template<int> void foo ()
{
int x[A::i];
//int y[A().j];
}
void bar ()
{
foo<6> ();
}
|
google | android | void12 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/void12.C | 121 | utf_8 | 2a5a8ea7e9d97750e220094aef1a6168 | // PR c++/28639
template<void> struct A // { dg-error "not a valid type" }
{
static const int i = 1;
char a[i];
};
|
google | android | typename4 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/typename4.C | 190 | utf_8 | e539dae13a2fcf8c5c897799294fa8f0 | struct B { template <typename U> struct C; };
template <typename T> struct A { typedef typename T::C V; }; // { dg-error "not a type" }
void f () { A<B>::V p; } // { dg-message "required" }
|
google | android | crash29 | .C | toolchain/gcc/gcc-4.8.3/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 | android | inherit6 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/inherit6.C | 253 | utf_8 | f324fc75e2ce740742e957e7c3d64819 | // Origin PR c++/47172
// { dg-options "-std=c++0x" }
// { dg-do compile }
struct A
{
int f() const;
};
template <class T>
struct B : A { };
template <class T>
struct C : B<T>
{
void g();
};
template <class T>
void C<T>::g()
{
A::f();
}
|
google | android | error30 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/error30.C | 138 | utf_8 | 1c44a4e548dcd05ce209cc978411cde0 | // PR c++/33210
template<int> struct A;
template<template<typename> class B> A<B<int>::x> operator() (); // { dg-error "A<B<int>::x>" }
|
google | android | static5 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/static5.C | 318 | utf_8 | e5538275a590133055e80d957d76fab1 | // { dg-do compile }
// PR c++/12932: ICE address of static function as template argument
struct Test {
static void fun();
};
template <void (*fun)()>
void foo () { (*fun)(); }
template
void foo<Test::fun> (); |
google | android | dtor4 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/dtor4.C | 178 | utf_8 | 6e56714a3e1899ea002e689d9f32a53f | // PR c++/19440
// { dg-do compile }
template<int> struct A
{
~A<0>(); // { dg-error "parse error|declaration" }
}; |
google | android | call6 | .C | toolchain/gcc/gcc-4.8.3/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 | android | cond4 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/cond4.C | 244 | utf_8 | 8e0316960b82711ee5f56b8b469d01b1 | // PR c++/14369
struct A { };
template<class T>
struct X : A {
const A* bar() const
{ return this; }
const A& foo() const;
};
template<class T>
const A& X<T>::foo() const
{
const A* t = bar();
return *(t ? t : throw 0);
}
|
google | android | injected2 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/injected2.C | 172 | utf_8 | 32e85a6cdf780ae9bb7fc2da0ff02cee | // DR 1004
template <class T, template<class>class U = T::template B> struct A { };
template <class T> struct B {
template <class U> friend struct B;
};
A<B<int> > a;
|
google | android | sizeof3 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/sizeof3.C | 201 | utf_8 | f6e095b160ad28af4c90a4545b086bc6 | // The call to f is not potentially evaluated (3.2), so f<int> is not used,
// so it should not be required.
template <class T>
T f (T)
{
typename T::X x;
}
int main()
{
int i = sizeof (f(0));
}
|
google | android | deduce1 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/deduce1.C | 413 | utf_8 | a1ee69de58a5087bc0a5772d3b7f8309 | // { dg-do run }
template <typename T> int Foo (T const *)
{
return 1;
}
template <typename T> int Foo (T const &)
{
return 2;
}
template <typename T, __SIZE_TYPE__ I> int Foo (T const (&ref)[I])
{
return 0;
}
int main ()
{
static int array[4] = {};
return Foo (array);
} |
google | android | array26 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/array26.C | 761 | utf_8 | 8894a9a8ca6a93ffc4fb75f5882e3826 | // PR c++/57325
class valarray { int _M_data; };
template < typename > struct SimpleJet { valarray partials; };
template < class C > struct scoped_ptr_impl
{
scoped_ptr_impl (C *):data_ () { }
struct Data
{
C ptr;
};
Data data_;
};
template < class, class = int >struct scoped_ptr;
templat... |
google | android | ctor8 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/ctor8.C | 177 | utf_8 | 4ed33c1007f1b16ad7f6fa2811b165ba | // PR c++/28711
// { dg-do compile }
// { dg-options "" }
template<int> struct A
{
int x[1][1];
A() : x((int[1][]){{0}}) {} // { dg-error "except the first" }
};
A<0> a;
|
google | android | explicit-instantiation2 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/explicit-instantiation2.C | 214 | utf_8 | 6335a6cb9fd88717c1c31d2bc8b80c3e | // Bug 10968: implicit instantiation overrides explicit instantiation
// { dg-final { scan-assembler "_Z1fIiET_S0_" } }
template <class T> T f (T t) { return t; }
inline void g () { f (4); }
template int f (int);
|
google | android | invalid1 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/invalid1.C | 276 | utf_8 | 1b62efdc0a239bb15d76fcf36d229cc0 | // PR c++/14883
// { dg-options "-std=gnu++98" }
template < class T > struct DomainTraits {};
template < int Dim > class Interval;
template < class DT > class Domain {};
template <> class Interval < 1 >:public Domain < DomainTraits < Interval < 1 >
>> {}; // { dg-error "" }
|
google | android | ref1 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/ref1.C | 148 | utf_8 | c6c126721707d148ce66066de06c754b | // { dg-prune-output "mangled name" }
class a {} a1;
template <a & p> class b { public: b() { static_cast <a &> (p); } };
int main() { b <a1> b1; }
|
google | android | conv4 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/conv4.C | 440 | utf_8 | 8e48e2a0d63cdb353b4a07380c4cf577 | // { dg-do compile }
// PR 4361. Template conversion operators were not overloaded.
struct C
{
template <typename T2> operator T2 ()
{
return 1;
}
int Foo ()
{
return operator int ();
}
};
struct D
{
int Foo ()
{
return operator int (); // { dg-error "not defined" "" }
}
}; |
google | android | memclass2 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/memclass2.C | 360 | utf_8 | cdd15f6514749074086ff789caa565f2 | namespace ns {
template<typename T>
struct Foo {
template<typename U> struct Bar;
};
template<typename T>
template<typename U>
struct Foo<T>::Bar {
template<typename V> struct Baz;
};
template<typename T>
template<typename U>
template<typename V>
struct Foo<T>::Bar<U>::Baz {
Foo<... |
google | android | static30 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/static30.C | 223 | utf_8 | 0f679908d97cd1314de7de48e6a366cf | // PR c++/31992
template <int> struct A
{
static const int i1;
static const int i2;
};
template <int N> const int A<N>::i1(A<N>::i);
template <int N> const int A<N>::i2(3, A<N>::i); // { dg-error "expression list" }
|
google | android | pseudodtor2 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/pseudodtor2.C | 206 | utf_8 | 632dfaf82a330021f820250c7641745b | // PR c++/32384
// { dg-do compile }
template<typename S> struct D
{
typedef int T;
S foo ();
D () { foo ().~T(); } // { dg-error "is not of type" }
};
struct Z
{
Z () {}
~Z () {}
};
D<Z> d;
|
google | android | call2 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/call2.C | 170 | utf_8 | e459df3ddd572b111e8694073c95e5b9 | // PR c++/13592
struct S {
void operator()(int);
};
struct A {
template <typename> void foo();
S s;
};
template <typename> void A::foo() {
s(0);
}
|
google | android | qual2 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/qual2.C | 427 | utf_8 | 4bcab05d2626fd45890af6154fa22221 | // { dg-do run }
// PR9415. Forgot a lookup was scoped
int here;
int there;
struct B
{
virtual int activate() {return !here++;}
};
template <class K>
struct TPL : public B
{
int activate()
{
return !there++ && B::activate();
}
};
int main ()
{
TPL<int> i;
return !i.activate ();
} |
google | android | qualttp15 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/qualttp15.C | 500 | utf_8 | 9a2e0c2053d3ed911390c7839f875856 | // { dg-do compile }
struct A
{
template <class T> class B {};
};
template <template <class> class TT> struct X
{
TT<int> y;
};
template <class T> struct X<T::template B> // { dg-error "previous" }
{
T z;
};
template <class T> struct X<T::template B> // { dg-error "redefinition" }
{
T z;
};
template <class T> stru... |
google | android | qualttp8 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/qualttp8.C | 393 | utf_8 | 9e0e0d14c1f0eccec8ddc07d25401f12 | // { dg-do compile }
template <template <class> class TT> class C {
};
template <class T> struct D {
C<T::template B> c; // { dg-error "context" }
};
struct E {
private:
template <class T> class B {}; // { dg-error "private" }
};
D<E> d; // { dg-message "required" } |
google | android | const1 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/const1.C | 442 | utf_8 | 2096b2764f21d9bd35c06fef449c8404 | // PR c++/28385
// instantiating op() with void()() was making the compiler think that 'fcn'
// was const, so it could eliminate the call.
// { dg-do run }
extern "C" void abort (void);
int barcnt = 0;
class Foo {
public:
template<typename T>
void operator()(const T& fcn) {
fcn();
}
};
void bar... |
google | android | error29 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/error29.C | 175 | utf_8 | f942827c4c8f49e463f6196ed54942bb | // PR c++/33209
template<typename T> void foo(int, T::x); // { dg-error "T::x" }
template<template<typename> class T> void foo2(int, T<int>::x); // { dg-error "T<int>::x" }
|
google | android | sfinae21 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/sfinae21.C | 1,089 | utf_8 | abf4b7082d84a2ae41fd379ae916c34a | // PR c++/44908
struct A { };
struct B
: public virtual A { };
template<bool, typename T = void> struct enable_if { typedef T type; };
template<typename T> struct enable_if<false, T> { };
template<typename From, typename To>
class mini_is_convertible
{
typedef char one;
typedef struct { char arr[2]; } t... |
google | android | crash91 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/crash91.C | 146 | utf_8 | 76c753d62ba8d93c3e9903cc843055e7 | // PR c++/28293
template<int> void foo();
struct A
{
typedef void foo<0>(); // { dg-error "explicit template argument list not allowed" }
};
|
google | android | friend51 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/friend51.C | 178 | utf_8 | 95883d7d1e93cebf1fbefb7361ffe660 | // PR c++/38392
// { dg-do link }
void Function();
int main()
{
Function();
}
template <typename T>
struct Test
{
friend void Function() { }
};
template class Test<int>;
|
google | android | static21 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/static21.C | 392 | utf_8 | 2f60676fe6640df70e647dc7565eebca | // PR c++/24389
// { dg-additional-sources "static21-a.cc" }
// { dg-do link }
template<int dummy>
struct X
{
static const int n_primes = 256;
static const unsigned long primes[n_primes + 1];
};
template<int dummy>
const int X<dummy>::n_primes;
template<int dummy>
const unsigned long X<dummy>::primes[n_primes + ... |
google | android | friend33 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/friend33.C | 165 | utf_8 | ed2b58353effe4479fb3ba174d53040c | // { dg-do compile }
// PR c++/18733: Validation of template headers in friends
template<int> struct A
{
void foo();
};
struct B
{
friend void A<0>::foo();
};
|
google | android | crash89 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/crash89.C | 212 | utf_8 | 5c0b5dde8e71a56fe836865ad0444395 | // PR c++/34397
template<typename T, int = T()[0]> struct A // { dg-error "subscripted" }
{
typedef A<T> B;
};
A<int> a; // { dg-error "declaration" }
// { dg-prune-output "template argument 2 is invalid" }
|
google | android | crash71 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/crash71.C | 99 | utf_8 | 2376caa5d87197c3b097e52d7366811e | // PR c++/30659
extern "C" template A<char> foo(); // { dg-error "forbids|static data|expected" }
|
google | android | init1 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/init1.C | 233 | utf_8 | f30fe425de51d4cb2ab5ff05b71d616a | // { dg-do compile }
// PR c++/9457: ICE tsubst'ing initializers in templates.
template <typename> void foo (int count) {
int i = {count};
}
template void foo<int> (int); |
google | android | nontype2 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/nontype2.C | 151 | utf_8 | 00bcc57cb7d33b0250bf5efd8de34dbf | template <bool> struct A {};
template <bool> struct B
{
void foo()
{
const int i=0;
typedef A< i<=1 > C;
typedef A< i<=2 > C;
}
};
|
google | android | static10 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/static10.C | 580 | utf_8 | 76f7269587f9a5cc5dc6a0a3aa3b2d61 | // PR c++/19555
namespace __gnu_debug_def { }
namespace std
{
using namespace __gnu_debug_def;
template<typename _Tp> class allocator {}; // { dg-message "std::allocator" }
}
namespace __gnu_debug_def
{
template<typename _Tp,
typename _Allocator = std::allocator<_Tp> >
class vector
{
void
... |
google | android | init7 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/init7.C | 214 | utf_8 | 8b7e2ee31c044917df6c66a5933648fd | /* PR c++/31517. This used to ICE. */
/* { dg-do compile } */
template<typename> struct A
{
static const int i=0;
};
template<typename T> const int A<T>::i = 0=0; /* { dg-error "duplicate initialization" } */
|
google | android | ttp12 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/ttp12.C | 472 | utf_8 | 40c193a789a7cdd7cf2b6550ea810505 | // { dg-do compile }
// Check the type of non-type parameter in template template parameter
// only if it is dependent.
template <template <int* p> class T>
struct X {};
template <typename U, template <U* p> class T>
struct Y {
X<T> x;
};
template <int* p> struct Z {};
Y<int, Z> y1;
Y<char, Z> y2; // { dg-error "m... |
google | android | typename17 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/typename17.C | 182 | utf_8 | 81aeb9e1a8d50ce9fb2161d860dc83fa | // { dg-do compile }
// This should fail as A::foo<0> is not a typename at all.
struct A
{
template<int> void foo(int i)
{
typename A::foo<0>(i1); // { dg-error "" }
}
};
|
google | android | memfriend2 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/memfriend2.C | 874 | utf_8 | 3087e3c10234e9ef3745a413e6043727 | // { dg-do compile }
// Member function template of class template as friend
template <class T> struct A
{
template <class U> void f();
};
class C {
int i;
template <class T> template <class U> friend void A<T>::f();
};
template <class T> struct A<T*>
{
template <class U> void f();
};
template <> struct A<char>... |
google | android | friend49 | .C | toolchain/gcc/gcc-4.8.3/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 | android | qual1 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/qual1.C | 335 | utf_8 | 5512deff68cfd95af05439dc39d36f5c | // { dg-do compile }
template<class T>
class Link_array
{
public:
void sort (int (*compare) (T *const&,T *const&));
};
int shift_compare (int *const &, int *const &) {}
template<class T> void
Link_array<T>::sort (int (*compare) (T *const&,T *const&))
{
}
void f ()
{
Link_array<int> clashes;
clashes.sort (shi... |
google | android | crash19 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/crash19.C | 310 | utf_8 | f106c764c1ea09eba893e334ab4c71d8 | // PR c++/15165
struct S
{
template <class T> S(const T &e);
};
int operator *(const double, const S &);
template <class T>
struct X {
enum { SIXTY_FOUR=64 };
struct node {
unsigned char *ptr[sizeof(T)*SIXTY_FOUR];
void d() {}
};
node *head;
};
template struct X<int>;
|
google | android | crash44 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/crash44.C | 110 | utf_8 | 37c9686aad1de31e5858e6070db0fd76 | // PR c++/25858
namespace N {
template<int> struct A {};
}
struct B N::A<0> {}; // { dg-error "invalid" }
|
google | android | spec27 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/spec27.C | 124 | utf_8 | 5549dda851b53530395009f544d09652 | // PR c++/24139
template<typename T>
struct O {
struct I;
};
template<>
struct O<int>::I
{
I();
};
O<int>::I::I() {}
|
google | android | static35 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/static35.C | 196 | utf_8 | a9c4873781cdee9da4089c677e6bf829 | // PR c++/10291
// { dg-do link }
template <class T>
int foo ()
{
static int i;
struct S {
int bar () {
return i;
}
} s;
return s.bar ();
}
int main ()
{
foo<int>();
}
|
google | android | friend30 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/friend30.C | 239 | utf_8 | 1d0be2d7ae4ecc088986fba42e7ee292 | // PR c++/14930
template<typename T> class Point;
template<> class Point<double> {
friend class Plane;
double v;
};
struct Plane {
double get(const Point<double>& p);
};
double Plane::get(const Point<double> &p) { return p.v; }
|
google | android | crash51 | .C | toolchain/gcc/gcc-4.8.3/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 | android | crash23 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/crash23.C | 205 | utf_8 | 0ebb4bf976e610e29316a5634702a44e | // PR c++/17642
template<int dim>
int f(const int* const lsh, const int* const bbox, const int* const nghostzones, int d)
{
for (int d=0; d<dim; ++d)
lsh[d] - (bbox[2*d+1] ? 0 : nghostzones[d]);
}
|
google | android | array20 | .C | toolchain/gcc/gcc-4.8.3/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 | android | eh2 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/eh2.C | 268 | utf_8 | 2bd42f9c520c057a1250a8f6317934fb | // PR c++/23191
// { dg-do compile }
template<typename T> struct A
{
void foo() throw(typename T::X); // { dg-error "not a class" }
};
A<void> a; // { dg-message "required" } |
google | android | access21 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/access21.C | 230 | utf_8 | 43eff768ad4b6ca2454cbc1618596fb1 | // PR c++/48884
class X
{
static const int I = 42;
friend struct Y;
};
template <int I> struct A { };
struct Y
{
template <typename T>
static A<T::I> f(T t)
{
return A<T::I>();
}
};
int main()
{
Y::f(X());
}
|
google | android | crash61 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/crash61.C | 128 | utf_8 | da9e80228953353af5459e8d0d689e84 | // PR c++/29733
template<typename T> void foo()
{
T t = 0; // { dg-error "function type" }
}
void bar()
{
foo<int()>();
}
|
google | android | new2 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/new2.C | 198 | utf_8 | b8243d46589815a568bb0992cb04adec | // PR c++/21336
typedef __SIZE_TYPE__ size_t;
template<class _T> void* operator new( size_t Size, _T&);
struct B {
int a;
int* m() {
return new(a) int;
}
};
B* n() {
return new B();
}
|
google | android | mem-partial2 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/mem-partial2.C | 512 | utf_8 | ddb3b643353af64559b17335859b3a54 | // PR c++/14032
// { dg-do run }
template <bool compare>
struct outer
{
template <bool compare_with,bool second>
struct inner // unspecialized compare != compare_with
{
static inline bool test()
{
return false;
}
};
template <bool second> // specialization compare == compare_with
... |
google | android | varmod1 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/varmod1.C | 255 | utf_8 | 2acd5c5e77f3519d225ba9f87d2a09dd | // { dg-options "-w" }
template<typename T> void foo(T); // { dg-message "note" }
void bar()
{
int i;
int A[i][i];
foo(A); // { dg-error "" }
// { dg-message "(candidate|not a valid template argument)" "candidate note" { target *-*-* } 9 }
}
|
google | android | non-dependent9 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/non-dependent9.C | 273 | utf_8 | d2f711147c60030525ec70290e759fca | // { dg-do compile }
// Two-phase name lookup for address of member:
// Overloading function
struct S
{
int f();
int f(int);
};
template<int (S::*p)()>
struct X
{};
template <class T>
struct Foo
{
X<&S::f> x;
}; |
google | android | spec12 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/spec12.C | 472 | utf_8 | 5887f7286f7e8d72346052184c20f45e | // { dg-do compile }
// Contributed by: Wolfgang Bangerth <bangerth at dealii dot org>
// PR c++/14409: Accepts invalid function signature for explicit instantiation
struct X
{
template <typename U>
void foo (U) {}
template <typename U>
void foo_const (U) const {}
};
template void X::foo (int);
... |
google | android | using15 | .C | toolchain/gcc/gcc-4.8.3/gcc/testsuite/g++.dg/template/using15.C | 291 | utf_8 | d1497117d36ab359ffab3550670a6ba3 | // Reduced from the testcase for c++/29433
template <class T>
struct A: T
{
void f(typename T::type);
using T::f;
void g() { f(1); }
};
template <class T>
struct B: T
{ typedef int type; };
struct C
{
typedef double type;
void f();
};
int main()
{
A<B<A<C> > > a;
a.g();
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.