plateform stringclasses 1
value | repo_name stringclasses 2
values | name stringlengths 1 78 | ext stringclasses 2
values | path stringlengths 15 1.11k | size int64 1 8.55M | source_encoding stringclasses 11
values | md5 stringlengths 32 32 | text stringlengths 0 8.49M |
|---|---|---|---|---|---|---|---|---|
google | chromium | friend49 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/friend49.C | 228 | utf_8 | 6d77be24cb0cbaa83d42b95befcf027c | // PR c++/29054
// { dg-do compile }
struct A
{
template <typename T, typename U> static void create (U) {}
};
struct B
{
friend void A::create <B, const char *> (const char *);
};
int
main ()
{
A::create<B>("test");
}
|
google | chromium | overload5 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/overload5.C | 511 | utf_8 | 71fab915b19ad597865cbe790d6ee455 | // PR c++/22621
struct foo {
typedef int (*fun)(int);
static int f(int); // overload between static & non-static
int f();
static int g(int); // non-overloaded static
};
template<foo::fun>
struct f_obj {
// something ..
};
f_obj<&foo::f> a; // OK
f_obj<foo::f> b; // OK (note: a and b are of... |
google | chromium | sfinae6_neg | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/sfinae6_neg.C | 1,302 | utf_8 | e54e8bfeb41272da8a3ce8638ca6f9de | // DR 339
//
// Test of the use of the function call operator with SFINAE
typedef char yes_type;
struct no_type { char data[2]; };
template<typename T> T create_a();
template<typename T> struct type { };
template<bool, typename T = void> struct enable_if { typedef T type; };
template<typename T> struct enable_if<fal... |
google | chromium | instantiate10 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/instantiate10.C | 972 | utf_8 | b6f93db83699b516b0d1578a6c9649ac | /* PR c++/39242, xplicit instantiation declaration prohibits implicit
instantiation of non-inline functions. */
/* { dg-do compile } */
/* { dg-options "-O" } */
class Rep {
public:
void unref() const { }
static void unref (const Rep * obj_r) { obj_r->unref(); }
};
template<typename _Tp, typename _Bt = _Tp... |
google | chromium | ptrmem8 | .C | native_client/pnacl-gcc/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 | chromium | typename5 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/typename5.C | 445 | utf_8 | 657b2e18e1c5bda47ab17e796163c009 | // { dg-do compile }
// PR c++/2513: typename handling when scope is dependent as
// described in DR108.
template <bool flag> struct Select {
typedef int Result;
};
template <template<class> class Pred> struct FindType {
typedef typename Select<true>::Result Result;
};
template <int bits> struct Int {
template<ty... |
google | chromium | template-id-4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/template-id-4.C | 311 | utf_8 | 3eeb73c9e211131164ee26dc577c50c2 | // PR c++/48157
struct AType
{
template<class AA>
void SomeFuncTemplate()
{ }
};
template < class T >
struct TTest2
{
template<T> struct helper;
template<class U>
static void check(helper<&U::template SomeFuncTemplate<int> > *);
};
int main()
{
TTest2< void (AType::*)() >::check<AType>(0);
}
|
google | chromium | ptrmem20 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ptrmem20.C | 302 | utf_8 | 81a6774120ce149534db6fc79b3ba354 | // PR c++/43079
struct A {};
struct B
{
void foo() const;
void foo();
};
template<void (A::*)()> void bar(); // { dg-message "note" }
void baz()
{
bar<&B::foo>(); // { dg-error "not a valid template argument|no match" }
// { dg-message "candidate" "candidate note" { target *-*-* } 15 }
}
|
google | chromium | bitfield1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/bitfield1.C | 146 | utf_8 | 2f3399aac63bff69580e94f66f716e0b | // PR c++/50280
struct S { int bf : 3; };
template<class _T1>
void make_pair(_T1& __x) {}
void foo() {
const S s = S();
make_pair(s.bf);
}
|
google | chromium | non-dependent2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/non-dependent2.C | 314 | utf_8 | 3ce6c8331c1ddbc56b2c89ca07992343 | //PR c++/11070
// Used to ICE
template <bool b> struct X {
template <typename T>
static int* execute(int* x) { return x; }
};
template <typename T> void foo() {
static bool const same = true;
X<same>::execute<int> (0);
}
template void foo<int> (); |
google | chromium | using8 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/using8.C | 283 | utf_8 | 4b82993be36fd76cdb24298731b1c1e6 | // { dg-do compile }
// PR c++/9810: Access checking for member function template
// appeared in using declaration.
struct A
{
template<class R> void F(R) {}
};
struct B: private A
{
using A::F;
};
int main()
{
B b;
b.F(3);
} |
google | chromium | nontype20 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/nontype20.C | 214 | utf_8 | 3d747fedb6daaf7d52479222a69439ee | // PR c++/48003
// { dg-options "-fpermissive -w" }
// Test that we allow integer overflow in constant exprs with -fpermissive
template<int N>
struct test
{
typedef test<N - 1> prior;
};
test<-2147483647-1> f;
|
google | chromium | memfriend7 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/memfriend7.C | 2,480 | utf_8 | 10bc6d2f48ce4d0b74af144a4996ddfa | // { dg-do compile }
// Member function of class template as friend
// Erroneous case: mismatch during specialization
template <class T> struct A {
template <class U> void f(U);
void g();
void h();
void i(int);
template <T t> void j();
};
class C {
int ii; // { dg-error "private" }
template <class U> t... |
google | chromium | friend8 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/friend8.C | 223 | utf_8 | ceb858e95982ac0af2e9168f31aea229 | template <int N> struct ivector
{
template <int r, int c> friend void
mult_mv ();
};
template struct ivector<3>;
template <int r, int c> void
mult_mv ()
{
c;
}
void get_local_point_pos ()
{
mult_mv<7, 3> ();
}
|
google | chromium | operator6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/operator6.C | 94 | utf_8 | b5bc56bf214d4c012ea8de74a6dea853 | // PR c++/27315
// { dg-do compile }
template void operator+; // { dg-error "non-function" }
|
google | chromium | array20 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/array20.C | 150 | utf_8 | dbd20d81c325cee68179c0a4fd156f81 | // PR c++/38950
template <typename T, T N> void f(T(&)[N]);
int main() {
int x[2];
unsigned int y[2];
f(x); // works
f(y); // ICE
}
|
google | chromium | typename11 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/typename11.C | 158 | utf_8 | 420551b6ca8dd7f866b6e96a62a9f7a0 | // PR c++/28999
namespace N
{
template<int> void foo();
}
template<int> struct A
{
friend void typename N::foo<0>(); // { dg-error "type|expected" }
};
|
google | chromium | array5 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/array5.C | 114 | utf_8 | c557bdb58ff52b9fc368185880923627 | // PR c++/15427
template<class T>
struct A
{
T foo;
};
template<class T>
struct B
{
A<int> _squares[2];
};
|
google | chromium | void7 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/void7.C | 184 | utf_8 | 507e9e60c4e8d6cbeaf93b654efa9b91 | //PR c++/28741
template<void> struct A // { dg-error "not a valid type" }
{
static int i;
};
A<0> a; // { dg-error "invalid type|not a valid type" }
|
google | chromium | static25 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/static25.C | 143 | utf_8 | 7b985567967838ede5e338abace5eafc | // PR c++/27819
struct A
{
static const char i = 1;
};
template<int> struct B
{
static const int j = A::i;
int x[int(j)];
};
B<0> b;
|
google | chromium | lookup1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/lookup1.C | 176 | utf_8 | 858241029bc9c5f2b0eb96ca1ff057a8 | template <class T0>
class A {
public:
class B;
};
template <class T0>
class A<T0>::B {
public:
class C;
};
template <class T0>
class A<T0>::B::C {
public:
A<T0> &a;
};
|
google | chromium | operator11 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/operator11.C | 394 | utf_8 | eb35e1face3b65b2aae71fc55558b420 | // PR c++/48594
// Test for uses of (X->*Y)() that don't actually involve a
// pointer to member function.
struct A { } a;
struct B { } b;
struct C * cp;
struct Func { void operator()(); };
Func operator->* (A, int);
typedef void (*pfn)();
pfn operator->* (B, int);
pfn C::*cpfn;
Func C::*cfunc;
template <class T>
... |
google | chromium | dtor1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/dtor1.C | 85 | utf_8 | c10faccbba72797e793c4697fe233f9c | struct A {};
template <typename T> struct B
{
B() { A().A::~A(); }
};
B<void> b;
|
google | chromium | nontype7 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/nontype7.C | 314 | utf_8 | cee023670861be047d45f0aa6daa937f | // { dg-do compile }
// Origin: C++ standard, [temp.arg.nontype]/2
template<class T, char* p> struct X {
X();
X(const char* q) { /* ... */ }
};
char p[] = "Vivisectionist";
X<int,"Studebaker"> x1; // { dg-error "string literal" }
X<int, p> x2;
// { dg-bogus "" "additional errors" { xfail *-*-* } 11 }
|
google | chromium | repo8 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/repo8.C | 347 | utf_8 | 7aaeeff16027161d626d21273f9ac79c | // PR c++/34340
// { dg-options "-frepo" }
// { dg-final { cleanup-repo-files } }
// { dg-require-host-local "" }
// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
struct A
{
int a;
};
template <typename T> struct D
{
static const A b;
};
template<typename T> const A D<T>::b = { 2 };
const A *x = ... |
google | chromium | using7 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/using7.C | 408 | utf_8 | b84e1ff61ee65ba43655de5d69616da1 | // { dg-do compile }
// PR 9447. Using decls in reopened template classes.
template <typename> struct A { int i; };
template <typename T> struct B : public A<T>
{
using A<T>::i;
int foo() const;
};
struct C {};
template <typename T> int B<T>::foo() const
{
return i;
} |
google | chromium | for1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/for1.C | 250 | utf_8 | 27ffc9918dee82089419624de1850354 | // PR c++/47388
// { dg-do compile }
// { dg-options "-fno-for-scope" }
template <int>
void
foo ()
{
int i;
for (i = 0; i < 16; i++)
;
for (int j = 0; j < 16; j++)
;
if (j != 16)
for (;;)
;
}
void
bar ()
{
foo <0> ();
}
|
google | chromium | explicit-instantiation3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/explicit-instantiation3.C | 549 | utf_8 | 7c2daced476ed6b72c25a10611af9a2c | // { dg-do compile }
// Origin: <sebor at roguewave dot com>
// c++/8266: Explicit instantiation of a template outside its namespace is
// broken
namespace N
{
template <class T> T foo (T)
{ return T (); }
struct A
{
template <int N>
struct B {};
};
template <int M>
struct C {};
template do... |
google | chromium | error42 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/error42.C | 375 | utf_8 | 0f72e7f5b78f19b4c40b2fd681e5db21 | // PR c++/40372
// { dg-do compile }
template <int> struct A
{
int i; // { dg-error "invalid use of non-static data member" }
friend void foo ()
{
int x[i]; // { dg-error "from this location" }
}
};
struct B
{
int j; // { dg-error "invalid use of non-static data member" }
friend int bar ()
{
... |
google | chromium | lookup4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/lookup4.C | 154 | utf_8 | 9932d99ab28768093ab672853377af03 | // PR c++/13950
template <class T> struct Base {};
template <class T> struct Derived: public Base<T> {
typename Derived::template Base<double>* p1;
};
|
google | chromium | crash29 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash29.C | 115 | utf_8 | ceec3c489e5f321a136749ba214020ac | // PR c++/18512
template <int> struct A {};
struct B : A<0>
{
void foo() { this->A<0>; } // { dg-error "" }
};
|
google | chromium | new1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/new1.C | 628 | utf_8 | 57b33208329c8d10ea904c3d123076a9 | // { dg-do run }
// { dg-options "-O2" }
struct Aint
{
~Aint ();
Aint ();
};
Aint::Aint () {}
Aint::~Aint () {}
static int count;
template <class T>
struct A
{
unsigned Blksize() const;
void f()
{
new T[Blksize()];
}
};
template <class T> unsigned A<T>::Blksize () const
{
count++;
return 1;
}
int... |
google | chromium | koenig1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/koenig1.C | 130 | utf_8 | 6dfc1674746db8a02b5504e177f5aca0 | namespace NS {
struct C {};
}
template <class T> void bar() { T t; foo (t); }
template void bar<NS::C> (); |
google | chromium | vtable2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/vtable2.C | 497 | utf_8 | d55a534d0d8361d48d4f9895d5fb658a | // Use a small template instantiation depth to speed up testing
// { dg-options "-ftemplate-depth-5" }
// { dg-do compile }
// PR c++/6749: Infinite loop generating vtable.
template <class T> struct inner {};
template <class T> struct parent {
virtual void f() // { dg-error "instantiation depth" }
{ parent<inn... |
google | chromium | friend21 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/friend21.C | 260 | utf_8 | 7ccd2fc3b3e573a3074eaf2980b008c9 | // { dg-do compile }
// PR c++/5421: ICE for specialization of member function template
// as friend.
struct B {
template <class T> void b();
};
template <class T> class A {
friend void B::b<T>();
};
static A<int> a; |
google | chromium | ttp2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ttp2.C | 354 | utf_8 | 55545b6f734664ea7227a639a1393d4f | // { dg-do compile }
template <class U> struct Alloc {};
template <class T, class U = Alloc<T> > struct Vector {};
template <template <class T, class U = Alloc<T> > class TT>
struct C {
TT<int> tt;
};
int main()
{
C<Vector> c;
} |
google | chromium | inherit4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/inherit4.C | 224 | utf_8 | 2b089e52426f6150cf26e18b4ada5122 | // PR c++/21008, DR 515
struct A {
int foo_;
};
template <typename T> struct B: public A { };
template <typename T> struct C: B<T> {
int foo() {
return A::foo_; // #1
}
};
int f(C<int>* p) {
return p->foo();
}
|
google | chromium | dependent-expr5 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/dependent-expr5.C | 4,581 | utf_8 | 0d2b76dcf0f4104ca64a41e659607c89 | // { dg-do compile }
// inspired in the failure reported in Red Hat bugzilla #168260.
template<class F> void bind(F f) {} // { dg-message "note" }
template<class F> void bindm(F f) {} // { dg-message "note" }
template<class F, class T> void bindm(F (T::*f)(void)) {} // { dg-message "note" }
template<class F> void bindn... |
google | chromium | conv10 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/conv10.C | 119 | utf_8 | 2c3b429768e3e6f954114fbd126e3122 | // PR c++/41994
template<typename T> struct A
{
operator T();
A() { T (A::*f)() = &A::operator T; }
};
A<int> a;
|
google | chromium | nontype12 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/nontype12.C | 1,173 | utf_8 | e4176144e393e4accb07877196c4e693 | // PR c++/20172
template<typename T> struct A
{
template<T> int foo(); // { dg-error "double" }
template<template<T> class> int bar(); // { dg-error "double" }
template<T> struct X; // { dg-error "double" }
};
A<char> a1;
A<double> a2; ... |
google | chromium | memfriend13 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/memfriend13.C | 1,021 | utf_8 | c4970b1b6d217a07e47b93130aff29c2 | // { dg-do compile }
// Nested class template of class template as friend
template <class T> struct A
{
template <class U> struct B
{
void f();
};
};
template <class V> class C {
int i;
template <class T> template <class U> friend struct A<T>::B;
};
template <class T> struct A<T*>
{
template <class U> s... |
google | chromium | cast1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/cast1.C | 451 | utf_8 | dae4547b0ed98c262ad1adff2778e177 | // { dg-do compile }
struct A
{
void foo();
};
template<int> void bar(A& a)
{
const_cast<A&>(a).foo();
static_cast<A&>(a).foo();
reinterpret_cast<A&>(a).foo();
((A&)a).foo();
}
template void bar<0>(A& a); |
google | chromium | sizeof13 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/sizeof13.C | 392 | utf_8 | 52cb6bded099df9ce613e3e3e21f7a8a | // PR c++/42623
// We should choose f(B) because f(A<undef>) involves applying sizeof to
// an incomplete class, so it is removed by SFINAE.
// { dg-do link }
struct undef;
template <typename U, int N = sizeof(U)> struct A { A(int); };
template <typename U> void f(A<U>);
template <typename U> struct B { B(int) { } }... |
google | chromium | dependent-args1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/dependent-args1.C | 221 | utf_8 | ddb49979db2f8e8e7e883106ad0c150c | // PR c++/27582
// { dg-do compile }
struct A
{
template<int> void foo();
};
template<int N, void (A::*)() = &A::foo<N> > struct B {};
B<int> b; // { dg-error "type/value mismatch|expected a constant|invalid type" }
|
google | chromium | meminit2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/meminit2.C | 694 | utf_8 | 49a8526a10802f5f264eca9873b6546a | // { dg-do compile }
// Origin: Mark Anders <mark dot a dot anders at intel dot com>
// PR c++/15503: disambiguators in base classes and mem-initializers
template <typename K1> struct O {
template <typename K2> struct I {};
};
template <typename T>
struct A : typename O<T>::template I<int> { // { dg-error "k... |
google | chromium | array9 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/array9.C | 277 | utf_8 | 9ff0e683b6d55fee7915dd8f28470138 | // PR c++/18429
int subtrees = 4;
template< class T >
struct Tree {
Tree* L[subtrees]; // { dg-error "" }
Tree* R[subtrees]; // { dg-error "" }
~Tree()
{
delete [] L[0]; // { dg-error "" }
delete [] R[0]; // { dg-error "" }
}
};
void f()
{
Tree<int> t;
}
|
google | chromium | using9 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/using9.C | 359 | utf_8 | 43e4887ef35fe0c5873b07345814a3d3 | // { dg-do compile }
// PR c++/17154: Using declaration in partial class template specialization.
template <int numrows, class T> struct A { void test_A() {} };
template <int numrows, class T> struct B {};
template <class T> struct B <3, T> : public A <3, T> {
using A <3, T>::test_A;
void test_B_spec() { test_A(); }
... |
google | chromium | memfriend11 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/memfriend11.C | 966 | utf_8 | 63a099d4fd981493045dce1eefbf9723 | // { dg-do compile }
// Nested class template of class template as friend
template<class T> struct A
{
template <T t> struct B
{
void f();
};
};
class C {
int i;
template<class T> template <T t> friend struct A<T>::B;
};
template<class T> struct A<T*>
{
template <T* t> struct B
{
void f();
};
};... |
google | chromium | static17 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/static17.C | 225 | utf_8 | a65d6e5ddc2f69a204f701eb15bc324b | // PR c++/23896
template <int> struct X {};
template <typename T> struct length {
static const int value = 2;
};
template <typename T> void foo () {
sizeof(X<length<T>::value>);
}
template void foo<int>();
|
google | chromium | crash13 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash13.C | 377 | utf_8 | 8f1d7823f3f9e94385fa5abb38b46d9e | // { dg-do compile }
// PR c++/11076: ICE for invalid access declaration containing typename.
template<typename, typename T=void> struct A
{
typedef A<T,T> B;
};
template <typename T> struct C
{
typedef typename A<T>::B X;
X::Y; // { dg-error "not a base type" }
};
C<void> c; // { dg-message "required" ... |
google | chromium | static11 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/static11.C | 90 | utf_8 | d208baa6490e1bda86ed7140d7cc233b | // PR c++/19826
template<typename T> struct A
{
static const T i = 1;
char a[i];
};
|
google | chromium | operator3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/operator3.C | 119 | utf_8 | 51da64bb1a35e2d4a874ecc36ed30236 | // PR c++/15640
struct A {
void foo(void);
};
template <int> void bar() {
A a;
a + a.foo; // { dg-error "" }
}
|
google | chromium | access3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/access3.C | 305 | utf_8 | bb203818faa22dcb1d2c8ada7ef4ec82 | // { dg-do compile }
// PR c++/5387
// Enforcing access of typename type.
template <class T> struct A {
typename T::template X<int> x; // { dg-error "this context" }
};
class B {
template <class T> class X {}; // { dg-error "private" }
};
int main()
{
A<B> ab; // { dg-message "required" }
}
|
google | chromium | stmtexpr2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/stmtexpr2.C | 344 | utf_8 | 5a43e87e10898038576202d6271981c9 | // Origin: PR c++/36408
// { dg-options "" }
// { dg-do compile }
template<int>
void
foo()
{
int i = ({ }); // { dg-error "void value not ignored" }
}
template<int>
void
bar()
{
int i = ({ ({}); }); // { dg-error "void value not ignored" }
}
int
main ()
{
foo<0> ();
bar<0> ();
} |
google | chromium | cond3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/cond3.C | 230 | utf_8 | 3dfcddf50f883d0eabd3e0a6a6f3be44 | // PR c++/13833
struct X {
template <typename T>
X & operator << (const T &t);
X & operator<< (int& (*p) (int&));
};
X x;
template <int> void foo () {
x << (1 ? "ok" : "failed");
}
template void foo<1>();
|
google | chromium | ref3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ref3.C | 209 | utf_8 | 3fe7102cd5d7b48abace464974ca16c3 | // PR c++/28341
template<const int&> struct A {};
template<typename T> struct B
{
A<(T)0> b; // { dg-error "constant|not a valid" }
A<T(0)> a; // { dg-error "constant|not a valid" }
};
B<const int&> b;
|
google | chromium | member4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/member4.C | 582 | utf_8 | 7f0db13593e12c1671ab63412653ea6c | // { dg-do compile }
// Contributed by Matty T. <mattyt-bugzilla at tpg dot com dot au>
// PR c++/13813 [DR206]: Check semantic constraints of members of
// non-dependent type at instantiation time.
// DR206 explains that this is ill-formed, no diagnostic required. We emit
// a diagnostic instead.
class E;
templ... |
google | chromium | void13 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/void13.C | 129 | utf_8 | 562f64a462f01cebdb6f2624c9cbaf03 | // PR c++/30299
struct A
{
int i;
};
template<void> struct B : A // { dg-error "not a valid type" }
{
B() { this->i; }
};
|
google | chromium | operator10 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/operator10.C | 186 | utf_8 | 7d7d9ae6a20d4aa195178afcaf07e852 | // PR c++/30535
// { dg-prune-output "note" }
struct A {};
template<A, typename T> int operator-(A, T); // { dg-error "not a valid type" }
int i = A() - 0; // { dg-error "no match" }
|
google | chromium | using4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/using4.C | 553 | utf_8 | cd698ebd98a80f55920d17ae629b4d9b | // { dg-do run }
// PR 9447. Using decls in template classes.
template <class T>
struct Foo {
int k (float) {return 1;}
};
struct Baz
{
int k (int) {return 2;}
};
template <class T>
struct Bar : public Foo<T> , Baz {
using Foo<T>::k;
using Baz::k;
int foo()
{
if (k (1.0f) != 1)
return 1;
if (... |
google | chromium | overload10 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/overload10.C | 245 | utf_8 | bb3445a10b57fa4869bad1f1cb774ecd | // PR c++40342
template <typename T1, typename T2> int f(T1 *, const T2 *); // { dg-error "" }
template <typename T1, typename T2> int f(const T1 *, T2 *); // { dg-error "" }
int (*p)(const int *, const int *) = f; // { dg-error "ambiguous" }
|
google | chromium | access16 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/access16.C | 214 | utf_8 | 2f37ed40bca28851af33f3bafa4181d9 | // PR c++/23842
struct S;
extern S *p;
template <class T> int f(T*, int y = ((T*)p)->x) {
return y;
}
struct S {
private:
int x;
template <class U> friend int f(U*, int);
};
int g() {
return f(p);
}
|
google | chromium | varmod1 | .C | native_client/pnacl-gcc/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 | chromium | using6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/using6.C | 168 | utf_8 | 6bc8a704452336d9d0ee978fef2a7f60 | namespace foo {
template<typename T>
struct A {};
}
namespace bar {
template<typename T>
struct A {};
}
namespace foo {
using bar::A; // { dg-error "" }
}
|
google | chromium | crash72 | .C | native_client/pnacl-gcc/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 | chromium | meminit1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/meminit1.C | 145 | utf_8 | e683d99e1fbbf1fb5b1fb18c8b553517 | // { dg-options "-std=gnu++98" }
template <class T >
struct S
{
S() : S() {} // { dg-error "base" }
};
S<int> s; // { dg-message "required" }
|
google | chromium | crash39 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash39.C | 214 | utf_8 | 30bbbe26494a0bd1a56a703fe4aae882 | // PR c++/22405
template <typename T> void foo(T &arg) { // { dg-error "declared" }
arg+=1;
}
template <typename T> void foo(T &arg) { // { dg-error "redefinition" }
arg+=2;
}
template void foo(float &arg);
|
google | chromium | vtable1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/vtable1.C | 315 | utf_8 | 98fb9a7526b5989b48ce49e7131f8f76 | // Test that vtables are set up properly for constructors and destructors
// of template classes.
// { dg-do run }
int r;
template <class T>
struct A {
virtual void f () { }
A() { f (); }
~A() { f (); }
};
struct B : public A<int> {
virtual void f () { ++r; }
};
int main ()
{
{ B b; }
return r;
}
|
google | chromium | explicit2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/explicit2.C | 128 | utf_8 | 44f3a8f925589bae9dc773b19a3fd2de | struct X {
template <class B> void foo(B);
};
template <class D>
void bar() {
X().foo<D>(1);
}
template void bar<int> ();
|
google | chromium | arg1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/arg1.C | 309 | utf_8 | 7a85bf47a7ccf37365dc9d0ed5813e3e | // { dg-do compile }
// PR 9978. We rejected a constant expression.
enum { val = 1 };
template <class T>
struct Bar
{
static const int A = val;
static const int B = A + 1;
}; |
google | chromium | operator7 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/operator7.C | 142 | utf_8 | 98c4cd89cdbe74a78e512f93f452daa8 | //PR c++/27493
// { dg-options "-std=gnu++98" }
template<operator T> void foo() // { dg-error "before|template" }
{
struct A {};
}
|
google | chromium | dtor2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/dtor2.C | 96 | utf_8 | 71d10b5b4cd6cb6cb8f6be930603b8e8 | struct Foo
{
template <int i>
~Foo() {} // { dg-error "" }
};
int main()
{
Foo f;
}
|
google | chromium | typename17 | .C | native_client/pnacl-gcc/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 | chromium | typedef36 | .C | native_client/pnacl-gcc/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 | chromium | koenig5 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/koenig5.C | 524 | utf_8 | 02dae2280971fe5ff910e6472b7a407a | // { dg-do compile }
// Contributed by David Abrahams <dave at boost-consulting dot com>
// PR c++/14143: Koenig lookup should only look into template arguments only
// if the argument is a template-id.
namespace fu
{
template <class T>
struct bar
{
struct baz {};
};
}
namespace axe
{
struct handle ... |
google | chromium | qualified-id1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/qualified-id1.C | 611 | utf_8 | 2a70b459ac169aad03656f55acdf1bd5 | // { dg-do compile }
// PR 11922
struct A
{
template <bool> struct B;
struct C;
};
template <> struct A::B<false> {};
template <typename T> void foo()
{
T::C (); // { dg-error "parsed as a non-type|if a type is meant" }
T::template B<false>(); // { dg-error "parsed as a non-type" "non-type" }
// { dg-messa... |
google | chromium | sfinae1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/sfinae1.C | 484 | utf_8 | d4a6fe33f1456d026d068d25f316aa9c | // PR c++/14337
template <bool> struct Constraint;
template <> struct Constraint<true> { typedef int Result; };
template <typename T>
struct IsInt { static const bool value = false; };
template <>
struct IsInt<int> { static const bool value = true; };
template <typename T>
typename Constraint<IsI... |
google | chromium | sizeof2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/sizeof2.C | 281 | utf_8 | 6ebf0c32bb2f9f68d5de8a2eb380e74b | // { dg-do compile }
template<int size>
struct Foobar {
// Contents irrelevant
};
template <typename A>
struct Wrapper {
// Contents irrelevant
};
template <typename A>
Foobar<sizeof(Wrapper<A>)> *
compiler_bug (A)
{
return 0;
}
int main()
{
compiler_bug(1);
}
|
google | chromium | defarg2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/defarg2.C | 127 | utf_8 | 21ce3e77355010aaab1b59936da8bfbb | struct X {
X ();
};
template <int> struct O {
struct I {
I (const X & = X());
};
};
template struct O<2>;
|
google | chromium | error-recovery1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/error-recovery1.C | 179 | utf_8 | 96f7108f863832f018e00d40ac665c3e | // PR c++/43076
struct S;
template < typename > struct T
{
template < typename >
template < bool > struct T < S > // { dg-error "" }
{
void f () { // { dg-error "" }
|
google | chromium | nontype6 | .C | native_client/pnacl-gcc/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 | chromium | canon-type-3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/canon-type-3.C | 360 | utf_8 | 6dd8c537054ea8cf4d688cc3066c6c21 | // 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 ;
typedef X (FP) ();
A<FP&> a ;
} ;
template < class Y > struct E
{
typedef Y (FP) ();
B<FP&> b ;
} ;
E < int > e ; |
google | chromium | new8 | .C | native_client/pnacl-gcc/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 | chromium | crash21 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash21.C | 915 | utf_8 | e11ee09376a4af9fd0b4e8a0131f1ad5 | // { dg-do compile }
// PR c++/16706: Dependent type calculation during access checking
template <typename> struct B {
B() throw() {}
struct S { };
static int i;
typedef unsigned short int dummy;
};
template <typename _Tp>
struct allocator: B<_Tp> {
template<typename _Tp1> struct rebind
... |
google | chromium | crash92 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash92.C | 241 | utf_8 | 2badba03cb416a233c859845b8f9dd8b | // PR c++/42055
template<typename T> void foo(T, T); // { dg-error "candidates|template" }
template<typename T> void foo(T, int); // { dg-error "template" }
template void foo(int, int); // { dg-error "ambiguous template specialization" }
|
google | chromium | unify11 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/unify11.C | 561 | utf_8 | c0596d378adbd8c8f64a4ac6fd48b371 | // Origin: PR c++/40684
// { dg-options "-std=c++0x" }
struct A
{
};
template <typename S, typename T, typename U, typename S::v = &S::v::s>
typename S::A
foo (S c, T t, U u) // { dg-message "note" }
{
}
struct B
{
struct C
{
template <typename U>
C (U t)
{
A a;
A b = foo (this, a, t); // {... |
google | chromium | friend4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/friend4.C | 548 | utf_8 | 56e71f86759e703664c2ed50998932fd | // { dg-do compile }
// PR 109, dependent member friends
struct B
{
static int foo ();
struct N
{
static int bar ();
};
};
template <class T>
class A
{
friend int T::foo ();
friend int T::N::bar ();
private:
static int m;
};
template <class T>
class C
{
friend struct T::N;
private:
static i... |
google | chromium | non-dependent12 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/non-dependent12.C | 259 | utf_8 | c68de3013fc66d5b9ca387b1f0f294ad | template<typename T> void foo(T &t)
{
int i = static_cast<int>(t);
} |
google | chromium | spec18 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/spec18.C | 150 | utf_8 | f9db6cb49e2fa6c6968fe9e4a6f2a111 | // PR c++/17936
template<int, int N> struct A
{
void foo();
};
template<int N> struct A<1, N>
{
void foo();
};
template<> void A<1, 2>::foo();
|
google | chromium | typedef10 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/typedef10.C | 200 | utf_8 | da5e10dcd0d113f42f94806f2313be36 | // PR c++/34573
template < class Gtr_>
void compute_gr()
{
typedef int Less_chain;
struct utils {
utils(const Less_chain& lc) {};
};
utils U(1);
}
int main(void){
compute_gr<int>();
}
|
google | chromium | void11 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/void11.C | 189 | utf_8 | 334f2b6dd7bbf1694010e0f30e5058f9 | // PR c++/31446
template<void> struct A // { dg-error "valid type" }
{
template<int> friend void foo();
};
void bar()
{
foo<0>(); // { dg-error "not declared|primary-expression" }
}
|
google | chromium | qualttp6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/qualttp6.C | 335 | utf_8 | b353c34b9ab8c3b3ac91f9acd132ffc6 | // { dg-do compile }
template <template <class> class TT> class C {
};
template <class T> struct D {
C<T::template B> c; // { dg-error "no class template" }
};
struct E {
};
D<E> d; // { dg-message "required" } |
google | chromium | member2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/member2.C | 254 | utf_8 | cabe816ff29ed547a0c78ab109ad97d0 | // PR c++/8660
// Bug: we were treating the definition of the non-template as a definition
// of the template, which broke.
struct BadgerBuf
{
void ReadPod();
template<class B>
void ReadPod();
};
void BadgerBuf::ReadPod ()
{ ReadPod<int> (); }
|
google | chromium | friend29 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/friend29.C | 184 | utf_8 | a0d74e429e0416fe8fd207b1ee020c7a | // PR c++/15701
template<template<int> class T> struct A : T<0>
{
void foo();
template<template<int> class U> friend void A<U>::foo();
};
template<int> struct B {};
A<B> a;
|
google | chromium | instantiate7 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/instantiate7.C | 254 | utf_8 | 45a941d2c18f981ce0d37d4ebeae6190 | // PR c++/19498
// { dg-do compile }
template<typename T> struct A
{
template<T&> struct B; // { dg-error "reference to void" }
};
A<void> a; // { dg-message "required" } |
google | chromium | init1 | .C | native_client/pnacl-gcc/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 | chromium | typedef12 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/typedef12.C | 351 | utf_8 | f9454605af8eaba210ba4230a78b4665 | // { dg-do compile }
class A
{
protected:
typedef int mytype;
};
template <class T> class B;
class C: public A
{
template <class T> friend class B;
};
template <class T> class B
{
C::mytype mem;
};
B<int> b; |
google | chromium | spec12 | .C | native_client/pnacl-gcc/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 | chromium | typedef27 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/typedef27.C | 806 | utf_8 | 354cf432a344951b1a0d1cabae95edb4 | // Origin: PR c++/42713
// { dg-do compile }
template<class T>
struct S
{
};
template<class T>
struct S0
{
typedef T TT;
};
template<class U, class V>
struct super_struct : S0<V>
{
typedef S0<V> super;
};
template<class U, class V, class W>
struct S1 : super_struct<U, V>
{
typedef super_struct<U, V> sup... |
google | chromium | crash85 | .C | native_client/pnacl-gcc/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;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.