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 | sfinae10 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/sfinae10.C | 6,463 | utf_8 | 08e40e1ccd7635d093d248a8b6295788 | // DR 339
//
// Test of the use of various unary operators with SFINAE
// { dg-options "-fmessage-length=0 -pedantic-errors -Wno-long-long -ftrack-macro-expansion=0 " }
// Boilerplate helpers
typedef char yes_type;
struct no_type { char data[2]; };
template<typename T> T create_a();
template<typename T> struct type { ... |
google | android | arg8 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/arg8.C | 146 | utf_8 | ab34028d94948742f14d5352356f20d5 | template<typename T, void, typename U> // { dg-error "void" }
void foo(T, U, int) {}
void bar()
{
foo(0, 0, 0); // { dg-error "no match" }
}
|
google | android | qualttp18 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/qualttp18.C | 369 | utf_8 | 27c2a87e1e01b0107251445cfcd863c4 | // { dg-do compile }
struct A
{
template <class T> class B {};
};
template <template <class> class TT> struct X
{
TT<int> y;
};
struct C
{
X<A::template B> x; // { dg-error "template" "" { target { ! c++11 } } }
};
int main()
{
C c;
} |
google | android | friend9 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/friend9.C | 442 | utf_8 | 59b5bf61b7f6210d3cf3b9b45692794a | // { dg-do compile }
// PR c++/8099
// Partial specialization as friend class
template <int N, typename T> struct X;
template <typename T> struct X<1,T>;
template <typename P> class Y {
static int i;
template <int N, typename T> friend struct X;
friend struct X<1,P>;
};
template <typename T> struct X... |
google | android | array6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/array6.C | 174 | utf_8 | 294448858892b33e7116237b86ab785a | // PR c++/15287
struct S {};
struct Array {
S operator[](int);
} array;
void (S::*mem_fun_ptr)();
template <int> void foo() {
(array[0].*mem_fun_ptr)();
}
|
google | android | partial3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/partial3.C | 370 | utf_8 | 629ba41b72a6f4a573aa2b2fc66bf5c8 | // { dg-do compile }
// Origin: John Maddock <john at johnmaddock dot co dot uk>
// PR c++/13997: Error while matching partial specialization of array type
template <typename T>
struct is_array;
template <typename T, unsigned int N>
struct is_array<T[N]>;
template <typename T, unsigned int N>
struct is_array<const T... |
google | android | builtin1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/builtin1.C | 142 | utf_8 | 479ce6c62d0ab31928edd3bcef27bd5c | // PR c++/26559
template<bool> struct cond;
template<int> struct S {
void f(int i) {
cond<__builtin_constant_p(i)>();
}
};
S<1> s;
|
google | android | ref2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/ref2.C | 380 | utf_8 | a02f5612e9219b8cd807bc11c6baa86d | struct t
{
void f() const;
};
template <typename _Tp>
struct A
{
static t const& c;
};
template <typename _Tp>
void g(void)
{
A<_Tp>::c.f();
}
void h(void)
{
g<int>();
} |
google | android | void6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/void6.C | 81 | utf_8 | 3e91aaf45c71ca012016688078a0eac0 | //PR c++/28594
template<void, int> struct A; // { dg-error "not a valid type" }
|
google | android | crash17 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash17.C | 223 | utf_8 | 78327c2d24f8befdc8bd1b4f71aa2928 | template <int I>
struct A {
};
template <typename T>
struct B {
typedef typename T::type type;
static const type j = T::j;
A<j> b;
};
struct C {
typedef int type;
static const int j = 3;
};
int i = B<C>::j;
|
google | android | crash85 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash85.C | 274 | utf_8 | fac18fbcfe10c67843c28437a6b92d3c | // Origin: PR c++/37142
// { dg-do compile }
template<typename T, const T a, template <typename U, U u> class W> struct A {};
template<typename T, const T t> struct B {};
int
main ()
{
A<long, 0, B> a;
return 0;
} |
google | android | array18 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/array18.C | 162 | utf_8 | 8287a01c520c57028e25ecbe9d2cc181 | // PR c++/30924
template<typename T>
struct x {};
template<typename T, unsigned N>
struct x<T*[N]> {};
int main() {
x<int> a;
x<int*[10]> b;
return 0;
}
|
google | android | sfinae24 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/sfinae24.C | 689 | utf_8 | 957e4f34f89fa7b743d63c424c24528e | // PR c++/44969
template<bool, typename T = void> struct enable_if { typedef T type; };
template<typename T> struct enable_if<false, T> { };
template<typename Tp, typename Arg1, typename Arg2>
class mini_is_constructible
{
typedef char one;
typedef struct { char arr[2]; } two;
template<typename Tp1, ... |
google | android | ptrmem2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem2.C | 418 | utf_8 | af6766db6bcf0d158ef96c3e85df7e6b | // { dg-do compile }
// We'd tsubst a pointer to member reference
struct A {};
template <typename T> T A::* Foo (); // { dg-error "reference" }
void Baz ()
{
Foo <int &> (); // { dg-error "no matching function" "" }
// { dg-message "candidate" "candidate note" { target *-*-* } 14 }
} |
google | android | typedef6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typedef6.C | 246 | utf_8 | 22d0973a2715188331b77478c9e8d13e | //PR c++/28303
template<typename T> struct A
{
typedef struct typename T::X X; // { dg-error "expected identifier|two or more" }
};
template<typename T> A<T>::X::X() {} // { dg-error "not a type|forbids declaration|invalid use of" }
|
google | android | array23 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/array23.C | 159 | utf_8 | 0218cd33eef2d06ff1cf3f60e250aed7 | // PR c++/53989
struct Foo {
int value;
typedef Foo Foo2;
static Foo2 const foos[2];
};
template <class T> void g (T);
void bar() {
g(&Foo::foos);
}
|
google | android | crash2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash2.C | 339 | utf_8 | 334a10e7ca4d9cb602c8a73576e5fff3 | // { dg-options "" }
template <class EnumType>
class A
{
public:
static const EnumType size = max; // { dg-error "" }
int table[size]; // { dg-error "constant" }
};
template <class EnumType>
const EnumType A<EnumType>::size;
namespace N
{
enum E { max = 5 };
struct B
{
A<E> a;
};
}
int
main()
{
N::B ... |
google | android | sfinae27 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/sfinae27.C | 534 | utf_8 | ae991b2f4a945b814f41ee4ceb9ae3e5 | // Origin: PR c++/46162
struct small_type { char dummy; };
struct large_type { char dummy[2]; };
template<class T>
struct has_foo_member_variable
{
template<int T::*> struct tester;
template<class U> static small_type has_foo(tester<&U::foo> *);
template<class U> static large_type has_foo(...);
static const b... |
google | android | inherit3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/inherit3.C | 186 | utf_8 | 1c9360dccd50f544e413d4c00432d88e | template <typename T>
struct set {
void insert (const T&);
template <class X>
void insert (X, X);
};
struct C : public set<int> {
void f (const int i) {
insert (i);
}
};
|
google | android | arg5 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/arg5.C | 170 | utf_8 | 758ffa88d8ad3bfc5f84d3141ceeb13d | // PR c++/30534
// { dg-do compile }
template<bool> struct A;
template<int> void foo()
{
A<__builtin_constant_p(.)> a; // { dg-error "template argument|invalid" }
}
|
google | android | partial8 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/partial8.C | 125 | utf_8 | 2b23d416282107a906fcf6e2b3a898e7 | // PR c++/32505
template <class T> struct A { };
A<int*> a;
template <class T> struct A<T*> { }; // { dg-error "A<int\\*>" }
|
google | android | aggr-init1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/aggr-init1.C | 120 | utf_8 | 9b4320ebd3b1162890f33545ae1eb4e7 | // PR c++/46903
struct A {};
struct B {
void *(*a)();
};
template <typename T> void *CreateA() {}
B b = {CreateA<A>};
|
google | android | conv13 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/conv13.C | 174 | utf_8 | c31c403acbaa655ae0413e1d4350ae4b | // PR c++/52088
struct S
{
template <typename T>
operator T *() { return 0; }
};
int main()
{
S s;
delete s; // { dg-error "ambiguous|template|pointer" }
}
|
google | android | pr58878 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/pr58878.C | 1,342 | utf_8 | bf2a6b6f0f8991958562eeb56f4d4738 | // PR c++/58878
// Template-members of non-template class
struct A
{
template <typename t> // { dg-error "shadows" }
void f()
{
int t = 1; // { dg-error "declaration" }
}
template <typename t>
void g();
};
template <typename t> // { dg-error "shadow... |
google | android | error8 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/error8.C | 107 | utf_8 | 087bbcdc150fa765a03be550dd7193ce | // PR c++/11116
template <typename T> struct S {};
void f() {
throw S (); // { dg-error "template" }
}
|
google | android | cond7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/cond7.C | 206 | utf_8 | 4adf5b8994d7d8d914745e2569281502 | // PR c++/34270
// { dg-do compile }
// { dg-options "" }
void foo ()
{
__typeof__ (0 ?: 0) x;
__decltype (0 ?: 0) y;
}
template<int> void bar ()
{
__typeof__ (0 ?: 0) x;
__decltype (0 ?: 0) y;
}
|
google | android | qualified-id6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/qualified-id6.C | 115 | utf_8 | c8588eeab6350990eb0794100158ead1 | // PR c++/54913
struct E
{
static const int& e;
};
template<typename>
struct R
{
R() { E::e; }
};
R<int> r;
|
google | android | overload13 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/overload13.C | 236 | utf_8 | a47f093138ae4461a058f2bc00d23fb8 | // PR c++/56998
class Secret;
char IsNullLiteralHelper(Secret* p);
char (&IsNullLiteralHelper(...))[2];
struct C
{
int val() { return 42; }
};
template <typename T>
unsigned f()
{
return sizeof(IsNullLiteralHelper(C().val()));
}
|
google | android | ttp19 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/ttp19.C | 184 | utf_8 | 00132c35b440c6f38de75bfaed01af9d | // PR c++/27689
void f (...);
template <template <typename> class F, typename T> void f (F<T>);
template <typename> struct foo { struct bar {}; };
void g (foo<int>::bar x) { f(x); }
|
google | android | error22 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/error22.C | 191 | utf_8 | 54b3e85a8d8f9bc805e7795860ec08ba | //PR c++/27821
struct A
{
template<void (A::*)()> struct B {};
void ::foo(); // { dg-error "invalid use" }
B<&A::foo> b; // { dg-error "incomplete type|template argument" }
};
|
google | android | dependent-name4 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/dependent-name4.C | 349 | utf_8 | 147338e18276d105fca28005404df2a8 | // { dg-do compile }
// Dependent arrays of invalid size cause template instantiation failure.
// We'll get an error message (duplicate matching templates) if the first
// pattern is incorrectly allowed to match.
template<int M> void foobar (int (*) [M] = 0 );
template<int M> void foobar ( );
void fn (void)
{
fo... |
google | android | defarg3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/defarg3.C | 542 | utf_8 | e55baeaf118c452b9f707b8236ee86b1 | // { dg-do compile }
// PR c++ 11596
template <int V, bool F = V < 1> struct A { enum { value }; };
template <int V> struct B { enum { value = A<1>::value }; };
int ary[!B<1>::value ? 1 : -1];
template <int V, bool F = V < 1> struct A1 { enum { value = 1}; };
template <int V> struct A1<V,false> { enum { value}; };
temp... |
google | android | non-dependent14 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/non-dependent14.C | 129 | utf_8 | 1600f68e67fb6396c6b980337441f30d | // PR c++/64251
class DictionaryValue {};
template <typename T> void CreateValue(T) {
DictionaryValue(0);
CreateValue(0);
}
|
google | android | void3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/void3.C | 133 | utf_8 | 30d3ef85884811b1e84895da90d2a724 | //PR c++/28637
template<void> struct A {}; // { dg-error "not a valid type" }
A<0> a; // { dg-error "type" }
|
google | android | crash14 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash14.C | 159 | utf_8 | 7c732ef3b17279bd746eb1196b0d76fe | // { dg-options -std=c++98 }
template <int T> class foo { public: foo() { } class Z { };};
template <int I[2]> void dep7(foo<I[0]> *) { } // { dg-error "" }
|
google | android | typedef14 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typedef14.C | 220 | utf_8 | 906e6fd9c2cee3f79fa553d5d06adfdb | // Origin: PR c++/26693
// { dg-do compile }
template <class T>
struct A
{
typedef int mytype;
void
foo ()
{
mytype v = ~static_cast<mytype> (0);
}
}; |
google | android | qualttp5 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/qualttp5.C | 586 | utf_8 | 2dca6e0250f75868ac66daef15cdbb55 | // { dg-do compile }
template <class U> struct A
{
template <class T> class B {}; // { dg-message "operator=|no known conversion" }
};
template <template <class> class TT> void f()
{
TT<int> y;
y = 0; // { dg-error "no match" }
// { dg-message "candidate" "candidate note" { target *-*-* } 13 }
}
template <class T> ... |
google | android | unify7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/unify7.C | 446 | utf_8 | ef808a68d269a5f2b1da508db1d2b2b3 | // PR c++/3518
template <typename T> void Foo (const T &);
template <typename T> void Baz (const T (*)()); // { dg-message "note" }
int &f ();
int main()
{
Foo (f);
Baz (f); // { dg-error "no matching function" "" }
// { dg-message "(candidate|incompatible cv-qualifiers)" "candidate note" { target *-*-* } 13 }
} |
google | android | pseudodtor1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/pseudodtor1.C | 431 | utf_8 | b1805d4b386b8dcd432f41c68e255100 | // PR c++/32384
// { dg-do compile }
struct A
{
typedef int T;
T foo ();
A () { foo ().~T (); }
};
template<typename> struct B
{
typedef int T;
T foo ();
B () { foo ().~T (); }
};
template<typename T> struct C
{
T t;
C () { t.~T (); }
};
template<typename S> struct D
{
typedef int T;
S foo ();... |
google | android | typedef37 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typedef37.C | 1,030 | utf_8 | eb3abfc5e71e3a935092fd52c8240bfb | // Origin: PR c++/47398
// { dg-do compile }
template<int>
struct A
{
typedef int INT;
};
template<int I>
struct transform
{
static int bar();
};
template<class T, int a, class U, int b>
struct B
{
typedef typename A<a>::INT TINT;
void baz();
};
template<class T, int a, class U>
struct B<T, a, U, 1>
{
typ... |
google | android | qualttp19 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/qualttp19.C | 918 | utf_8 | 5d01ff95ca3a7d8da4e70d7477555e72 | // { dg-do compile }
// PR 2645
template <typename T>
struct call_traits
{
public:
typedef T type_less_spec;
};
template <typename T>
struct call_traits<T&>
{
typedef T type_more_spec;
};
int main()
{
int num;
// Two typedefs lead to the instant. of the less spec. ("wrong") template
typedef int& r_type;... |
google | android | dependent-expr4 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/dependent-expr4.C | 342 | utf_8 | b4bc25a86f512c4a58cc90654edd346f | // { dg-do compile }
// PR c++/12573: COMPONENT_REFs must be inspected for dependness.
// Or, more specifically OFFSETOF.
template <bool> struct S;
template <typename K> struct Y {
int x;
};
template <class T> struct Z {
S< (bool)(__builtin_offsetof (Y<T>*, x) == 0) >
s;
}; |
google | android | nontype13 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/nontype13.C | 372 | utf_8 | 01f5dcd70f36488761ff2e33d0886f6d | // PR c++/19004
template<typename T>
struct Dummy
{
void evil()
{
this->template tester<true>();
}
template<bool B>
void tester()
{
bar<evil>()(); // { dg-error "constant|template" }
}
template<bool B>
struct bar
{
void operator()()
{ }
};
};
int main()
{
Dummy<int> d;
... |
google | android | arg2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/arg2.C | 363 | utf_8 | 53755221bef2585c59ef84cc5ef48a46 | // { dg-do compile }
// PR 9708. We accepted a local class
template <typename T> class X {};
void fn ()
{
class L {};
X<L> f; // { dg-error "uses local type|trying to instantiate|no type|invalid type" "" { target { ! c++11 } } }
} |
google | android | instantiate4 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/instantiate4.C | 243 | utf_8 | 7d69f16e359b40571c6da6dde60dde8d | // { dg-do compile }
// PR c++/10682: Typedef to enum template instantiation logic.
template <typename T>
struct Foo {
enum E {a,b,c};
typedef E EE;
};
void Baz(Foo<int>::EE x); |
google | android | operator1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/operator1.C | 519 | utf_8 | b690784559e05afd43e95b8cf36b03eb | class test
{
public:
float operator[]( int index )
{
return testFloat[index];
}
private:
float testFloat[3];
};
template < class typeA > float
operator*(
typeA a,
float b
)
{
return a[0] * b;
}
template < class typeB > float
operator*(
float a,
typeB b
)
{
return a * b[0];
}
template < class typeA, class... |
google | android | friend52 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/friend52.C | 175 | utf_8 | 7f28d81dd24446e217e792a31a338161 | // PR c++/50344
// { dg-options "" }
template <typename T> class C
{
friend T;
int i;
};
struct S
{
int f()
{
C<const S> c;
return c.i;
}
};
|
google | android | friend46 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/friend46.C | 177 | utf_8 | b6050fc706b8413aeac096dd69086d72 | // PR c++/27714
template<typename> struct A
{
static void* operator new(__SIZE_TYPE__);
template <typename T> friend void* A<T>::operator new(__SIZE_TYPE__);
};
A<int> a;
|
google | android | using4 | .C | toolchain/gcc/gcc-4.9/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 (... |
google | android | friend20 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/friend20.C | 121 | utf_8 | 9d4f5b3213673d62379489a71f82b196 | template <class T>
struct A
{
friend void bar(A<T> a) {}
};
void bar(A<int>);
int main()
{
A<int> a;
bar(a);
}
|
google | android | crash49 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash49.C | 78 | utf_8 | cf864ea56a274c6c9a392f3a5f2f5910 | // PR c++/27102
template <typename T>
void T::foo; // { dg-error "invalid" }
|
google | android | crash102 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash102.C | 116 | utf_8 | f75072de1c2abdfca708b732cbfafa89 | // PR c++/45043
template < typename > class A;
template < typename T > A < T >::B::~B () // { dg-error "type" }
{}
|
google | android | spec24 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/spec24.C | 443 | utf_8 | 756d8965e92fbeb951248f1d353ce9a9 | template <int i> struct Mutex
{
static int mutex;
};
template <int i>
int Mutex<i>::mutex = {1};
template <> int Mutex<0>::mutex;
template <> int Mutex<0>::mutex = 0;
void g()
{
Mutex<0>::mutex = 0;
} |
google | android | crash11 | .C | toolchain/gcc/gcc-4.9/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 | android | typedef23 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typedef23.C | 303 | utf_8 | a2356f34f02acc6500996b77569f619f | // Origin PR c++/42069
// { dg-do compile }
struct A
{
static const int N = 0;
};
template<int> struct B {};
template<typename T, int>
struct C
{
typedef T U;
B<U::N> b;
};
template<typename T>
struct C<T*, 0>
{
B<T::N> b;
};
C<A*, 0> c; |
google | android | sfinae26 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/sfinae26.C | 1,381 | utf_8 | 8ddef44076eb6e19a48862cb31a69912 | // Origin: PR c++/46170
// { dg-do compile }
namespace util {
struct option_value {
};
template <class T> struct options_map_impl {
typedef T options_struct_type;
typedef bool (*opt_func)(const option_value&, options_struct_type&);
template <class V, V K> static bool set_member_constant(const opti... |
google | android | spec29 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/spec29.C | 397 | utf_8 | 9b290630d01c434872c1ed3db6067a4f | // PR c++/25855
// { dg-do run }
template <typename T> int qCompare(const T *t1, const T *t2) { return 1; }
template <typename T> int qCompare(T *t1, T *t2) { return 2; }
template <typename T1, typename T2> int qCompare(const T1 *t1, const T2 *t2) {
return 3; }
template<> int qCompare(const char *t1, const char *t... |
google | android | typedef3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/typedef3.C | 126 | utf_8 | ccd975f84b8531606ff90ff87ff98010 | // PR c++/19397
// { dg-do compile }
template<typename> struct A
{
typedef int ::template; // { dg-error "template" }
};
|
google | android | sfinae7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/sfinae7.C | 6,738 | utf_8 | ddcb9be925a64a1c49b8f8cc6c154cf3 | // DR 339
//
// Test of the use of various binary 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>... |
google | android | conv2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/conv2.C | 521 | utf_8 | 383f6618c1ccaddea23b36ff23d6d35e | // { dg-do run }
// PR 4361. Template conversion operators were not overloaded.
class C
{
public:
operator float () {return 2;}
operator int ()
{
return 0;
}
template<typename T>
operator int ()
{ return 1;
}
};
int main ()
{
C p;
int r;
r = p.operator int ();
if (r)
return r;
r... |
google | android | crash42 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash42.C | 150 | utf_8 | 7845da4d1b1384a76c0c0244fc45ef41 | // { dg-do compile }
// PR c++/22153
template<int> void foo();
template<int> struct A
{
template<> friend void foo<0>(); // { dg-error "" }
};
|
google | android | koenig1 | .C | toolchain/gcc/gcc-4.9/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 | android | spec16 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/spec16.C | 329 | utf_8 | 2bf40965be588d9d8b5690c13033104d | // { dg-do compile }
// Contributed by Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// PR c++/14497: Reject specialization without template headers
template <int N>
struct A {
template<int M> void B () ;
};
void A<0>::B<0>() { // { dg-error "specializing member 'A<0>::B<0>' requires 'template<>' synt... |
google | android | explicit-instantiation3 | .C | toolchain/gcc/gcc-4.9/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 do... |
google | android | sfinae25 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/sfinae25.C | 126 | utf_8 | 25850e96e227cc1a22c96c82d5c6ff4c | template <int I>
struct A { };
template <int J>
void f(A<1/J>);
template <int J>
void f(...) { }
int main()
{
f<0>();
}
|
google | android | non-dependent5 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/non-dependent5.C | 153 | utf_8 | 7e000c3eaeb33b0cda5191bb78ee313d | // PR c++/15299
template <class T> void fun_ptr(T (*)());
template <class T> T bar();
template <class> void foo () {
fun_ptr(bar<int>);
}
|
google | android | spec36 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/spec36.C | 322 | utf_8 | 1ff4e553eeebbb6941b32728ea24e2cf | /* PR c++/38089 */
/* { dg-do compile } */
struct basic_string
{
basic_string(const int __s);
};
namespace MyNS {
class MyClass {
template <typename T>
T test() { } /* { dg-error "from definition" } */
};
}
template <>
basic_string MyNS::MyClass::test() /* { dg-error "specialization of" } */
{ return 1; ... |
google | android | unify9 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/unify9.C | 560 | utf_8 | bc4e62ef740da093be11d3311efeee99 | // PR 21799: deduction of cvqualifiers on member functions was wrong
template <class T> void f (T &, void (T::*)() ); // { dg-message "note" }
struct X {
void g() const {}
};
const X *x;
int main () {
f (*x, &X::g); // { dg-error "no matching function" }
// { dg-message "(candidate|incomp... |
google | android | crash63 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash63.C | 165 | utf_8 | aa734f014cf5d00d10906b6c35b3de27 | // PR c++/29729
template<typename T> void foo(T)
{
struct A
{
template<int> struct B // { dg-error "local class" }
{
typedef B<0> C;
}
};
}
|
google | android | using3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/using3.C | 607 | utf_8 | 2131f7be9d523457118116995b368d74 | // { dg-do run }
// PR 9447. Using decls in template classes.
template <class T>
struct Foo {
int i (int) {return 1;}
};
struct Baz
{
int k (int) {return 2;}
};
template <class T>
struct Bar : public Foo<T> , Baz {
using Foo<T>::i;
using Baz::k;
int i (float) {return 3;}
int k (float) {return 3;}
int ... |
google | android | dependent-expr7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/dependent-expr7.C | 181 | utf_8 | 62547428f2604bbed7afb83c31bfb8cb | // Origin PR c++/48574
// { dg-do compile }
struct A
{
virtual void foo();
};
template <typename T>
void
bar(T x)
{
A &b = *x;
b.foo ();
}
void
foo()
{
A a;
bar(&a);
}
|
google | android | array1-2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/array1-2.C | 418 | utf_8 | 075227803fea6455eb958b3d2d173e9b | // { dg-do compile }
// { dg-options "-fabi-version=2" }
// 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 | android | error39 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/error39.C | 132 | utf_8 | 20b72e33a910404fc40a48eb851375f6 | // PR c++/14912
template <class T, int N=0, int X=1>
struct A
{
};
void foo(void)
{
A<void> a = 0; // { dg-error "A<void>" }
}
|
google | android | ptrmem8 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem8.C | 697 | utf_8 | 9d78085e54c695bfed1f05bcd67e42e8 | // { 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(); // { dg-message "note" }
int main ()
{
Get<&B:... |
google | android | spec25 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/spec25.C | 198 | utf_8 | ef8ae4f57ac3ac5d77c3bdca8c7ef5f1 | namespace N {
template <typename T>
struct S {
void f() {} // { dg-error "definition" }
};
}
namespace K {
template <> void N::S<char>::f() {} // { dg-error "different namespace" }
}
|
google | android | explicit-args2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/explicit-args2.C | 658 | utf_8 | 8c9d021c07761a64a71d7ed3a6cbd9f8 | // PR c++/37177
// { dg-do compile { target c++11 } }
#include <typeinfo>
namespace N1
{
template<class T> bool foo();
}
struct S
{
template <class T>
static bool foo();
template <class T>
bool bar();
};
template<class T> bool foo();
int main()
{
(void)(&S::bar<int>);
decltype(&S::bar<int>) a;
typ... |
google | android | koenig2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/koenig2.C | 233 | utf_8 | 5e527c865bacdb52386cdb2f216a99d4 | namespace nsp_foo {
struct A {};
struct foo {};
}
namespace nsp_bar {
void foo(nsp_foo::A) {}
template <class T>
void bar(T t)
{
nsp_bar::foo(t); // line 16
}
}
int main()
{
nsp_bar::bar(nsp_foo::A());
}
|
google | android | qualttp14 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/qualttp14.C | 436 | utf_8 | 872b95cdec1729cec20c4f30444d01c5 | // { dg-do link }
struct A
{
template <class T> class B {};
};
template <template <class> class TT, class T> struct X
{
TT<int> y;
T z;
};
template <class T> struct X<T::template B, T>
{
typename T::template B<int> y;
T z;
};
template <class T> struct C
{
X<T::template B, A> x;
};
int main()
{
C<A> c;
} |
google | android | error27 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/error27.C | 96 | utf_8 | 585707d1420049ffe49f33789d19dc53 | // PR c++/27211
struct A {};
template<int> void A::foo() {} // { dg-error "member function" }
|
google | android | call1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/call1.C | 251 | utf_8 | 11d89720e8ea4a5f11553338c13ffab9 | //PR c++/10804
// G++ was not emiting the function foo.
// { dg-do run }
template<class T>
struct A
{
A() { const void (*a)() = foo; }
static const void foo() {}
};
int main(int argc, char *argv[])
{
A<int> a;
} |
google | android | ttp21 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/ttp21.C | 130 | utf_8 | 54aa5e13e0b421f81c0decbd0545680e | // PR c++/28853
// { dg-do compile }
template<template<int> class A>
int A<0>::i; // { dg-error "template template parameter" }
|
google | android | offsetof2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/offsetof2.C | 174 | utf_8 | 4c88b26d0d4ab5c6ea7cbb37f1f8bbf4 | // PR c++/49085
template <class T>
struct A // { dg-error "declaration" }
{
int i, j;
int ar[__builtin_offsetof(A,j)]; // { dg-error "incomplete type" }
};
A<int> a;
|
google | android | non-dependent7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/non-dependent7.C | 278 | utf_8 | 545ef1f20e531a9708266594092c6d03 | // { dg-do compile }
// PR c++/13092: ICE taking address of member which is non-dependent
struct S
{
int i;
};
template<int S::*p>
struct X
{};
template <class T>
struct Foo
{
X<&S::i> x;
};
template struct Foo<void>; |
google | android | sizeof6 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/sizeof6.C | 324 | utf_8 | 8d7b68da161169ea74382da5f4a8c8fb | // { dg-do compile }
// Contributed by Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// PR c++/13683: bogus warning about passing non-PODs through ellipsis
struct B {};
struct NonPOD : B {};
struct A
{
static int check(...);
static NonPOD GetNonPOD(void);
enum { value = sizeof(A::check(A::GetNonPOD())) };... |
google | android | qualttp1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/qualttp1.C | 324 | utf_8 | b21ab1ce79ce2d2e11762d15de7d8e95 | // { dg-do compile }
struct A
{
template <class T> class B {};
};
template <class T> struct X
{
};
template <class T> struct C
{
X<T::template B> x; // { dg-error "type" }
};
int main()
{
C<A> c;
} |
google | android | spec35 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/spec35.C | 881 | utf_8 | cd8f83c943abc866c1492c441fa0144d | // PR c++/31923
// C++ DR 605 -- "...the linkage of an explicit specialization must be that of
// the template."
// { dg-require-weak "" }
// { dg-do compile { target i?86-*-* x86_64-*-* } }
template<class T>
static void f1 (T) { }
// { dg-final { scan-assembler-not ".glob(a|)l\[\t \]*_?_Z2f1IfEvT_" } }
template<>
v... |
google | android | crash109 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash109.C | 119 | utf_8 | b3167df4bc44e634fce27a27e383e9a4 | // PR c++/51328
template<typename T> struct A
{
void foo(A<T::~T>); // { dg-error "invalid use of destructor" }
};
|
google | android | error50 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/error50.C | 293 | utf_8 | 718b898f2c3a369d255568c91e4ef493 | // PR c++/57327
template<class T>
struct A {};
template<class T>
void f(A<T>&) {}
struct B : A<long> {};
struct C : A<char> {};
struct D : B, C {};
int main()
{
D d;
f(d); // { dg-error "no matching" }
} // { dg-message "'A<T>' is an ambiguous base" "" { target *-*-* } 18 }
|
google | android | recurse3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/recurse3.C | 207 | utf_8 | a5be65b82f1aef08aa55aeaa5da0c8d4 | // PR c++/44609
// { dg-options -ftemplate-depth=10 }
template<int N>
void f()
{
0 = 0; // { dg-error "lvalue required" }
f<N+1>(); // { dg-bogus "instantiation depth" }
}
int main()
{
f<0>();
}
|
google | android | crash94 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash94.C | 390 | utf_8 | ea031f0eed2506b6add80fa9a5f38b85 | // Origin: PR c++/42697
// { dg-do compile }
template<class Value_t>
class fparser
{
template<bool Option>
void eval2(Value_t r[2]);
public:
void evaltest();
};
template<>
template<bool Option>
void fparser<int>::eval2(int r[2])
{
struct ObjType {};
}
template<class Value_t>
void fparser<Value_t>::e... |
google | android | friend24 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/friend24.C | 408 | utf_8 | c81920c34b3ea8295fc494118d9e89af | // { dg-do compile }
// PR c++/495: Fail to locate primary class template that is
// injected by friend declaration.
template <int N> struct X
{
template <int dim> friend struct Y;
};
X<2> x;
template <int dim> struct Y
{
void f (Y);
void g (Y);
};
template <int dim> void Y<dim>::f (Y)
{
}
template <int dim> void... |
google | android | defarg17 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/defarg17.C | 132 | utf_8 | 5dfe23eb623c995388e9b3f314016e04 | // PR c++/60185
template<int> struct A
{
int i; // { dg-message "" }
A() { void foo(int=i); } // { dg-error "" }
};
A<0> a;
|
google | android | overload12 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/overload12.C | 571 | utf_8 | f1c7ecb7e178c68814982e97bdc5ecf1 | // { dg-do compile }
struct S {int x; int y;};
template<typename T>
int foo(T a, T b) {return a + b;} // { dg-message "template" }
template<typename T, typename T2>
int foo(T a, T2& b, T2 c) {return a + b;} // { dg-message "template" }
int foo(char*, S&); // { dg-message "foo" }
// { dg-message "candidate expects 2 a... |
google | android | operator9 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/operator9.C | 280 | utf_8 | 531b9dd05d20385dc30e947b3b6af083 | //PR c++/27670
template<operator+> void foo(); // { dg-error "before|non-function|template" }
void bar()
{
foo(); // { dg-error "no matching function" }
// { dg-message "(candidate|deduce template parameter)" "candidate note" { target *-*-* } 7 }
}
|
google | android | inherit7 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/inherit7.C | 228 | utf_8 | 6a5199dfcb2643c9c8c299d0de479f74 | // Origin: PR c++/48656
// { dg-do compile { target c++11 } }
struct A {
int f();
int f(int);
};
template <typename> struct B : A
{
};
template <typename T> struct C : B<T>
{
void
g()
{
A::f();
}
};
|
google | android | crash16 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/crash16.C | 308 | utf_8 | 0b7b35a94bb1a8a5457b2c3bd299d5e2 | // { dg-do compile }
// PR c++/10079
template <bool> struct A {};
template <typename> struct B
{
enum { e };
};
template <typename T> A<(B<T>::e && 0)> foo(T) {}
template <typename T> void foo(B<T>) {}
void bar()
{
B<int> b;
foo(b);
} |
google | android | non-dependent3 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/non-dependent3.C | 312 | utf_8 | 9c0fc4f566e5de8ff0339df3c3ef274d | //PR c++/11071
// Used to ICE
template <bool b> struct X {
template <typename T>
static int* execute(T* x) { return x; }
};
template <typename T> void foo() {
static bool const same = true;
X<same>::execute ((int*)0);
}
template void foo<int> (); |
google | android | delete1 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/delete1.C | 172 | utf_8 | 08e2480f72bcb72f3f0c69f74625bd4c | // PR c++/15890
template < typename T >
void operator delete ( void* raw ) { // { dg-error "" }
delete raw;
}
class A { };
int main() {
A* a = new A;
delete a;
}
|
google | android | delete2 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/delete2.C | 300 | utf_8 | f64b5dcbfa3d3051a358c8d1c1e8a878 | // PR c++/58119
template <class T>
struct A
{
operator T*();
template <class U>
operator A<U>();
};
template <class T>
struct B
{
operator T*();
template <class U>
operator A<U>*();
};
int main()
{
A<int> a;
delete a;
B<int> b;
delete b; // { dg-error "template|delete" }
}
|
google | android | nested5 | .C | toolchain/gcc/gcc-4.9/gcc/testsuite/g++.dg/template/nested5.C | 223 | utf_8 | 73ab67ac2716db374ac0d80e7ae5b200 | // PR c++/33959
template <typename T> struct A
{
struct C
{
template <typename U> struct D {};
};
template <typename S> static C::D<S> bar (S const &);
};
struct E {};
int
main ()
{
E e;
A<E>::bar (e);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.