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 | friend3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/friend3.C | 520 | utf_8 | d4c8a44deef0bfb76c6964c75b741416 | // { dg-do compile }
// PR 775 friend classes with qualified names inside template classes.
struct A
{
struct B {
B () { }
};
};
template <class T>
struct C: A {
friend A::B::B (); // 2.95.2 ICE
friend struct A;
friend struct A::B; // 2.97 error
};
template class C<char>;
template <typename T> class TPL
{... |
google | chromium | dependent-name2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/dependent-name2.C | 359 | utf_8 | 18d61b100652dfe4816b8b9c6cefa923 | // { dg-do compile }
// PR 10530. Thought a type was dependent.
template <typename T>
struct Foo {
struct Inner {
typedef int type;
};
};
template <typename A> struct Bar {
typedef typename Foo<int>::Inner::type type;
}; |
google | chromium | new3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/new3.C | 333 | utf_8 | e803384df62d31ef9dc9c4a9a02c1eff | extern void *operator new(__SIZE_TYPE__); // { dg-message "note" }
template <class T >
struct C
{
void f() {
int* node;
new (&node) int(0); // { dg-error "new" }
// { dg-message "candidate" "candidate note" { target *-*-* } 8 }
}
};
void* operator new(__SIZE_TYPE__, void* __p);
void g() {
C<int> c;... |
google | chromium | non-dependent8 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/non-dependent8.C | 298 | utf_8 | 663136a11c36aa84d57fc0129b2be73d | // { dg-do compile }
// Two-phase name lookup for address of member:
// Detecting error during parsing
struct S
{
char i;
};
template<int S::*p>
struct X
{};
template <class T>
struct Foo
{
X<&S::i> x; // { dg-error "convert|no type" }
}; |
google | chromium | ctor3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ctor3.C | 269 | utf_8 | eb5e9f0376abe643c647f3a9d5b69532 | struct A {};
struct B;
template <class TP> struct X: virtual A {
template <class TP2> X(TP2* ptr) {}
template <class TP2> X(const X<TP2>) {}
};
struct Y : X<B> {
Y(A* a) : X<B>(a) {}
};
void func1(X<B>);
void func2() {
A a;
Y y(&a);
func1(X<A>(&a));
}
|
google | chromium | partial10 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/partial10.C | 532 | utf_8 | 44ba4af7d52ad0dba69cff7c7d026a77 | // PR c++/35255, DR 115
// { dg-do link }
// 14.8.1: In contexts where deduction is done and fails, or in contexts
// where deduction is not done, if a template argument list is specified
// and it, along with any default template arguments, identifies a single
// function template specialization, then the template-id... |
google | chromium | anon1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/anon1.C | 271 | utf_8 | 0badf7e9336f7d06bd6b5e8cad37e171 | struct x {
int foo () {}
};
template <class T>
struct vector {
T& bar () {}
};
template <class T>
struct y {
typedef struct {
x t;
} s;
vector<s> array;
int foo ()
{ return array.bar().t.foo(); }
};
int i = y<x>().foo ();
|
google | chromium | friend26 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/friend26.C | 216 | utf_8 | 6013e213776d77767ad0de2ceddba65f | // PR c++/14359
template<typename> struct A {};
template<typename> struct B
{
template<typename T> friend void foo(const A<T>& a, const B&) { a; }
};
void bar()
{
A<void> a;
B<void> b;
foo(a,b);
}
|
google | chromium | crash65 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash65.C | 165 | utf_8 | 0442a3c405a770df830f5c0e3594c438 | // PR c++/29732
struct A
{
template<int> template<typename T> friend void foo(T) {} // { dg-error "parameter" }
void bar() { foo(0); } // { dg-error "foo" }
};
|
google | chromium | qualttp10 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/qualttp10.C | 292 | utf_8 | cf85da2c6ae4bcc2396f5f90e574f5cd | // { dg-do compile }
template <template <class> class TT> class C {
};
template <class T> struct D {
template <class U> class B {};
C<D<T>::template B> c;
};
D<int> d; |
google | chromium | error15 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/error15.C | 336 | utf_8 | 5c61ee227ce8d484caf24918cf6fc907 | // PR c++/16929
template <class T>
class A {
int x;
};
template <class T>
class B {
protected:
A<T> a; // { dg-error "" }
void f(const A<T> * a1 = &a); // { dg-error "this location" }
void g(void);
};
template <class T>
void B<T>::g(void) {
f(); // { dg-error "default argument" }
}
template... |
google | chromium | ttp25 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ttp25.C | 993 | utf_8 | eacf697cb9c3929c2c1cb6331f9ea409 | // { dg-do compile }
template<typename T, template<T> class C>
void f1(T, C<5>); // { dg-message "note" }
template<typename T, template<T> class C>
void f2(C<5>, T);
template<typename T, template<T> class C>
void f3(C<5>, T); // { dg-message "note" }
template<typename T> struct metafun { typedef T type; };
templa... |
google | chromium | memfriend10 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/memfriend10.C | 982 | utf_8 | 88f5f474357358b46b62eb6b6fdc9b8a | // { dg-do compile }
// Nested class template of class template as friend
template <class T> struct A
{
template <class U> struct B
{
void f();
};
};
class C {
int i;
template <class T> template <class U> friend struct A<T>::B;
};
template <class T> struct A<T*>
{
template <class U> struct B
{
voi... |
google | chromium | offsetof1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/offsetof1.C | 230 | utf_8 | 0278f61baf9894baa55e08be6e4d1217 | // { dg-do compile }
// PR c++/17221
#include <cstddef>
template <int N> struct Bar;
template <> struct Bar<3> {};
template <class T>
struct Foo {
Bar<offsetof(T, a) + 3> k;
};
struct A { int a; };
template struct Foo<A>;
|
google | chromium | crash88 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash88.C | 84 | utf_8 | 59238bcb93582e024a0c5cb12c7ab7e1 | // PR c++/34397
template<typename T, int = T()[0]> struct A
{
typedef A<T> B;
};
|
google | chromium | ref1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ref1.C | 148 | utf_8 | c6c126721707d148ce66066de06c754b | // { dg-prune-output "mangled name" }
class a {} a1;
template <a & p> class b { public: b() { static_cast <a &> (p); } };
int main() { b <a1> b1; }
|
google | chromium | typedef31 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/typedef31.C | 345 | utf_8 | 7d9df5543e66a309fcf55d85d3d98ca3 | // Origin: PR c++/43558
// { dg-do compile }
class Compressible;
template <class T, class EngineTag> class Engine;
template <class T>
class Engine<T, Compressible>
{
public:
typedef T Element_t;
//Element_t read(int);
T read(int);
};
template <class T>
T Engine<T, Compressible>::read(int)
{
}
Engin... |
google | chromium | memfriend2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/memfriend2.C | 874 | utf_8 | 3087e3c10234e9ef3745a413e6043727 | // { dg-do compile }
// Member function template of class template as friend
template <class T> struct A
{
template <class U> void f();
};
class C {
int i;
template <class T> template <class U> friend void A<T>::f();
};
template <class T> struct A<T*>
{
template <class U> void f();
};
template <> struct A<char>... |
google | chromium | array11 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/array11.C | 462 | utf_8 | 5c9702e760be4db613f93c64564000c5 | // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// PR c++/19208: Fold dependent array domains
template <class C> struct if_t { typedef int type; };
template <class T> struct ffff { static const bool value = true; };
template <class A>
struct bound_member_action
{
typedef char f[ff... |
google | chromium | crash37 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash37.C | 293 | utf_8 | f4049ee3cbcecf9e936e328fcc4402e2 | // PR c++/21352
struct coperator_stack
{
template<class type>
void push3()
{
}
};
struct helper {};
template<class F>
void bla(F f)
{
}
template <typename ScannerT>
struct definition
{
definition()
{
bla(coperator_stack::push3<helper>); // { dg-error "pointer to member" }
}
};
|
google | chromium | partial6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/partial6.C | 594 | utf_8 | af2b317af1f920fbca6b70a32297df09 | // PR c++/41703
// The second GetAllSize template is more specialized because even though
// deduction on each parameter type succeeds, we never get a template
// argument for its X to make it match the first template.
template <typename T, int (T::*)() const>
struct TSizeEnabler
{
typedef T TClass;
};
template <... |
google | chromium | dependent-name4 | .C | native_client/pnacl-gcc/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 | chromium | qualttp4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/qualttp4.C | 443 | utf_8 | c74652ba0a044cfb6e9710ede4d6d2e4 | // { dg-do compile }
struct A
{
template <class T> struct B {};
};
template <template <class, class> class TT> // { dg-error "provided" }
struct X
{
TT<int> y; // { dg-error "number" }
};
template <class T> struct C
{
X<T::template B> x; // { dg-error "type" }
};
int main()
{
C<A> c; // { dg-message "required" }
} |
google | chromium | error25 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/error25.C | 426 | utf_8 | 88e5836eca5b1d6a4995747486ad482a | // PR c++/31923
template<class T>
static void f1 ();
template<>
static void f1<void> (); // { dg-error "explicit template specialization cannot have a storage class" }
template<class T>
extern void f2 ();
template<>
extern void f2<void> (); // { dg-error "explicit template specialization cannot have a storage cla... |
google | chromium | decl3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/decl3.C | 131 | utf_8 | bc26ef84f5a062823e14f4e50d2e1e8c | // c++/32560
namespace N {}
template<typename> struct A
{
int A<typename N::X>; // { dg-error "namespace|argument|before" }
};
|
google | chromium | access10 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/access10.C | 306 | utf_8 | 71d21b2797de6268bae8a876a61f64ac | // { dg-do compile }
// PR c++/10849: Incorrect access checking on template specialization.
class X {
private:
template <typename T> struct Y;
};
template <> struct X::Y<int> {};
template <typename T> struct X::Y {};
template struct X::Y<int>; |
google | chromium | static20 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/static20.C | 378 | utf_8 | a86e0443f116a5ab2c8f6e11d42e7473 | // PR c++/24277
template< int Bits > struct uint_t {
typedef unsigned short fast;
};
template < int Bits > struct mask_uint_t {
typedef typename uint_t< Bits >::fast fast;
static const fast sig_bits = 1;
static const fast sig_bits_fast = fast(sig_bits);
};
template < int Bits> int checksum ( ) {
return 1 & m... |
google | chromium | sfinae8 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/sfinae8.C | 7,169 | utf_8 | 6f91239bd167bb9f6b68f4d27c340176 | // DR 339
//
// Test of the use of various boolean 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<typ... |
google | chromium | void1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/void1.C | 98 | utf_8 | 23655735fa447bdfd2100e025e21ee03 | // PR c++/27430
// { dg-do compile }
template<void[]> struct A; // { dg-error "array of void" }
|
google | chromium | error32 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/error32.C | 90 | utf_8 | 95475caa3d2f02af77559820e82ebb1c | // PR c++/33843
struct A {};
void foo(A* p())
{
p->A::~A(); // { dg-error "A::~A" }
}
|
google | chromium | elab1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/elab1.C | 288 | utf_8 | 318b45c84de8e1474d71ee390dc7b68c | // { dg-do compile }
// Elaborate type specifier of class template
template <class T> class A {
class B;
};
template <class T> class A<T>::B {
friend class A;
}; |
google | chromium | incomplete6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/incomplete6.C | 320 | utf_8 | 680d8b21efe347eaf74be447cf3f4544 | // PR c++/48115
template<typename> struct templ { };
template<typename T> T declval();
typedef int (*F2)(...);
template<int> struct Int { };
template<typename F, typename T>
struct S
{
template<typename A>
Int<sizeof( declval<F>()(T()) )>
f(A);
};
int main()
{
S<F2, templ<int> >().f(0);
}
|
google | chromium | typedef34 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/typedef34.C | 564 | utf_8 | b2cb2daaa093a2320aa6fa022b544e0b | // Origin PR c++/45200
// { dg-do compile }
template<typename T>
struct remove_reference
{
typedef T type;
};
template<typename TestType>
struct forward_as_lref
{
};
template<typename Seq, typename N>
struct apply1
{
typedef typename remove_reference<Seq>::type seq;
typedef forward_as_lref<typename seq::seq_ty... |
google | chromium | typedef28 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/typedef28.C | 476 | utf_8 | 92286e7865372a4b9fb799f96e02fe6a | // Origin: PR c++/42820
// { dg-do compile }
template <class T> struct vector{};
struct Traits{struct Primitive{struct Id{};};};
template <class Tree, class Polyhedron> struct Tree_vs_naive
{
typedef typename Tree::Primitive Primitive;
void f() const
{
typedef vector<typename Primitive::Id> Id_vector;
}
... |
google | chromium | recurse3 | .C | native_client/pnacl-gcc/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 | chromium | scope2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/scope2.C | 530 | utf_8 | 1ffed1eba156ff05925971c1bb91cd3d | // { dg-do compile }
// checked required bases in wrong scope.
class Helper {};
template<class T> struct X { };
template<class T> class Base
{
protected:
typedef Helper H;
};
template<class T >
struct Derived : Base<T>
{
typedef Base<T> Parent;
typedef typename Parent::H H;
class Nested : public X<H> {};
... |
google | chromium | spec35 | .C | native_client/pnacl-gcc/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 | chromium | crash75 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash75.C | 130 | utf_8 | 3f3886cb6cade0a026bbcff85e44887b | // PR c++/34776
template<typename T> struct A
{
T::X<0> x; // { dg-error "non-template|T::template|base type" }
};
A<int*> a;
|
google | chromium | array21 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/array21.C | 920 | utf_8 | 00136c7ca590bf08c5e9d3fa200ab503 | // PR c++/42447
template<int>
void* get(int);
template<typename>
struct unique_ptr;
template<typename _Tp>
struct unique_ptr<_Tp[]>
{
typedef int __tuple_type;
void*
get() const
{ return ::get<0>(_M_t); }
__tuple_type _M_t;
};
template <typename T> class dynamic_dispatch;
template <... |
google | chromium | ref5 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ref5.C | 193 | utf_8 | 506e5f8f23105cf0257a836058d1806b | // PR c++/35075
template<int&> struct A {};
template<typename T> struct B
{
static const T t;
A<t> a; // { dg-error "reference variable" }
};
B<int&> b; // { dg-message "required" }
|
google | chromium | crash74 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash74.C | 168 | utf_8 | 09d3303991504ae057667a46bb5c6899 | // PR c++/34089
// { dg-do compile }
// { dg-options "" }
template<typename F> void foo () { }
template<typename F> struct foo<F> { }; // { dg-error "redeclared as" }
|
google | chromium | overload3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/overload3.C | 179 | utf_8 | 98ebf130b836485f9a7ceae171151be5 | // PR c++/16870
struct A
{
int operator[](int) const;
};
template<int> A foo();
A bar(A(*)());
template<int> int baz() { return (bar(&foo<0>))[0]; }
template int baz<0>();
|
google | chromium | sfinae5 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/sfinae5.C | 964 | utf_8 | d489a85672b2d956beff65b15b095039 | // DR 339
//
// Test of the use of member functions with SFINAE
typedef char yes_type;
struct no_type { char data[2]; };
template<typename T> T create_a();
template<bool, typename T = void> struct enable_if { typedef T type; };
template<typename T> struct enable_if<false, T> { };
template<typename T>
typename ena... |
google | chromium | koenig3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/koenig3.C | 316 | utf_8 | 84d2678d3ce8241c254dd0501f0e4816 | // PR c++/13157
namespace aa
{
double abs(double);
long double abs(long double);
}
namespace fu
{
template <class T>
struct X
{};
template <class T>
X<T> test(X<T> x)
{
using ::aa::abs;
return abs(x);
}
template <class T>
X<T> abs(X<T>);
X<int> x;
X<int> z = test(x);
}
|
google | chromium | partial3 | .C | native_client/pnacl-gcc/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 | chromium | spec10 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/spec10.C | 471 | utf_8 | ad21a3b2ad2780aa2209396893143af3 | // { dg-do run }
// PR c++/10940: Problem handling parameter list for static member
// that is a specialization of a member template of a template class.
template<int b>
class o
{
public:
template<typename T> static void do_add(T* p, T v);
};
template<>
template<typename T>
inline void o<32>::do_add(T* p, T v)
{
*p... |
google | chromium | memclass4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/memclass4.C | 1,076 | utf_8 | 459bb772f22194a2eec4a3d69444edf3 | // Origin: PR c++/42824
// { dg-do compile }
template<int T>
class int_ {
};
template<int T, int T2>
class Unit {
public:
Unit(const Unit<T, T2>& other) {}
};
template<int T>
class Quan {
public:
Quan(void) {}
template<int T2>
Quan(double value, Unit<T, T2> unit) {}
};
typedef Quan<0> Scalar;
templ... |
google | chromium | sfinae9 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/sfinae9.C | 7,906 | utf_8 | a9f3ce4ee662be853b285ba58e2dfe52 | // DR 339
//
// Test of the use of various assignment 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<typenam... |
google | chromium | typedef7 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/typedef7.C | 225 | utf_8 | e5348f6294a6577651589b520086d43e | // An intermediate version of the fix for c++/19407 broke this example.
struct A
{
typedef struct { int i; } S;
};
template <class T>
struct B: public A
{
template <class U>
static S f ();
};
template struct B<int>;
|
google | chromium | memfriend4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/memfriend4.C | 847 | utf_8 | 9e0baac902249d16ec8e8d97a1ab2371 | // { dg-do compile }
// Member function of class template as friend
template<class T> struct A
{
template <T t> void f();
};
class C {
int i;
template<class T> template <T t> friend void A<T>::f();
};
template<class T> struct A<T*>
{
template <T* t> void f();
};
template<> struct A<char>
{
template <char t> v... |
google | chromium | nontype5 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/nontype5.C | 293 | utf_8 | d37a5a77843c5b66c3d3566383b07dd6 | // { dg-do compile }
// PR c++/13797: ICE invalid nontype template parameter
template <int> struct A
{
typedef A<0> B;
template <B> struct C {}; // { dg-error "not a valid type" }
};
A<0> a; |
google | chromium | defarg12 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/defarg12.C | 161 | utf_8 | 7c114463066844468387ccd37081c2dd | // PR c++/35828
// { dg-options "-std=c++0x" }
template < typename > struct A ;
template < template < typename > class = A >
void test ()
{
test ();
}
|
google | chromium | friend31 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/friend31.C | 587 | utf_8 | ca5a98ee9de24f0adf4f6d6da6ea4315 | // { dg-do compile }
// PR c++/15410: Declaration of friend class template with wrong
// template parameter.
template <typename T, typename U> struct F; // { dg-message "previous declaration" }
class W
{
template<int i> friend class F; // { dg-error "template parameter" }
int x; // { ... |
google | chromium | crash34 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash34.C | 310 | utf_8 | 431d941aad4b31a51b29e3dc961a7556 | // { dg-do compile }
// PR c++/20028
// We used to crash when referencing TYPE_SIZE_UNIT of the messed-up
// type used for x, because it was not initialized.
class Foo;
template <typename T> class Foo { }; // { dg-error "not a template type" }
Foo<int> x; // { dg-error "not a template|incomplete type" }
|
google | chromium | friend50 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/friend50.C | 157 | utf_8 | 111cbc72ece5729acf873d2dfae640fd | // PR c++/34399
template<int> struct X
{
void foo();
};
struct Y {
template<long N> friend void X<N>::X::foo(); // { dg-error "declared as friend" }
};
|
google | chromium | local4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/local4.C | 291 | utf_8 | 0f5891073a92c0a9503b29e62dc8a462 | // PR c++/17413
// { dg-options -std=c++98 }
template <typename T> void foo() {} // { dg-message "note" }
int main () {
struct S {};
foo<S> (); // { dg-error "(match|template argument for|trying to instantiate)" }
// { dg-message "candidate" "candidate note" { target *-*-* } 8 }
}
|
google | chromium | call6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/call6.C | 230 | utf_8 | e3d27e71e5cdf1b6216b87f64c98c15c | // PR c++/38577
// { dg-do compile }
struct A
{
static A *bar ();
};
struct B : public A
{
static void baz ();
};
template <class T>
void foo ()
{
(static_cast<B *> (A::bar ()))->baz ();
}
void
bar ()
{
foo<int> ();
}
|
google | chromium | unify3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/unify3.C | 286 | utf_8 | 16808e8b62429d390bc5719fd2009b5c | // Test unifying SCOPE_REF.
// { dg-do compile }
template <int n> class A {};
template <int m> class R {};
template <int n> struct Trait { enum {m = n}; };
template <int n> R<Trait<n>::m> f(A<n>);
template <> R<1> f(A<1>) {return R<1>();} |
google | chromium | crash89 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash89.C | 146 | utf_8 | 6034281ee9d39b43ef106b314de26f05 | // PR c++/34397
template<typename T, int = T()[0]> struct A
{
typedef A<T> B;
};
A<int> a; // { dg-error "subscripted|template|declaration" }
|
google | chromium | local3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/local3.C | 157 | utf_8 | e254df20b082728d0e04a8e1b3b18557 | template<class T>
void f(const T&)
{
struct B {
void g (T);
};
B b;
}
void g()
{
f(42);
}
|
google | chromium | static6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/static6.C | 197 | utf_8 | 40796a2389c81fb63a7c826d2e3a06af | // PR c++/13969
struct B {
static const int N=10;
};
template <int> struct X {};
template <typename> struct S {
static const int N = B::N;
X<N> x;
};
template class S<float>;
|
google | chromium | crash62 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash62.C | 109 | utf_8 | adc7a5c414a143f0cadb9db916df6769 | // PR c++/29728
template<int> void foo()
{
int a[] = { X: 0 }; // { dg-error "designated initializer" }
}
|
google | chromium | sfinae24 | .C | native_client/pnacl-gcc/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 | chromium | dtor5 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/dtor5.C | 264 | utf_8 | 6df398ccb1fe455e5493303db41ea421 | // PR c++/23287
template <class T> struct A
{
int i;
~A();
};
template <class T> void f(A<T> *ap) {
ap->~A();
}
template <class T> void g(A<T> *ap) {
ap->~B(); // { dg-error "destructor name" }
}
int main()
{
f(new A<int>);
g(new A<int>);
}
|
google | chromium | sfinae2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/sfinae2.C | 424 | utf_8 | ef7c07b739f13546538449ba7789b15b | // PR c++/19989
// Don't instantiate a function template if it would generate an
// array of size zero.
// { dg-do compile }
template<int T> struct cl {
const static int value = T;
};
template<int I> void fn (char (*) [cl<I>::value] = 0 ); // { dg-error "zero-size array" }
void foo (void)
{
fn<0> (); // { dg... |
google | chromium | ttp8 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ttp8.C | 408 | utf_8 | ad156dec50f1d7aecc0ad4207046c838 | // { dg-do compile }
// Contributed by: Niall Douglas <s_gccbugzilla at netprod dot com>
// PR c++/14284: Failure to select specialization
template<typename> struct S;
template<template<class> class> struct I {};
template<class, int> struct Match;
template<template<class> class C>
struct Match<I<C>, 0> {};
... |
google | chromium | error5 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/error5.C | 149 | utf_8 | a988dc6a097a8766258a32544791c7db | template <typename T>
struct X<T*> { // { dg-error "not a template" }
typedef int Y;
};
extern struct Z<int> s; // { dg-error "not a template" }
|
google | chromium | explicit-args4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/explicit-args4.C | 241 | utf_8 | 423c767a5a26b27f06ba2a9e2443961a | // PR c++/48883
// { dg-do link }
template<typename T>
T myMax(T a, T b) {
if(a < b) return a;
return b;
}
int main() {
bool even = true;
int (*fp)(int, int);
fp = even ? myMax<int> : myMax<int>; /* yields link error */
}
|
google | chromium | access15 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/access15.C | 328 | utf_8 | fc82819a276388c85441dd10835850d1 | // { dg-do compile }
// Bug 17149: ICE with TEMPLATE_TYPE_PARM
template <class super,
int (super::tdata::*member)() const = &super::tdata::operator()>
struct x {}; |
google | chromium | error20 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/error20.C | 88 | utf_8 | c76b01c2f7357d4400cd8e049826cc38 | // PR c++/25439
template<int> struct A;
template<> int A<0>; // { dg-error "invalid" }
|
google | chromium | ptrmem17 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ptrmem17.C | 117 | utf_8 | 4e849ae08c1114a95499c4a59e027a41 | // PR c++/28346
template<int> struct A
{
int& i;
A();
~A() { &A::i; } // { dg-error "reference" }
};
A<0> a;
|
google | chromium | fntype1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/fntype1.C | 392 | utf_8 | c3025665d58f3b1443b5cbb53b5bd0f6 | bool f(int i) { return i != 5; }
template <class X, class P = bool(X)>
struct Traits
{
typedef P type;
};
template <class X, class P = typename Traits<X>::type>
struct S
{
const P& p_;
S( const P& p ) : p_(p) {} // const reference
};
template <class X>
S<X> make_s(const typename Traits<X>::type & p) // const refe... |
google | chromium | sfinae26 | .C | native_client/pnacl-gcc/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 | chromium | dependent-expr2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/dependent-expr2.C | 351 | utf_8 | 5c363f74bcfd32858f0d7daa76f3d56b | // { dg-do compile }
// PR 11704. ICE
struct A
{
int foo()
{
return 5;
}
};
template <class T> // If B is not template it works
struct B
{
bool bar(A& a)
{
return a.foo == 0; // { dg-error "" "" }
}
}; |
google | chromium | instantiate5 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/instantiate5.C | 524 | utf_8 | 6888f3f922d084199e0af93c5fbadceb | // { dg-do compile }
// PR c++/11616: Incorrect line number in diagnostics
template <int> struct A
{
static const int i=0;
};
int baz() { return A<0>::i; }
struct B
{
static void foo (int); // { dg-message "B::foo|candidate expects" }
};
template <typename T> struct C
{
virtual void bar() const { T::foo(); } // {... |
google | chromium | crash48 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash48.C | 231 | utf_8 | f0bd0eae9334110a2b233af760fab84d | // PR c++/11471
// { dg-do compile }
template<typename T> struct A
{
typedef typename T::X X;
};
template<typename T> A<T>::X::X() {} // { dg-error "no type|invalid use|not a type|dependent" } |
google | chromium | pr4926-1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/pr4926-1.C | 350 | utf_8 | 698fef868c92929bbef3fe847bfc6295 | // PR c++/4926
// { dg-do compile }
template <unsigned> struct X { typedef int Type; };
template <typename T> struct Y { char array[1]; };
template<typename T> Y<T> P(T); // acts as "Y<typeof(T)>"
struct F { int operator()() const; };
template <typename T>
typename X<sizeof(P( T()() ).array)>::Type foo();
... |
google | chromium | ptrmem13 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ptrmem13.C | 121 | utf_8 | 97ddc530a1bd61b06c131cfdf61adbec | // PR c++/20734
struct A;
void blah(int A::*);
struct A{
int a;
};
template<typename T>
void hoho(){
blah(&A::a);
}
|
google | chromium | canon-type-12 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/canon-type-12.C | 205 | utf_8 | febd505492a8fa56d33ac1d2b69dc003 | // { dg-options "-std=c++0x" }
template<class T, T t = (T)0>
struct S
{
void
foo(decltype(t) = t);
};
template<class T, T t>
void
S<T, t>::foo(decltype(t))
{
}
void
bar()
{
S<int> s;
s.foo();
}
|
google | chromium | cond2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/cond2.C | 207 | utf_8 | fb5e6068a2c2c7fc1354db6b8fcac37b | // PR c++/11962
// { dg-options "" }
template<int X> class c;
template<int X, int Y> int test(c<X ? : Y>&); // { dg-error "omitted" }
void test(c<2>*c2) {
test<0, 2>(*c2); // { dg-message "required" }
}
|
google | chromium | dtor8 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/dtor8.C | 434 | utf_8 | 742d7a2b91f4f06a277defe5ec77d638 | // PR c++/43648
namespace dealii
{
namespace FEValuesViews
{
template <int dim, int spacedim> struct Scalar {};
}
template <int dim, int spacedim>
struct X
{
FEValuesViews::Scalar<dim,spacedim> scalars[dim*spacedim];
void f()
{
typedef dealii::FEValuesViews::Scalar<dim,s... |
google | chromium | using14 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/using14.C | 318 | utf_8 | 38f3caa7ff64898ee3a493900a978770 | // PR c++/26102
template <class T> struct B1 { int i(); };
struct B2 { int i(); };
template <class T> struct C : public B1<T>, public B2
{
using B2::i;
void f()
{
i(); // should be accepted
i.i(); // { dg-error "member" }
}
};
int main()
{
C<int> c;
c.f(); // { dg-message "required" }
}
|
google | chromium | qualified-id4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/qualified-id4.C | 218 | utf_8 | 28aaef5d5b00c58669547efbbb5d1f13 | // PR c++/48593
template <typename T> struct foo
{
T data;
};
template<typename T> struct bar: public foo<T>
{
void some_func()
{
T* ptr = &(foo<T>::data);
}
};
int main()
{
bar<int>().some_func();
}
|
google | chromium | koenig6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/koenig6.C | 436 | utf_8 | d7b45350c258784a47a153c1dedc979d | // PR c++/38850
template <typename VType>
class Vector2 {
private:
VType c_[2];
public:
typedef Vector2<VType> Self;
Vector2(const VType x, const VType y) {
c_[0] = x;
c_[1] = y;
}
friend inline Self Max(const Self &v1, const Self &v2) {
return Self(v1.c_[0], v1.c_[1]);
}
};
template <clas... |
google | chromium | access13 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/access13.C | 332 | utf_8 | 76f5c8b19b7f609c01aedaee827b1931 | // { dg-do compile }
// PR c++/13262: Access checking during instantiation of static data
// member.
template <typename T> class Aclass {
private:
Aclass() {}
static Aclass instance;
};
template <typename T> Aclass<T> Aclass<T>::instance;
template class Aclass<int>; |
google | chromium | crash11 | .C | native_client/pnacl-gcc/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 | chromium | error17 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/error17.C | 194 | utf_8 | 8e17e210a679a93a0f4f89a7a8f86e17 | // PR c++/20153
template <typename T>
void
foo()
{
union { struct { }; }; // { dg-error "prohibits anonymous struct" "anon" }
// { dg-error "not inside" "not inside" { target *-*-* } 7 }
}
|
google | chromium | array1-1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/array1-1.C | 418 | utf_8 | 99d7b1deba3ad5e11fcbd2dc7d70e9ee | // { dg-do compile }
// { dg-options "-fabi-version=1" }
// 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 | chromium | enum3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/enum3.C | 299 | utf_8 | dfe8fe9abce8be55414485a111a8c15f | // PR c++/17327
enum E { E0, E1 };
template <class T,class U> class A {};
template <class T> void f(A<E,T>) {}
// We used to issue a "sorry" message. By using an explicit error
// message below, we make sure that we will not match "sorry".
template void f(A<int,E>); // { dg-error "template-id" }
|
google | chromium | dependent-expr1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/dependent-expr1.C | 552 | utf_8 | 4e28ad3da9cf0f80841dd7ac6a9a0233 | // { dg-do compile }
// PR c++ 9779. ICE
struct I
{
};
void Foo (int);
namespace std
{
template <typename X>
void Baz (I *x)
{
Foo (sizeof (I));
Foo (sizeof (x));
Foo (__alignof__ (I));
Foo (__alignof__ (x));
Foo (x->~I ()); // { dg-error "" }
// Foo (typeid (I));
Foo (delete x); /... |
google | chromium | sfinae15 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/sfinae15.C | 342 | utf_8 | dec4c005e2519f91c25afec0479ecb02 | // PR c++/40944
// { dg-options -std=c++0x }
// { dg-do run }
template<typename T>
struct make { static T&& it(); };
void (*pf)(int&) = 0;
template< typename T >
int bar(T const& x,
decltype( pf(make<T const&>::it()) )* = 0 // SFINAE!
) {
return 1;
}
int bar(...) {
return 0;
}
int main() {
... |
google | chromium | crash51 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash51.C | 270 | utf_8 | 81f57567c6c2e784acb94f07d2c3b51e | // PR c++/26496
template< typename _Generator> int generate_n(_Generator __gen);
struct Distribution { };
typedef double (Distribution::* Pstd_mem)();
int main(void)
{
Distribution* rng;
Pstd_mem ptr;
generate_n(rng->*ptr); // { dg-error "non-static member" }
}
|
google | chromium | decl2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/decl2.C | 207 | utf_8 | 05e0d875681f42cc0eb951378ac07bd0 | // PR c++/16162
template <int N> struct O {
struct I {
template <typename T> struct II {
void f();
};
};
};
template <int N>
template <typename T>
void O<N>::I::II<T>::f () {}
|
google | chromium | access9 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/access9.C | 401 | utf_8 | 7834be58b513cdde90c14c885e21ae63 | // { dg-do compile }
// Template instantiate during deferred access check
template <void (*)(int)> struct C {
typedef int Y;
};
template <class T> void f(typename T::X) {
}
class A {
typedef int X;
template <class T> friend void f(typename T::X);
};
C<&f<A> >::Y g(int); |
google | chromium | crash95 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash95.C | 218 | utf_8 | 9f8998ef635f3a6acece5f40e91e531e | // PR c++/43705
template < typename > struct S
{
template < > struct S < int > // { dg-error "explicit|specialization|template|parameter" }
{
S(int);
};
};
S < int > s(0); // { dg-error "incomplete type" }
|
google | chromium | subst1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/subst1.C | 549 | utf_8 | 65ffda86719727c560bb58b2ddc37078 | // { dg-do compile }
// PR 7718. ICE.
template <typename OBJECT>
void default_initializer(const OBJECT &) { }
template <typename OBJECT, void init_function(const OBJECT &)>
class cContainer {
public:
template <typename INITIALIZER>
void Add(const INITIALIZER &initializer) {
init_function(initializer);
}
};
... |
google | chromium | crash14 | .C | native_client/pnacl-gcc/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 | chromium | crash26 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash26.C | 238 | utf_8 | 17d811daa3052b89558edc8df7e9ee0e | // { dg-do compile }
// PR c++/18471: ICE redeclaration of typedef as class template
typedef int X; // { dg-error "previous" }
template<X> struct X {}; // { dg-error "typedef-name" } |
google | chromium | ttp5 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ttp5.C | 402 | utf_8 | 786176b167efb2fb05f5876afccf4ea7 | // { dg-do compile }
// PR c++/8772: Incorrect diagnostics for template template parameter
// mismatch
template <int> struct A {
template <int> struct B {
enum { v = 1 };
};
};
template <template <int> class F> struct C {
enum { v = F<1>::v || 2 };
};
template <int n> struct D {
enum { v = C<A<n>::B>::v };... |
google | chromium | alignof1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/alignof1.C | 152 | utf_8 | 98629e0464be5ba2c3ca56190b5b6f48 | template<typename T>
int my_alignof()
{
return __alignof__(T);
}
template<typename>
struct X { };
int main()
{
return my_alignof<X<void> >();
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.