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 | repo6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/repo6.C | 432 | utf_8 | 936f4808a4e8d1dca305df8e8a638a2a | // PR c++/34178
// { dg-options "-frepo" }
// { dg-final { cleanup-repo-files } }
// { dg-require-host-local "" }
// { dg-skip-if "dkms are not final links" { vxworks_kernel } }
template<typename T>
class A
{
private:
static const int x;
static int y;
public:
int getX () { return x + y; }
};
template<typename ... |
google | chromium | redecl4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/redecl4.C | 144 | utf_8 | cd21403ce71916cfa4b5c75f6da549d9 | // PR c++/28710
// { dg-do compile }
template<int> union A; // { dg-error "previous" }
struct A; // { dg-error "non-template" }
|
google | chromium | partial8 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/partial8.C | 125 | utf_8 | 2b23d416282107a906fcf6e2b3a898e7 | // PR c++/32505
template <class T> struct A { };
A<int*> a;
template <class T> struct A<T*> { }; // { dg-error "A<int\\*>" }
|
google | chromium | memfriend6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/memfriend6.C | 856 | utf_8 | 1e93d7f7d38f19d9cc623f9113275868 | // { dg-do compile }
// Member function of class template as friend
// Erroneous case: mismatch during declaration
template <class T> struct A {
template <class U> void f(U); // { dg-error "candidate" }
void g(); // { dg-error "candidate|with" }
void h(); // { dg-error "candidate|with" }
void i(int); ... |
google | chromium | restrict1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/restrict1.C | 147 | utf_8 | 9e9322d04add76d1f767de02d143704b | // PR c++/6392
// Bug: We tried to make the array restricted, which doesn't make sense.
template <class T>
class bob
{
T * __restrict a[50];
};
|
google | chromium | error1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/error1.C | 350 | utf_8 | 21c90677bbfb74c29a346183dc8bc5a3 | // { dg-do compile }
// PR c++ 10219. ICE
template <class T> void make_pair(T x);
void foo(){
struct fps_chan_ID fps; // { dg-error "incomplete" "" }
make_pair(fps); // { dg-bogus "no matching function" "" }
} |
google | chromium | array16 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/array16.C | 168 | utf_8 | 53d279c2d582bce6b0ed40786c57eb25 | // PR c++/28886
template<typename> struct A;
template<typename T, int N> struct A<T[N]> {};
template<typename T, int N> struct A<const T[N]> {};
A<const int[1]> a;
|
google | chromium | spec6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/spec6.C | 189 | utf_8 | b03b7960945086593b8859887c9f2b8e | template <bool, int> struct X {};
template <bool C> struct X<C,1> {
typedef double* type;
type foo () const;
};
template <bool C>
typename X<C,1>::type
X<C,1>::foo () const {}
|
google | chromium | friend6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/friend6.C | 914 | utf_8 | d16da0e6f160e02bc23c4d98080f1644 | // { dg-do compile }
namespace boost_no_member_template_friends{
template <class T>
class foobar;
template <class T>
class foo
{
private:
template<typename Y> friend class foobar;
template<typename Y> friend class foo;
template<typename Y> friend bool must_be_friend_proc(const foo<Y>& f);
int i;
public:
... |
google | chromium | assign1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/assign1.C | 145 | utf_8 | 63a5e3d5f634ef4eb13aa4a9d62a8cd7 | // PR c++/16623
template <int N>
struct C
{
C& operator= (int);
};
template <int N>
C<N>& C<N>::operator= (int)
{
return *this;
}
C<0> a;
|
google | chromium | crash84 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash84.C | 360 | utf_8 | 36ae38240d99fdf5d8b5fa55c83c2848 | // Origin PR c++/35405
// { dg-do compile }
template<typename T> struct a
{
template <template <typename> class C, typename X, C<X>* =0>
struct b // { dg-error "class C' is not a template|is not a valid type" }
{
};
};
void
foo ()
{
a<int> v; // { dg-message "required from here" }
} |
google | chromium | redecl1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/redecl1.C | 75 | utf_8 | c7309345696ac164222361961daab266 | // PR c++/15025
template <int> struct X;
struct X {}; // { dg-error "" }
|
google | chromium | shift1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/shift1.C | 223 | utf_8 | 429c749d4a969d6e6782e2108d66cc72 | // PR c++/18140
// { dg-options "-std=gnu++98" }
template <int N> struct IntHolder {
static const int value = N;
};
template <int N, int S> struct ShrIntHolder {
static const int value = IntHolder< N>>S >::value;
};
|
google | chromium | spec29 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/spec29.C | 397 | utf_8 | 9b290630d01c434872c1ed3db6067a4f | // PR c++/25855
// { dg-do run }
template <typename T> int qCompare(const T *t1, const T *t2) { return 1; }
template <typename T> int qCompare(T *t1, T *t2) { return 2; }
template <typename T1, typename T2> int qCompare(const T1 *t1, const T2 *t2) {
return 3; }
template<> int qCompare(const char *t1, const char *t... |
google | chromium | typename2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/typename2.C | 632 | utf_8 | e157ec339365093c9f152c565a72d172 | // { dg-do compile }
// { dg-options "" }
// PR 5507. Overzealous implicit typename warning
template<typename _CharT>
class __ctype_abstract_base
{
typedef int mask;
};
template<typename _CharT>
class ctype : public __ctype_abstract_base<_CharT>
{
typedef typename ctype::mask mask;
};
template<typename _CharT>
clas... |
google | chromium | arg6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/arg6.C | 240 | utf_8 | f90e567b7331a6236abd917963c61a0f | // PR c++/33744
// { dg-do run }
template <bool B> struct A { bool b; A() : b(B) {}; };
A<bool(1)> a;
A<bool(1<2)> b;
A<(bool)(2>1)> c;
A<bool((2>1))> d;
A<bool(2>1)> e;
int
main ()
{
return (a.b && b.b && c.b && d.b && e.b) ? 0 : 1;
}
|
google | chromium | mangle1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/mangle1.C | 292 | utf_8 | 33119bbc7489f718bc456a2baae44253 | // PR c++/17324
// { dg-do assemble }
template<int, typename T> struct A
{
template<int I> void foo(const A<I,T>&) {}
};
template<typename> struct B
{
template<int J> void bar(const A<J,B>&);
void baz() { A<0,B>().foo(A<0,B>()); }
};
template struct B<void>;
template struct B<int>;
|
google | chromium | typename14 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/typename14.C | 407 | utf_8 | 7dd8b9bc6da8c8f42250a913e3dbff25 | // { dg-do compile }
template <typename T> struct A
{
typedef const T X;
struct B;
};
template <typename T> struct A<T>::B
{
typedef volatile typename A<T>::X Y;
T const volatile *Foo ();
};
template<typename T>
typename A<T>::B::Y *A<T>::B::Foo ()
{
return 0;
} |
google | chromium | static26 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/static26.C | 249 | utf_8 | 2bfba281dfdf39292b16309d13ce403d | // PR c++/28016
// { dg-final { scan-assembler-not "computed" } }
template<class T1, class T2>
struct scalar_divides_assign {
static const bool computed ;
};
template<class T1, class T2>
const bool scalar_divides_assign<T1,T2>::computed = true;
|
google | chromium | pr28284 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/pr28284.C | 242 | utf_8 | 10a1cc60b3d92d61e1b34b9ac481d289 | /* { dg-do compile } */
template<int> struct A
{
static const int i=x; /* { dg-error "was not declared in this scope" } */
static const int j, k;
};
template<int N> const int A<N>::j = i;
template<int N> const int A<N>::k = j;
A<0> a;
|
google | chromium | static19 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/static19.C | 458 | utf_8 | 0cac9c7a335a2eb97f02d3b04f03aa6a | // PR c++/24275
template <bool val> struct bool_var {
static const bool value = val;
};
namespace is_inc_ {
struct any {
template <class T> any(T const&);
};
int operator++(any const&);
template <class T> struct impl {
static T &x;
static const bool value = sizeof(++x) == 1;
};
}
template<ty... |
google | chromium | crash1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash1.C | 335 | utf_8 | ff8577ac97f88f47b1257f3d5c6a4c9a | // { dg-do compile }
// PR 5125. ICE
class S
{
public:
template <class I> void Foo(int (*f)(S& o) );
};
template <class I>
void S::Foo(int (*f)(TYPO&o) ) // { dg-error "Foo|f|TYPO|o" }
{
} |
google | chromium | fntry1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/fntry1.C | 442 | utf_8 | 8f101d84c90c958381606b762e3df298 | // PR c++/26433
// { dg-do link }
int get_int()
{
throw 1;
return 0;
}
template <class _T> class Test
{
public:
Test()
try
: i(get_int())
{
i++;
}
catch(...)
{
// Syntax error caused by undefined __FUNCTION__.
const char* ptr = __FUNCTION__;
}
private:
int i;
_T t;
};
int m... |
google | chromium | param2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/param2.C | 256 | utf_8 | 335d675c515abc3965d67af12d3a7c72 | // Origin PR c++/47311
// { dg-do compile }
template < typename > class A0;
template <class Key, class T, template < typename TF = T> class TC = A0> class B0;
template <int> class A1;
template <class Key, class T, template <T p> class TC = A1> class B1;
|
google | chromium | array1-2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/array1-2.C | 418 | utf_8 | 075227803fea6455eb958b3d2d173e9b | // { dg-do compile }
// { dg-options "-fabi-version=2" }
// PR c++/12774 Array domains compared unequal
void Foo(double r[3][3])
{
}
void Baz()
{
double m[3][3];
Foo(m);
}
template <class T>
void Bar()
{
double m[3][3];
Foo(m);
}
int main()
{
Baz();
Bar<int>();
return 0;
} |
google | chromium | friend7 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/friend7.C | 377 | utf_8 | 1d4f923241bfe8578940f39c34f80d7c | // { dg-do compile }
template <typename V>
struct b
{
template <typename T>
class a
{
template <typename>
friend class a;
T t_;
public:
a() {}
a(a<T *> const &);
};
};
template <typename V>
template <typename T>
b<V>::a<T>::a(a<T *> const &rhs): t_(*rhs.t_)
{}
int
f ()
{
b<void *>... |
google | chromium | using12 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/using12.C | 113 | utf_8 | d401bee05fb2dd315aae324d855a8f7a | struct A {
};
template <typename T>
struct S : public A {
using A::operator(); // { dg-error "no member" }
};
|
google | chromium | spec31 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/spec31.C | 122 | utf_8 | 5f4ca65174fe2a4c7ed7bfb4fa8c89d5 | // PR c++/28058
template<int> struct A
{
A() {}
};
A<0> a;
template<> A<0>::A() {} // { dg-error "specialization" }
|
google | chromium | incomplete3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/incomplete3.C | 166 | utf_8 | b6192cd189e5459a84384348bf07ab8a | // PR c++/27315
// { dg-do compile }
struct A; // { dg-error "forward declaration" }
template void A::foo<0>(); // { dg-error "before|incomplete" }
|
google | chromium | overload2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/overload2.C | 267 | utf_8 | 55cb3ca88be88700e7e00981ae5c08c6 | template <class T, int (T::*)> struct foo;
template <class T>
int f(foo<T,&T::ob_type>*);
template <class T>
char* f(...);
struct X { int ob_type; };
struct Y { char* ob_type; };
int x = f<X>(0);
char* y = f<Y>(0);
char* z = f<int>(0);
int main() { return 0; }
|
google | chromium | qual2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/qual2.C | 427 | utf_8 | 4bcab05d2626fd45890af6154fa22221 | // { dg-do run }
// PR9415. Forgot a lookup was scoped
int here;
int there;
struct B
{
virtual int activate() {return !here++;}
};
template <class K>
struct TPL : public B
{
int activate()
{
return !there++ && B::activate();
}
};
int main ()
{
TPL<int> i;
return !i.activate ();
} |
google | chromium | sfinae23 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/sfinae23.C | 516 | utf_8 | b7eb1eb19931468a6c6037d6f5527f39 | // PR c++/44969
// { dg-options "-std=c++0x" }
template<typename Tp, typename... Args>
class mini_is_constructible
{
typedef char one;
typedef struct { char arr[2]; } two;
template<typename Tp1, typename... Args1>
static decltype(Tp1(Args1()...), one())
test(int);
template<typename, t... |
google | chromium | stmtexpr1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/stmtexpr1.C | 150 | utf_8 | 53fcc90b25ad8744232fbb7b915d3d89 | // PR c++/17404
// { dg-do compile }
// { dg-options "" }
template <int> void foo ()
{
__builtin_expect (({0;}), 1);
}
template void foo<1> ();
|
google | chromium | call2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/call2.C | 170 | utf_8 | e459df3ddd572b111e8694073c95e5b9 | // PR c++/13592
struct S {
void operator()(int);
};
struct A {
template <typename> void foo();
S s;
};
template <typename> void A::foo() {
s(0);
}
|
google | chromium | non-dependent3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/non-dependent3.C | 312 | utf_8 | 9c0fc4f566e5de8ff0339df3c3ef274d | //PR c++/11071
// Used to ICE
template <bool b> struct X {
template <typename T>
static int* execute(T* x) { return x; }
};
template <typename T> void foo() {
static bool const same = true;
X<same>::execute ((int*)0);
}
template void foo<int> (); |
google | chromium | conv3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/conv3.C | 663 | utf_8 | be5017725e9889a47d07ba0d3a3464ff | // { dg-do run }
// PR 4361. Template conversion operators were not overloaded.
template <typename T> struct C
{
operator T ()
{
return 0;
}
template <typename T2> operator T2 ()
{
return 1;
}
int Foo ()
{
return operator T ();
}
template <typename T2> int Baz ()
{
return static_c... |
google | chromium | crash17 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash17.C | 223 | utf_8 | 78327c2d24f8befdc8bd1b4f71aa2928 | template <int I>
struct A {
};
template <typename T>
struct B {
typedef typename T::type type;
static const type j = T::j;
A<j> b;
};
struct C {
typedef int type;
static const int j = 3;
};
int i = B<C>::j;
|
google | chromium | access20 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/access20.C | 295 | utf_8 | 97435ae64eee527d6ffaaa5dcc63f78e | // PR c++/29470
template <typename T> struct B
{
protected:
T v; // { dg-error "protected" }
};
template <typename T> struct D : B<T>
{
protected:
using B<T>::v;
};
int main()
{
D<int> d;
d.v = 0; // { dg-error "context" }
return 0;
}
|
google | chromium | typedef1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/typedef1.C | 443 | utf_8 | 3c8d3538984363bd4ff0ecceec6b5f59 | // { dg-do compile }
// PR 72
template <typename T> struct A
{
typedef T type;
};
template <typename T> struct B
{
typedef int xxx; // { dg-error "" }
typedef T xxx; // { dg-error "" }
typedef typename A<T>::type xxx; // { dg-error "" }
typedef A<int>::type xxx; // { dg-error "" }
};
B<int> good; |
google | chromium | access22 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/access22.C | 172 | utf_8 | 0efb5f7bc1cba01bee2985b139c1277e | template <int I> struct B { };
template <class T>
B<T::I> f();
class A
{
static const int I = 42;
template <class T> friend B<T::I> f();
};
int main()
{
f<A>();
}
|
google | chromium | explicit-args2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/explicit-args2.C | 649 | utf_8 | 7da1155f45a6042d3c0c9f0a0717590f | // PR c++/37177
// { dg-options -std=c++0x }
#include <typeinfo>
namespace N1
{
template<class T> bool foo();
}
struct S
{
template <class T>
static bool foo();
template <class T>
bool bar();
};
template<class T> bool foo();
int main()
{
(void)(&S::bar<int>);
decltype(&S::bar<int>) a;
typeid(&S::b... |
google | chromium | crash50 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash50.C | 148 | utf_8 | b775d6787ef17bc0e7018ea9b737dab4 | // PR c++/27398
// { dg-do compile }
struct A
{
template<int> void* foo(; // { dg-error "primary-expression|initialization|static|template" }
};
|
google | chromium | using1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/using1.C | 562 | utf_8 | 36bc33b0a7d4f4c6efc1f83c1b6bf13b | // { dg-do run }
// PR 9447. Using decls in template classes.
template <class T>
struct Foo {
int i;
};
struct Baz
{
int j;
};
template <class T>
struct Bar : public Foo<T>, Baz {
using Foo<T>::i;
using Baz::j;
int foo () { return i; }
int baz () { return j; }
};
int main()
{
Bar<int> bar;
bar.i = 1... |
google | chromium | partial9 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/partial9.C | 93 | utf_8 | 38d6a93d39574f0fe432f5e41591e968 | // PR c++/36435
template <class T> T f();
template <class T> T* f() { }
template int* f();
|
google | chromium | non-dependent9 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/non-dependent9.C | 273 | utf_8 | d2f711147c60030525ec70290e759fca | // { dg-do compile }
// Two-phase name lookup for address of member:
// Overloading function
struct S
{
int f();
int f(int);
};
template<int (S::*p)()>
struct X
{};
template <class T>
struct Foo
{
X<&S::f> x;
}; |
google | chromium | memfriend16 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/memfriend16.C | 610 | utf_8 | 589793a48cdfb3f51df2530b2474a85c | // { dg-do compile }
// Nested class of class template as friend
template<class T> struct A
{
template <class U> struct B1
{
};
template <class U> struct B2
{
void f();
};
};
class C {
int i; // { dg-error "private" }
template<class T> template <class U> friend struct A<T>::B1;
};
template<class T> ... |
google | chromium | ptrmem1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ptrmem1.C | 599 | utf_8 | 30d2a35742944aa3c421d0b6d2b41781 | // { dg-do compile }
// PR 3716 tsubsting a pointer to member function did not create a
// pointer to member function.
template <class C, class T, T C::*M>
struct Closure
{
T operator() (C & c) const { return (c.*M); }
};
template <class C, class T, T (C::* M)()>
struct Closure<C, T (), M>
{
T operator()(C & c) con... |
google | chromium | ptrmem6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ptrmem6.C | 195 | utf_8 | 0142354fd9237d4486fb0edc36ef39cc | struct S {};
void g(int S::**);
template <typename T>
void f (int T::* volatile *p) {
g(p); // { dg-error "conversion" }
}
template void f(int S::* volatile *); // { dg-message "required" }
|
google | chromium | unify10 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/unify10.C | 3,018 | utf_8 | a10ab695633f63b3e958bfb839bf37d7 | // { dg-do compile }
// Origin: Wolfgang Bangerth <bangerth at ticam dot utexas dot edu>
// and Rene Fonseca <fonseca at mip dot sdu dot dk>
// PR c++/8271: Check cv-qualifiers while unifying pointer to member
// functions.
struct MyClass {
void mMethod() throw() {}
void cMethod() const throw() {}
void vMet... |
google | chromium | sfinae3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/sfinae3.C | 334 | utf_8 | df17c39af3a33df1f3370cca4ca51b18 | // PR c++/24671
// { dg-do compile }
template<typename> struct A
{
typedef int X;
static const int i = 0;
};
template<typename> struct B
{
B(const B&);
typedef typename A<char[A<B>::i]>::X Y; // { dg-error "forbids zero-size array" }
template<typename T> B(T, Y);
};
B<int> b(0,0); // { dg-message "required... |
google | chromium | dtor4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/dtor4.C | 178 | utf_8 | 6e56714a3e1899ea002e689d9f32a53f | // PR c++/19440
// { dg-do compile }
template<int> struct A
{
~A<0>(); // { dg-error "parse error|declaration" }
}; |
google | chromium | non-dependent13 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/non-dependent13.C | 146 | utf_8 | 40b38a3d73d53481f9e1570a38ed4eab | // PR c++/26266
template <int I>
struct S;
template <int I>
void f() {
if (const int i = 3) {
S<i>::j; // { dg-error "incomplete" }
}
}
|
google | chromium | ttp22 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ttp22.C | 240 | utf_8 | bb208d004cabc03fdafadc3dd900340e | // PR c++/28860
// { dg-do compile }
template<template<int> class A>
class A<0>; // { dg-error "shadows template template parameter" }
template<template<int> class B>
class B<0> {}; // { dg-error "shadows template template parameter" }
|
google | chromium | template-id-3 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/template-id-3.C | 286 | utf_8 | e93f073f61a42e3c7ad372625dbf5491 | // PR c++/48261
typedef double (*gaddType)(double,double);
struct Foo2
{
static gaddType add;
};
template<typename T>
struct Something
{
void work()
{
double x=T::template add<double>(5.0,6.0); // { dg-error "add" }
}
};
int main()
{
Something<Foo2> s2;
s2.work();
}
|
google | chromium | sfinae19 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/sfinae19.C | 1,047 | utf_8 | defcae158cfa0bf28425c808da6cab35 | // PR c++/44907
struct A { };
struct B
: public A { };
struct C
: public A { };
struct D
: public B, public C { };
template<bool, typename T = void> struct enable_if { typedef T type; };
template<typename T> struct enable_if<false, T> { };
template<typename From, typename To>
class mini_is_convertible
{
t... |
google | chromium | error8 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/error8.C | 107 | utf_8 | 087bbcdc150fa765a03be550dd7193ce | // PR c++/11116
template <typename T> struct S {};
void f() {
throw S (); // { dg-error "template" }
}
|
google | chromium | dependent-expr7 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/dependent-expr7.C | 181 | utf_8 | 62547428f2604bbed7afb83c31bfb8cb | // Origin PR c++/48574
// { dg-do compile }
struct A
{
virtual void foo();
};
template <typename T>
void
bar(T x)
{
A &b = *x;
b.foo ();
}
void
foo()
{
A a;
bar(&a);
}
|
google | chromium | sfinae4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/sfinae4.C | 862 | utf_8 | 14c823d80f9e1e49b0085a00aa357406 | // DR 339
//
// Test of the use of free functions with SFINAE
void foo(int) { }
template<typename T> void foo(T*) { }
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_... |
google | chromium | unify6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/unify6.C | 599 | utf_8 | 64a0956716b0f07d4c38edfd9b83783a | void Baz ();
template <typename T> void Foo1 (T *); // #1
template <typename T> void Foo1 (T const *a) {a (1);} // #2
template <typename T> T const *Foo2 (T *);
template <typename T> void Foo3 (T *, T const * = 0); // { dg-message "note" }
void Bar ()
{
Foo1 (&Baz); // #1
Foo2 (&Baz);
Foo3 (&Baz);
Foo3 (&Baz, &... |
google | chromium | call7 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/call7.C | 283 | utf_8 | 4430bc3c331103d5a2ee03d64056e256 | // Origin: PR c++/17395
// { dg-do compile }
template<int> struct X { };
void fu(int a, X<sizeof(a)>) { }
template<class T>
void bhar(T a, X<sizeof(a)>) { }
int
main()
{
int x;
X<sizeof(int)> y;
fu(x, y);
bhar(x, y);
} |
google | chromium | sfinae14 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/sfinae14.C | 2,421 | utf_8 | 8cbf9e9ec798570f590ac39820557fc3 | // DR 339
//
// Test of the use of the new and new[] 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... |
google | chromium | error37 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/error37.C | 264 | utf_8 | 34ab2aefdfc2ee66c4a1c5d1830304e9 | // { dg-do compile }
// PR C++/29388
// We used to ICE in is_ancestor because we would use int as the context of foo
// but that is invalid.
template<int> struct A
{
typedef int T;
void foo();
};
template<int N> void A<N>::T::foo() {} // { dg-error "" }
|
google | chromium | friend35 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/friend35.C | 347 | utf_8 | e1e2f22ab1205ab9d092f2b388d3e071 | // { dg-do compile }
// PR c++/4403: Incorrect friend class chosen during instantiation.
template <typename T>
struct A
{
struct F;
};
template <typename T>
struct B : A<T>
{
friend struct F;
private:
int priv;
};
struct F
{
void func(void)
{
B<int> b;
b.priv = 0;
}
}; |
google | chromium | ctor6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ctor6.C | 88 | utf_8 | 25d3511fe5a378afd592b4563e115a7c | // PR c++/25663
template<int> struct A
{
A(int);
};
void foo()
{
A<0>(A<0>(0));
}
|
google | chromium | friend10 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/friend10.C | 833 | utf_8 | bdf8365204c19eeb87434d85b7139d2d | // { dg-do run }
// PR 5116. template instantiation can add a friend into a namespace,
// and thus change overload resolution.
#include <iostream>
static int right;
static int wrong;
struct Buggy {};
template <typename T>struct Handle
{
Handle(T* p) {}
operator bool() const { wrong++; return true; }
friend ... |
google | chromium | error26 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/error26.C | 148 | utf_8 | 4193d6f584da90f2fe4c2e4cc8ef6c43 | // PR c++/32112
template<typename> struct A;
template<typename T> void foo (A<&T::template i>); // { dg-error "T:: ?template i|mismatch|& T::i" }
|
google | chromium | crash44 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash44.C | 110 | utf_8 | 37c9686aad1de31e5858e6070db0fd76 | // PR c++/25858
namespace N {
template<int> struct A {};
}
struct B N::A<0> {}; // { dg-error "invalid" }
|
google | chromium | static13 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/static13.C | 181 | utf_8 | fe8a47b8f67dd5267646e9d0116a86ca | // PR c++/23099
struct Base {
int x;
};
template <typename T>
struct A {
static const int N = sizeof(static_cast<Base*>(T()));
};
struct Derived : Base {
A<Derived*> a;
};
|
google | chromium | crash66 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash66.C | 389 | utf_8 | e29b7df66408269c2eaea4100f6227cf | // PR c++/29535
// { dg-do compile }
template <class INDEX> struct SetRegion2D
{
struct FloodFillControl
{
struct Allocator{};
};
};
template <int DIM, class PIXELINDEX>
struct MotionSearcher
{
typedef SetRegion2D<PIXELINDEX> Region_t;
MotionSearcher (typename Region_t::FloodFillControl::Allocator &a_rAllo... |
google | chromium | local2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/local2.C | 2,293 | utf_8 | d32b0f4cfabbf7cf6a3f55db155096d2 | template<typename T>
struct X {
double & f (const unsigned int i,
const unsigned int j);
void g (X &M);
};
template <typename T>
void X<T>::g (X &x) {
double t14 = x.f(0,0)*x.f(1,1);
double t15 = x.f(2,2)*x.f(3,3);
double t17 = x.f(2,3)*x.f(3,2);
double t19 = x.... |
google | chromium | instantiate6 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/instantiate6.C | 311 | utf_8 | 1b065aa49cdac44198ed227ed0da9cb5 | // { dg-do compile }
// PR c++/13289: ICE recursively instantiate static member data.
template <int N> struct S {
static const int C;
};
template <int N>
const int S<N>::C = S<(N+1)%2>::C;
template struct S<1>; |
google | chromium | crash24 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash24.C | 191 | utf_8 | 1cb212177b7a7b17863561096ca1b123 | // PR c++/17826
struct A
{
template<typename> static int foo();
};
template<int> struct B {};
template<typename T> void bar()
{
B<sizeof A::foo<T>()> b1;
B<sizeof A::foo<T>()> b2;
}
|
google | chromium | ctor7 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/ctor7.C | 309 | utf_8 | 0572945ccfe2a2369a8e72b22dab3d97 | // PR c++/27640
template < class T > struct refcounted :
virtual T
{
template < class A1 > refcounted (const A1 & a1) : T () { }
};
struct nfsserv {};
template < class T >
void
sfsserver_cache_alloc (int *ns)
{
new refcounted < nfsserv > (*ns);
}
void
usage ()
{
sfsserver_cache_alloc < int > ( 0);
}
|
google | chromium | array13 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/array13.C | 226 | utf_8 | 29ac13549ace1bb08c2a718d6a2f3d31 | // PR c++/20208
// { dg-do run }
// { dg-options "-O2" }
extern "C" void abort();
template <typename T>
inline void *Foo (T arg) { return &arg[0]; }
int main () {
int bry[2];
if (Foo<int[2]>(bry) != bry)
abort();
}
|
google | chromium | friend46 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/friend46.C | 177 | utf_8 | b6050fc706b8413aeac096dd69086d72 | // PR c++/27714
template<typename> struct A
{
static void* operator new(__SIZE_TYPE__);
template <typename T> friend void* A<T>::operator new(__SIZE_TYPE__);
};
A<int> a;
|
google | chromium | mem-partial1 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/mem-partial1.C | 289 | utf_8 | 20021d29d7752d6eac42fc721092a468 | // PR c++/14032
template <typename T> struct outer {
template <typename T2, typename U>
struct inner {
static int f() { return inner<T,int>::N; };
};
template <typename U>
struct inner<T,U> {
static const int N = 1;
};
};
int i = outer<int>::inner<double,int>::f();
|
google | chromium | crash4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/crash4.C | 189 | utf_8 | 4565662b8ea1b02f11db4b1627917693 | namespace NS {
struct C {};
void foo();
}
template <class T> struct X {};
template <class T> struct A {
A() { foo (X<T>()); }
void foo(X<T>);
};
template struct A<NS::C>;
|
google | chromium | eh2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/eh2.C | 268 | utf_8 | 2bd42f9c520c057a1250a8f6317934fb | // PR c++/23191
// { dg-do compile }
template<typename T> struct A
{
void foo() throw(typename T::X); // { dg-error "not a class" }
};
A<void> a; // { dg-message "required" } |
google | chromium | enum5 | .C | native_client/pnacl-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/pnacl-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/pnacl-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 | const4 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/const4.C | 135 | utf_8 | 54628fbcc903705b1f2ac3e7f67e0ea7 | // PR c++/48657
template<unsigned> struct A { typedef int T; };
template<unsigned> void f()
{
const unsigned D = 4;
A<D>::T t;
}
|
google | chromium | ttp17 | .C | native_client/pnacl-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/pnacl-gcc/gcc/testsuite/g++.dg/template/typename4.C | 190 | utf_8 | e539dae13a2fcf8c5c897799294fa8f0 | struct B { template <typename U> struct C; };
template <typename T> struct A { typedef typename T::C V; }; // { dg-error "not a type" }
void f () { A<B>::V p; } // { dg-message "required" }
|
google | chromium | lookup2 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/lookup2.C | 365 | utf_8 | e1e6ffb2ea2a524c64cbcc0a6f97459a | // { 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 "required" "" }
} |
google | chromium | vla2 | .C | native_client/pnacl-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/pnacl-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/pnacl-gcc/gcc/testsuite/g++.dg/template/recurse.C | 712 | utf_8 | b2383a6b8b72c44dc2c314ba40ab4cd6 | // 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-bogus "exceeds maximum.*exceeds maximum" "exceeds" { xfail *-*-* } 8 }
... |
google | chromium | ptrmem9 | .C | native_client/pnacl-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/pnacl-gcc/gcc/testsuite/g++.dg/template/instantiate1.C | 395 | utf_8 | f8b1065b008b6e16079f73a10fc394ef | // { 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 "required" }
};
template <class T> struct Z { // { dg-error "declaration" ... |
google | chromium | partial1 | .C | native_client/pnacl-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/pnacl-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/pnacl-gcc/gcc/testsuite/g++.dg/template/typedef4.C | 266 | utf_8 | 2ffbcc1ef99f24c2acacaeb4f1276cb4 | // PR c++/27572
// { dg-do compile }
template<typedef> void foo(); // { dg-error "no type|typedef declaration|template" }
void bar()
{
foo<int>(); // { dg-error "matching" }
// { dg-message "candidate" "candidate note" { target *-*-* } 8 }
}
|
google | chromium | typedef11 | .C | native_client/pnacl-gcc/gcc/testsuite/g++.dg/template/typedef11.C | 413 | utf_8 | 54c2956e9d96b1d764080d6e3a73a923 | // Origin: PR c++/26693
// { dg-do compile }
class Alpha
{
typedef int X; // { dg-error "'typedef int Alpha::X' is private" }
};
template<int>
class Beta
{
typedef int Y; // { dg-error "'typedef int Beta<0>::Y' is private" }
};
template <int>
int
bar ()
{
Beta<0>::Y i = 0;
return Alpha::X ();
}
int i = bar<0>... |
google | chromium | member7 | .C | native_client/pnacl-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/pnacl-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/pnacl-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/pnacl-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/pnacl-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/pnacl-gcc/gcc/testsuite/g++.dg/template/canon-type-4.C | 311 | utf_8 | 6182badf792f2a554489f1b490e70bc3 | // 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; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.