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 | eh2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/eh2.C | 272 | utf_8 | 2b3c7f8302538b13678813af81793ae4 | // 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 "instantiated" } |
google | chromium | enum5 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/enum5.C | 311 | utf_8 | 109e68e063340fe9a814b152f4df9eb3 | // { dg-do compile }
// PR c++/14479: Template header check for enum
template <int dim>
struct X {
enum { dimension = dim };
template<int d> void bar ();
};
template <>
template <>
void X<0>::bar<0> () {} |
google | chromium | typename12 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typename12.C | 462 | utf_8 | 30d9dbf1a055ca371d55466a58a6efb8 | // { dg-do compile }
// PR 30818, failure to resolve typename typedef
template < typename T >
class A
{
typedef int type;
class B;
};
template < typename T >
class A<T>::B
{
typedef typename A<T>::type type;
type f();
};
template < typename T >
typename A<T>::B::type
A<T>::B::f() { return 0; } |
google | chromium | array2-2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/array2-2.C | 269 | utf_8 | 8da7cf5d73e9871b3bac6287dfe96d0a | // { dg-do compile }
// { dg-options "-fabi-version=2" }
// PR c++/13494. ICE
template<typename T>
int foo(int d[][4])
{
return d[0][0];
} |
google | chromium | ttp17 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp17.C | 167 | utf_8 | f66d4fc77767b484d05f73af4cc8280a | template <template <typename> class C>
void f(C<double>) {}
template <typename T, typename U = int>
struct S {};
template void f(S<double>); // { dg-error "match" }
|
google | chromium | typename4 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typename4.C | 194 | utf_8 | aa55b7c783ab88624dcf704be27fba5b | 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 "instantiated" }
|
google | chromium | lookup2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/lookup2.C | 369 | utf_8 | a5297fa14ac6240f7038e83f8ecca871 | // { dg-do compile }
// PR 11617: Failed to diagnose missing function.
struct B {};
template <typename T> void Bar ()
{
T::foo (); // { dg-error "is not a member of" "" }
}
void Foo ()
{
Bar<B> (); // { dg-message "instantiated" "" }
} |
google | chromium | vla2 | .C | native_client/nacl-gcc/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 | chromium | crash53 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash53.C | 229 | utf_8 | 35cb76576b57f891481cddfa27b8f7c0 | // PR c++/28110
// { dg-do compile }
template<int> struct A {};
template<typename T> struct B
{
template<T I> B(A<I>); // { dg-error "template constant parameter" }
};
B<double> a=A<0>(); // { dg-error "non-scalar type" }
|
google | chromium | recurse | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/recurse.C | 629 | utf_8 | 4406373d40c3d42ea004299a7d72ca7d | // Test for handling of excessive template recursion.
// { dg-options "-ftemplate-depth-50 -O" }
template <int I> struct F
{
int operator()()
{
F<I+1> f; // { dg-error "incomplete type" "incomplete" }
// { dg-error "exceeds maximum" "exceeds" { target *-*-* } 8 }
return f()*I; // { ... |
google | chromium | ptrmem9 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ptrmem9.C | 131 | utf_8 | 6cdf7b7a7a495367d144ca4b7238a771 | // PR c++/15329
struct S {};
template <typename> struct X {
S s;
void foo (void (S::*p)())
{ (s.*p)(); }
};
|
google | chromium | instantiate1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/instantiate1.C | 403 | utf_8 | b7c31995b79ebe4a0cc6c57f5888ed1a | // { dg-do compile }
// Origin:
// PR c++/6716
// ICE in complex class structure when components are incomplete
template <class T> struct X {
T t; // { dg-error "incomplete" }
};
template <class T> struct Y {
X<T> x; // { dg-message "instantiated" }
};
template <class T> struct Z { // { dg-error "declarati... |
google | chromium | partial1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/partial1.C | 636 | utf_8 | bb04475dfd1abb6699b6daee337bc7ef | // { dg-do run }
// PR c++/6620
// Partial specialization involving expression of non-type template
// parameter causes ICE.
extern "C" void abort();
template <int N> struct HoldInt
{
};
template <class A, class B> struct Add
{
};
template <int N> struct Add<HoldInt<N>, HoldInt<-N> >
{
typedef int type;
int f() { r... |
google | chromium | decl1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/decl1.C | 215 | utf_8 | 140909eaa0a4dfe8770e4810e92571cc | // PR c++/3882
// Verify that variable initialization can be
// self-referencing inside a template function.
int foo(int);
template <typename T>
void bar(const T&)
{
int i = foo(i);
}
void quus()
{
bar(0);
}
|
google | chromium | typedef4 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typedef4.C | 198 | utf_8 | 0abf956c61b1548b77669c5d00411396 | // PR c++/27572
// { dg-do compile }
template<typedef> void foo(); // { dg-error "no type|typedef declaration|template" }
void bar()
{
foo<int>(); // { dg-error "matching" }
}
|
google | chromium | member7 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/member7.C | 243 | utf_8 | a1171f569cb38a793af833ae3af0599e | // PR c++/29080
struct Base {
template<class C> void method() { }
};
struct Left : public Base { };
struct Right : public Base { };
struct Join : public Left, public Right { };
void function()
{
Join join;
join.Left::method<int>();
}
|
google | chromium | sizeof5 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sizeof5.C | 201 | utf_8 | 3732e9c01b98ba779d2beb4a94b1f1a4 | // PR c++/9907
// sizeof(foo()) was not considered constant.
template <unsigned n> struct bar {};
int foo();
template <class T>
void baz()
{
bar<sizeof(foo())> b;
} |
google | chromium | ptrmem11 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ptrmem11.C | 342 | utf_8 | 2733fb0b367677a0d0e425dcfc181dd9 | // PR c++/18407
template <typename Klasse>
struct the_base{
template <void (Klasse::*Fn)()> void foo() { }
};
template <typename T>
struct derivedT: the_base<derivedT<T> > {
typedef the_base<derivedT<T> > parent;
void ice(){
this->parent::template foo< &derivedT<T>::ice>();
}
};
int main() {
derivedT<i... |
google | chromium | pretty1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/pretty1.C | 691 | utf_8 | 04907f98f8eab7c64ced6646f5140346 | // { dg-do run }
// PR 7768 template dtor pretty function wrong
#include <string.h>
static size_t current = 0;
static bool error = false;
static char const *names[] =
{
"X<T>::X() [with T = void]",
"X<T>::~X() [with T = void]",
0
};
void Verify (char const *ptr)
{
error = strcmp (ptr, names[current++]);
}
te... |
google | chromium | error31 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error31.C | 91 | utf_8 | 0f550f42a764725b5ef085971e281ea8 | // PR c++/33493
template<int> void foo() { delete 0 ? 1 : 0; } // { dg-error "delete 0" }
|
google | chromium | canon-type-4 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/canon-type-4.C | 313 | utf_8 | 408b20a9cb6c7940be9aaf94f01cec92 | // Origin PR c++/39754
// { dg-do "compile" }
template<typename> struct A ;
template<typename T ,typename = A<T> > struct B { } ;
template<class W, class>
struct D
{
typedef W X;
A<X[2]> a;
} ;
template<class Y>
struct E
{
B<Y[2]> b;
};
E < int > e; |
google | chromium | void10 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/void10.C | 180 | utf_8 | b98f8ca68199027ec91aea21199d5807 | //PR c++/28736
template<void> struct A // { dg-error "not a valid type" }
{
template<typename> friend struct B;
};
template<typename> struct B {};
B<int> b;
|
google | chromium | sizeof4 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sizeof4.C | 319 | utf_8 | 70e0faea5b000e5fbde589a89ad950bd | // { dg-do compile }
// Origin: <anthwil at nortelnetworks dot com>
// c++/4933: using sizeof with comma operator as template argument
template<unsigned F>
struct Foo {};
template<typename T>
T makeT();
template<typename T,typename U>
struct Bar
{
typedef Foo
<
sizeof((makeT<T>(), makeT<U>()))
> Type;
};
|
google | chromium | enum1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/enum1.C | 129 | utf_8 | 7c10af58e57cd68a834ce883259ef847 | // PR c++/15554
template <int n> struct T1 { enum { N = 3 }; };
template <int n> struct T2 { enum { N = 3, N1 = T1<N>::N }; };
|
google | chromium | array6 | .C | native_client/nacl-gcc/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 | chromium | spec19 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec19.C | 405 | utf_8 | f5d160027a38c58d8d22ae4a510839c8 | // PR c++/18962
template<class T1,int N1>
class Klasse
{
public:
template <class T2,int N2>
void function( const Klasse<T2,N2>& );
};
template<>
template<class T2,int N2>
void Klasse<int,1>::function( const Klasse<T2,N2>& param )
{
param; // make sure we use the argument list from the definition.
}
int main()... |
google | chromium | unify2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/unify2.C | 518 | utf_8 | 4559d27962ac65b887c6f4a3a42dc70f | // { dg-do compile }
template<int I> void f1 (char [][I+1]) {}
template<int I> void f2 (char [][I+0]) {}
template<int I> void f3 (char [][I]) {}
template<int I> void f4 (char [][I-0]) {}
template<int I> void f5 (char [][I-1]) {}
template void f1 (char [][6]); // { dg-error "does not match" }
template void f2 (char []... |
google | chromium | array18 | .C | native_client/nacl-gcc/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 | chromium | spec8 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec8.C | 271 | utf_8 | f52bdc68a6a195dec8e61722088ae977 | // { dg-do compile }
// Specialization of member class template.
template<class T1> struct A
{
template<class T2> struct B {};
};
template <> template <> struct A<int>::B<int> {};
template <> template <class U> struct A<int>::B {}; // { dg-error "specialization" }
|
google | chromium | static15 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static15.C | 3,226 | utf_8 | c3b36a59772fbeeb2232e39c7ec7b99c | // PR c++/23667
// { dg-options "-std=gnu++98" }
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 + 1] =
{
2ul... |
google | chromium | array10 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/array10.C | 412 | utf_8 | 2960ad36eda739b652d2efa379834c5c | template<class T> struct Vec {
T* data;
T& operator[](int i) const;
};
template<class T> inline T& Vec<T>::operator[](int i) const
{
return (&data[0])[i];
}
inline double foo(Vec<double> v)
{
return v[0];
} |
google | chromium | ttp6 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp6.C | 415 | utf_8 | ede8e95c1aeeeb0cf1c4cfb0fd860e07 | // { dg-do compile }
// PR c++/10552: Member class template as template template argument
// substitution issue.
template <template <typename> class A, typename>
struct B
{
typedef typename A<int>::t t;
};
template <typename D>
struct E
{
template <typename> struct F { typedef int t; };
typedef typename B<F, D>::... |
google | chromium | pr35240 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/pr35240.C | 177 | utf_8 | 211d11b6ade439494fbc6947bda9201c | // PR c++/35240
// { dg-do compile }
template<int> struct A {};
template<int N> A<sizeof(new int[N][N])> foo();
void bar()
{
foo<1>(); // { dg-message "unimplemented" }
}
|
google | chromium | non-type-template-argument-1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/non-type-template-argument-1.C | 302 | utf_8 | 61a341b5ca1e4a29d71ba05dc246ed70 | struct A { static const bool b=false; };
struct B { typedef A X; };
template <bool> struct C {};
template <typename T> struct D
{
C<T::X> c; // { dg-error "parsed as a non-type|if a type is meant" }
};
D<B> d; // { dg-message "instantiated from here" }
|
google | chromium | array17 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/array17.C | 272 | utf_8 | d745bc63c8c200e57c116976bd79e9b1 | // { dg-do compile }
template <typename T>
struct V {
T& operator[](int);
};
struct S {
S operator +(int);
template <typename T> T value();
};
template <typename T>
void R (T v)
{
v[(S() + 0).template value<int>()][0] = 0;
}
int
main ()
{
R(V<V<int> >());
}
|
google | chromium | friend38 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend38.C | 133 | utf_8 | 9c94dec5b4c21f6f788aa68c4cbf6ae7 | // PR c++/22352
template <class A>
class s
{
typedef int d;
template <class s, typename s::d>
friend class t;
};
s<int> t1;
|
google | chromium | defarg8 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/defarg8.C | 196 | utf_8 | 5a9ab10f62078b4d20766a00362fa933 | // PR c++/27094
// { dg-options "--param ggc-min-expand=0 --param ggc-min-heapsize=0" }
struct A
{
~A();
};
struct B : A
{
B();
};
template<int> struct C
{
C(const B& = B());
};
C<0> c;
|
google | chromium | access2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access2.C | 433 | utf_8 | 0e54d828b216e2aa3adfd8ebcae67ae9 | // { dg-do compile }
// PR c++/5387
// Enforcing access of typename type.
template <class T> struct A {
typename T::X x; // { dg-error "this context" }
int f() { return T::i; } // { dg-error "this context" }
};
class B {
typedef int X; // { dg-error "private" }
static int i; // { dg-error "private" }... |
google | chromium | qualttp18 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp18.C | 334 | utf_8 | bbfca58649b8b1342b8f444ed2a5f1fd | // { 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 "" }
};
int main()
{
C c;
} |
google | chromium | spec15 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec15.C | 1,010 | utf_8 | 8b7c0af60c19361bb1633001dcfc804d | // { dg-do compile }
// Contributed by Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
// PR c++/509: Make sure specializations of member templates match correctly
// between template and non-template overloads.
template <class T>
struct A {
template <class U> void f (U);
void f2 (int);
template <clas... |
google | chromium | nested3 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nested3.C | 649 | utf_8 | 9f7c1e51ed0e8a5dbc1350d24adb6554 | template <class T1, class T2>
class A {
template <class S>
class SubA {
int _k;
};
T1 _t1;
T2 _t2; // { dg-message "instantiated" }
};
template <class U>
class B { // { dg-error "declaration" }
class SubB1 {
B _i; // { dg-error "incomplete type" }
};
class SubB2 {
int _j;
};
A<U,SubB1>... |
google | chromium | ttp24 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp24.C | 116 | utf_8 | 23d3457f42057bd9e65058bbe00e779f | // PR c++/30897
template<template <typename T, typename = T > class U> struct A
{
template<int> U<int> foo();
};
|
google | chromium | local1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/local1.C | 512 | utf_8 | b7860e67547fa0e658cae5b27a73d61b | // PR c++/4286: We were crashing when trying to set up the class bindings in
// g(), because xref wanted the mangled name, which breaks inside a template.
// Of course, the offending code is actually ill-formed anyway, so check
// for the error. Also check that it's formatted properly.
struct A
{
template<class T>... |
google | chromium | friend45 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend45.C | 240 | utf_8 | e3a0414fe5ccc0a10aa6656eadd87cec | // PR c++/28025
class BaseSubmit
{
template<class T> friend class PeriodicSubmit;
};
template<class ID>
class ValuesSubmit
{
template<class T> friend class PeriodicSubmit;
};
class A;
class MultiSubmit : public ValuesSubmit<A>
{
};
|
google | chromium | crash61 | .C | native_client/nacl-gcc/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 | chromium | qualttp11 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp11.C | 328 | utf_8 | 07ba931fb2075a068c2bb8f171d57bb1 | // { dg-do link }
struct A
{
template <class T> class B {};
};
template <template <class> class TT> struct X
{
TT<int> y;
};
template <class T> struct C
{
X<T::template B> x;
};
int main()
{
C<A> c;
} |
google | chromium | crash40 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash40.C | 161 | utf_8 | ac8d727f500cada0a387d18281707a60 | // PR c++/22180
struct A {};
template<typename T> void foo()
{
T::~T(); // { dg-error "member" }
}
template void foo<A>(); // { dg-message "instantiated" }
|
google | chromium | ttp20 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp20.C | 193 | utf_8 | e418b0b8fa3fa6c89ea62a249937f9c4 | // PR c++/27424
// Bug: failing to substitute the 'int' into C
template<typename T> struct A
{
template<template<T> class> struct B {};
template<T> struct C;
B<C> b;
};
A<int> a;
|
google | chromium | ptrmem10 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ptrmem10.C | 251 | utf_8 | aa534276e0095c6eef1fe985651eee58 | // PR c++/15096
template <typename T_>
class C1
{
public:
C1 ();
~C1 ();
const int C1<T_>::* getPtr () const;
private:
int x;
T_ y;
};
template <typename T_>
const int C1<T_>::* C1<T_>::getPtr () const
{ return &C1<T_>::x; }
|
google | chromium | asm1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/asm1.C | 160 | utf_8 | b8d7ae2a709e06f2d49e19cfb00e77d3 | // PR c++/24761
// { dg-do compile }
template <int>
int f (int i)
{
asm ("# %0 %1" : "+r" (i));
return i;
}
int main ()
{
return f<0> (0) + f<1> (0);
}
|
google | chromium | non-dependent7 | .C | native_client/nacl-gcc/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 | chromium | conv8 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/conv8.C | 215 | utf_8 | 194ecfa58017cf3f1133da2879133a29 | // { dg-options "-fabi-version=1" }
template <typename T> struct S {
struct I{};
operator I* ();
};
template <typename T> struct S2 : S<T> {
operator typename S<T>::I* ();
};
template struct S2<int>;
|
google | chromium | unify1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/unify1.C | 439 | utf_8 | 450c0b9e346d4201c85d9055f20ebf1a | // Test non-type template argument folding.
// { dg-do compile }
template < int I1, int I2 >
class unit
{
public:
unit() {}
unit( const unit<I1,I2>& ) {}
template< int Q1, int Q2 >
unit< I1 - Q1, I2 - Q2 > operator / ( const unit< Q1, Q2 >& rhs ) const {
return unit< I1 - Q1, I2 - Q2 >();
}
};
int m... |
google | chromium | memfriend5 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memfriend5.C | 580 | utf_8 | b29c5ddfeb79a3077e908d0877024b79 | // { dg-do compile }
// Member template function of member class template as friend
template <class T> struct A {
template <class U> struct B {
template <class V> void f(V);
};
};
class X {
int i;
template <class T> template <class U> template <class V>
friend void A<T>::B<U>::f(V);
};
template <class T... |
google | chromium | conv2 | .C | native_client/nacl-gcc/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 | chromium | memfriend12 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memfriend12.C | 750 | utf_8 | 3efbba635759c97e9b452f6d5ba9696a | // { dg-do compile }
// Nested class of class template as friend
template<class T> struct A
{
struct B
{
void f();
};
};
template <class U> class C {
int i;
template<class T> friend struct A<T>::B;
};
template<class T> struct A<T*>
{
struct B
{
void f();
};
};
template<> struct A<char>
{
struc... |
google | chromium | crash15 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash15.C | 112 | utf_8 | e50e217f7da35dc497156675b2547e44 | // PR c++/13310
struct A {};
template <typename> void foo()
{
A a;
a.foo<int>(); // { dg-error "" }
}
|
google | chromium | template-id-1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/template-id-1.C | 474 | utf_8 | 2f6494bf04dd960a886f4ba09c1a1bcf | // { dg-do compile }
struct A {
typedef int Y;
typedef double Z;
};
struct B {
template<typename T>
void func(typename T::Y, typename T::Z) { }
};
template<typename T>
struct X {
void gunc();
};
template<typename T>
void X<T>::gunc()
{
B b;
b.func<A>(0, 3.);
}
int main()
{
X<int> x;
x.gunc();... |
google | chromium | typename7 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typename7.C | 211 | utf_8 | 9108fc5e479d002dfe1d6280ab3a8e35 | // PR c++/17501
template<int> struct A;
template<> struct A<0>
{
struct B
{
struct C
{
typedef int D;
};
};
};
template<int I> struct E
{
typename A<I>::B::C::D i;
};
|
google | chromium | dependent-expr4 | .C | native_client/nacl-gcc/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 | chromium | void8 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/void8.C | 213 | utf_8 | d7375b6b148303af73024b27635ad7cd | //PR c++/28737
template<void> struct A; // { dg-error "not a valid type" }
template<typename> struct B;
template<void N> struct B<A<N> > {}; // { dg-error "not a valid type|declared|invalid" }
|
google | chromium | friend5 | .C | native_client/nacl-gcc/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 | chromium | crash10 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash10.C | 355 | utf_8 | 245c3c3a69c27117dfcc4b6588677c7d | //PR c++/11432
// The mainline ICE on this one between 2003-01-16 and 2003-07-29.
// { dg-do compile }
extern "C" void abort();
template <int A>
struct a
{
static int const value = A - 1;
};
template <int B>
struct b
{
static int foo()
{
return a<L>::value;
}
static int const L = a<B + 1>::valu... |
google | chromium | crash27 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash27.C | 97 | utf_8 | 6ef1f361b05f74553ccdc456e5d76ea9 | // PR c++/18586
template <int> struct A {
template <int N> int A<N>::i; // { dg-error "" }
};
|
google | chromium | new5 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/new5.C | 138 | utf_8 | 1a15a65a0d144c0881e658ac6436ea42 | // PR c++/27210
template <class foo> class junk {
void bar(int a)
{
unsigned char *c = new unsigned char[a*sizeof(foo)];
}
};
|
google | chromium | typedef17 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typedef17.C | 338 | utf_8 | 1b0cfbee8f3caf6029a657e5011d2adc | // PR c++/37806
extern "C" int printf (const char *, ...);
template <typename T>
struct S1
{
typedef void (function_type)(int) const;
};
struct S2: public S1<int>
{
virtual function_type f = 0;
};
struct S3: public S2
{
void
f (int i) const
{
printf ("Hello world: %d\n", i);
}
};
int
main()
{
... |
google | chromium | friend9 | .C | native_client/nacl-gcc/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 | chromium | sfinae6 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sfinae6.C | 1,947 | utf_8 | 2622d4a8e2409cf748878b7d2db89477 | // 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 | non-dependent5 | .C | native_client/nacl-gcc/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 | chromium | typedef26 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typedef26.C | 503 | utf_8 | 4b7b5ad8691fed069cf0e029ff4382dc | // Origin: PR c++/42225
// { dg-do compile }
struct A
{
typedef int TI;
};
template<class T0>
struct S0
{
int i;
};
template<class _T, int>
struct S1
{
typedef _T T;
typedef typename T::TI TTI;
typedef S0<TTI> TT0;
typedef S0<typename T::TI> TT1;
};
template<class T>
void
foo(const T&)
{
typ... |
google | chromium | crash30 | .C | native_client/nacl-gcc/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 | chromium | operator1 | .C | native_client/nacl-gcc/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 | chromium | incomplete2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/incomplete2.C | 183 | utf_8 | 07ff18822f6de660e45899ae7045b541 | // PR c++/27427
// { dg-do compile }
struct A;
template<A&> void foo();
A a; // { dg-error "incomplete type" }
void bar()
{
foo<a>(); // { dg-error "no matching function" }
}
|
google | chromium | complit1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/complit1.C | 168 | utf_8 | d8eeedb4ae11ac620e9e3c21e5ce29ae | // { dg-options "" }
template <int D> struct C {
int d[3];
C();
};
template<int D>
C<D>::C() : d((int[]){1,2,3}) {} // { dg-error "array" }
template class C<1>;
|
google | chromium | ttp10 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp10.C | 555 | utf_8 | 3ef16395deaff8acf9155525bf631589 | // { dg-do compile }
// PR c++/16175: Missing cv qualifier in error message output
template <typename> struct Template {};
template<template<typename> class D>
struct B {
static void foo1(const D<void> *); // { dg-error "const" }
static void foo2(volatile D<void> *);// { dg-error "volatile" }
};
class E... |
google | chromium | crash46 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash46.C | 80 | utf_8 | 933d195d117ede217f70567360e6e511 | // PR c++/27102
template <class T>
void T::foo() {} // { dg-error "invalid" }
|
google | chromium | init2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/init2.C | 225 | utf_8 | 76f88c13708d18ca711ab8287d1caac9 | // PR c++/9820
template <typename T> struct X {
template<typename> static int test(...);
template<typename> static int test(int *);
static const int i = sizeof(X<T>::template test<int>(0));
};
template class X<int>;
|
google | chromium | spec13 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec13.C | 207 | utf_8 | e9df140ef024c36c2a7761c13a353434 | // { dg-options "-w" }
template <typename T>
struct S {
int i;
template <typename U> void f(U) {}
};
template<>
template <typename U>
void S<int>::f(U) { i; }
void f() {
S<int> s;
s.f<int>(3);
}
|
google | chromium | static30 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static30.C | 189 | utf_8 | 916a608bb6377983e85912d2e9354f46 | // 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);
|
google | chromium | spec33 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec33.C | 152 | utf_8 | a9180d3ef512a022c9b825693df2bc57 | //PR c++/27667
struct A
{
template<int> static void foo () {}
template<> static void foo<0>() {} // { dg-error "explicit|template" }
};
|
google | chromium | qualttp7 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp7.C | 326 | utf_8 | d63e0b7ea7f55533a1184c265c53fab1 | // { 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" }
};
D<int> d; // { dg-message "instantiated" } |
google | chromium | friend42 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend42.C | 157 | utf_8 | 8f75af1c73180eecafb9d5d27f306dd5 | // { dg-do compile }
template <class T> void foo (int);
template <class T>
class Q {
friend void foo<T> (int = 3); // { dg-error "default argument" }
};
|
google | chromium | static27 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static27.C | 169 | utf_8 | 1b82adb3481fed24cf9d4678fad7ec3a | // PR c++/28235
template<typename> struct A
{
static const bool i = true;
template<bool = i> struct B {};
B<> b;
};
void f() {
A<int> a1, a2;
a1.b = a2.b;
}
|
google | chromium | inherit2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/inherit2.C | 344 | utf_8 | 13bd5309700c34e9e01c5bd7fd620d7b | // PR c++/5658
struct A {
typedef int iterator;
};
template <typename T>
struct B: public A {
template <typename U>
struct iterator {
};
B() { }
};
int main()
{
B<int> a;
} |
google | chromium | nontype14 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nontype14.C | 209 | utf_8 | 937af4e6ac2cefe2dff1503c7819130f | // PR c++/23789
template <int W> struct X {
template <int W2>
X< (W+(W&&W) > 1 ? W+(W&&W) : 1)+1>
operator + (const X<W2>&) const;
};
template <int dummy> void foo()
{
X<6> A,B;
A + B;
}
|
google | chromium | friend40 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend40.C | 216 | utf_8 | e91add4174f6722fc0ed3c0bbd420d70 | // PR c++/24173
// { dg-options "--param ggc-min-expand=0 --param ggc-min-heapsize=0" }
template <int> struct A;
void foo(A<0>);
template<int> struct A
{
friend void foo(A<0>);
};
void bar()
{
foo(A<0>());
}
|
google | chromium | friend19 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend19.C | 396 | utf_8 | 599c6765352974ba5694506637bc1ea3 | // { dg-do compile }
// PR c++/11030: Template substitution of friend class that is
// a specialization.
template <int S>
struct A
{
void func(void);
};
template <class T>
class C
{
static void private_func(void) {}
public:
friend class A<512>;
};
template <int S>
void A<S>::func(void)
{
C<void>::private_func()... |
google | chromium | defarg10 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/defarg10.C | 326 | utf_8 | 1f7a92340a1c2a7cf7f4bb987f326111 | // PR c++/28363
// { dg-do compile }
template<typename T, template<int> class = T> // { dg-error "invalid use of type" }
struct A;
typedef int I;
template<template<int> class = I> // { dg-error "invalid use of type" }
struct B;
struct S;
template<template<int> class = S> // { dg-error "invalid use of type" }
stru... |
google | chromium | nontype17 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nontype17.C | 121 | utf_8 | 6938006fe193f5813dbc894a73ef554f | // PR c++/35282
template<int> struct A
{
template<int> void foo();
};
template<> template<int> void A<0>::foo() {}
|
google | chromium | init6 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/init6.C | 515 | utf_8 | 65a281c41b82251552faaf8359766e91 | // PR c++/25836
template <class T>
class Iter {};
template <class T>
class SubIter : public Iter<T> {
void insert(T);
};
class GraphBase {
public:
class Node;
};
template<class T>
class Graph : public GraphBase {
class Inner {
Iter<typename Graph<T>::Node*> *get();
};
};
template<class T>
Iter<typename... |
google | chromium | sfinae10 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sfinae10.C | 7,359 | utf_8 | ac71c8a18b81044f2a2076089c448a58 | // DR 339
//
// Test of the use of various unary 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 | chromium | member6 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/member6.C | 205 | utf_8 | ed593b0ea0c7885cd94106b4b24d1173 | // PR c++/29105
struct Observer
{
template < typename T > void observeComponent ();
};
template < typename T >
struct TagFilter : Observer
{
TagFilter ()
{
observeComponent < int > ();
}
};
|
google | chromium | mem_func_ptr | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/mem_func_ptr.C | 1,683 | utf_8 | 08ee485d4a84252ae107afcbd8bb4b13 | // { dg-do compile }
template<typename T> struct takes_member_ptr;
template<typename T, typename Klasse> struct takes_member_ptr<T Klasse::*> {};
template<typename T, typename Klasse>
void fun_takes_member_ptr(T Klasse::*) {}
template<typename T> struct order_member_ptrs;
template<typename T, typename Klasse> struct... |
google | chromium | crash78 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash78.C | 114 | utf_8 | 63aa4ea81419f0f2436d71c62bb543c3 | // PR c++/35077
template<typename=int struct A __attribute((aligned(4))); // { dg-error "declaration|expected" }
|
google | chromium | instantiate2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/instantiate2.C | 255 | utf_8 | 88e1ec74b340410f99e5bf69122404bd | // { dg-do compile }
// PR c++/2862
// Default function argument and template instantiation.
template <int dim> void f (int=0) {}
template void f<1> (); // { dg-error "not match" } |
google | chromium | typedef9 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typedef9.C | 823 | utf_8 | 779a641261850a2aeef3d242e02f0a9b | // PR c++/34846
template<typename, typename> struct __are_same { enum { __value = 0 }; };
template<typename _Tp> struct __are_same<_Tp, _Tp> { enum { __value = 1 }; };
template<typename, bool> struct __enable_if { };
template<typename _Tp> struct __enable_if<_Tp, true> { typedef _Tp __type; };
template<typename _Itera... |
google | chromium | qualttp22 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp22.C | 803 | utf_8 | 3b637cecee1acb45f1c7f752a8c7732d | // { dg-do compile }
// PR c++/13520: Default template template argument that is a qualified id
// with dependent scope.
template<typename regular_type> class Policy {};
template <typename regular_type, template<typename> class OriginalPolicy>
class ChangedPolicy_impl {};
template <template<typename> class OriginalPoli... |
google | chromium | nontype11 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nontype11.C | 282 | utf_8 | 9ba9723e8601b19208ac3f8350ee6695 | // { dg-do compile }
// Origin: <fsm at robots dot ox dot ac dot uk>
// PR c++/18354: Unary plus should not be wrapped in NON_LVALUE_EXPR
template <int N>
struct X { };
const int n = 1;
void f()
{
X< 1> a;
X<-1> b;
X<+1> c;
}
void g()
{
X< n> a;
X<-n> b;
X<+n> c;
}
|
google | chromium | enum2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/enum2.C | 129 | utf_8 | 5fb321d2debea87feaa0815b488d0835 | // PR c++/15877
template <int n> struct T1 { enum { N = 3 }; };
template <int n> struct T2 { enum { N = n, N1 = T1<N>::N }; };
|
google | chromium | friend47 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend47.C | 131 | utf_8 | b4e412d8986f5c28376eafc85c4b56e2 | // PR c++/19809
template<int i>
struct n{
friend void foo(){ } // { dg-error "defin" }
};
int main(){
n<1> n1;
n<2> n2;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.