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
|
using6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/using6.C
| 168 |
utf_8
|
6bc8a704452336d9d0ee978fef2a7f60
|
namespace foo {
template<typename T>
struct A {};
}
namespace bar {
template<typename T>
struct A {};
}
namespace foo {
using bar::A; // { dg-error "" }
}
|
google
|
chromium
|
crash72
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash72.C
| 360 |
utf_8
|
5af3f62d9558cd52f4d5aa70db89dd19
|
// PR c++/29225
// { dg-do compile }
template <typename L, typename R> bool operator< (L x, R y);
struct T { int t (); };
class S {};
struct U
{
typedef int (T::* M) ();
M m;
bool operator() (S &x)
{
T a;
return (a.*m) < x; // { dg-error "invalid use of non-static member" }
}
};
void foo (S &x)
{
U m;
m.m = &T::t;
m (x);
}
|
google
|
chromium
|
meminit1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/meminit1.C
| 149 |
utf_8
|
d138b62e79d7c32ba8e727ff12569de0
|
// { dg-options "-std=gnu++98" }
template <class T >
struct S
{
S() : S() {} // { dg-error "base" }
};
S<int> s; // { dg-message "instantiated" }
|
google
|
chromium
|
crash39
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash39.C
| 214 |
utf_8
|
30bbbe26494a0bd1a56a703fe4aae882
|
// PR c++/22405
template <typename T> void foo(T &arg) { // { dg-error "declared" }
arg+=1;
}
template <typename T> void foo(T &arg) { // { dg-error "redefinition" }
arg+=2;
}
template void foo(float &arg);
|
google
|
chromium
|
vtable1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/vtable1.C
| 315 |
utf_8
|
98fb9a7526b5989b48ce49e7131f8f76
|
// Test that vtables are set up properly for constructors and destructors
// of template classes.
// { dg-do run }
int r;
template <class T>
struct A {
virtual void f () { }
A() { f (); }
~A() { f (); }
};
struct B : public A<int> {
virtual void f () { ++r; }
};
int main ()
{
{ B b; }
return r;
}
|
google
|
chromium
|
explicit2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/explicit2.C
| 128 |
utf_8
|
44f3a8f925589bae9dc773b19a3fd2de
|
struct X {
template <class B> void foo(B);
};
template <class D>
void bar() {
X().foo<D>(1);
}
template void bar<int> ();
|
google
|
chromium
|
arg1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/arg1.C
| 309 |
utf_8
|
7a85bf47a7ccf37365dc9d0ed5813e3e
|
// { dg-do compile }
// PR 9978. We rejected a constant expression.
enum { val = 1 };
template <class T>
struct Bar
{
static const int A = val;
static const int B = A + 1;
};
|
google
|
chromium
|
operator7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/operator7.C
| 142 |
utf_8
|
98c4cd89cdbe74a78e512f93f452daa8
|
//PR c++/27493
// { dg-options "-std=gnu++98" }
template<operator T> void foo() // { dg-error "before|template" }
{
struct A {};
}
|
google
|
chromium
|
dtor2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/dtor2.C
| 96 |
utf_8
|
71d10b5b4cd6cb6cb8f6be930603b8e8
|
struct Foo
{
template <int i>
~Foo() {} // { dg-error "" }
};
int main()
{
Foo f;
}
|
google
|
chromium
|
typename17
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typename17.C
| 182 |
utf_8
|
81aeb9e1a8d50ce9fb2161d860dc83fa
|
// { dg-do compile }
// This should fail as A::foo<0> is not a typename at all.
struct A
{
template<int> void foo(int i)
{
typename A::foo<0>(i1); // { dg-error "" }
}
};
|
google
|
chromium
|
koenig5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/koenig5.C
| 524 |
utf_8
|
02dae2280971fe5ff910e6472b7a407a
|
// { dg-do compile }
// Contributed by David Abrahams <dave at boost-consulting dot com>
// PR c++/14143: Koenig lookup should only look into template arguments only
// if the argument is a template-id.
namespace fu
{
template <class T>
struct bar
{
struct baz {};
};
}
namespace axe
{
struct handle {};
template <class T>
char* f(T&);
}
namespace test
{
template <class T>
int f(T const&);
template <class T>
int g(T x) { return f(x); }
int x = g(fu::bar<axe::handle>::baz());
}
|
google
|
chromium
|
qualified-id1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualified-id1.C
| 615 |
utf_8
|
b4f42285bb7e66d3c4ef4a890e194c54
|
// { dg-do compile }
// PR 11922
struct A
{
template <bool> struct B;
struct C;
};
template <> struct A::B<false> {};
template <typename T> void foo()
{
T::C (); // { dg-error "parsed as a non-type|if a type is meant" }
T::template B<false>(); // { dg-error "parsed as a non-type" "non-type" }
// { dg-message "if a type" "if a type" { target *-*-* } 20 }
}
void bar()
{
foo<A>(); // { dg-message "instantiated" }
}
|
google
|
chromium
|
sfinae1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sfinae1.C
| 484 |
utf_8
|
d4a6fe33f1456d026d068d25f316aa9c
|
// PR c++/14337
template <bool> struct Constraint;
template <> struct Constraint<true> { typedef int Result; };
template <typename T>
struct IsInt { static const bool value = false; };
template <>
struct IsInt<int> { static const bool value = true; };
template <typename T>
typename Constraint<IsInt<T>::value>::Result foo(T);
template <typename T>
typename Constraint<!IsInt<T>::value>::Result foo(T);
template <typename>
void bar() {
foo(1);
}
|
google
|
chromium
|
sizeof2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sizeof2.C
| 281 |
utf_8
|
6ebf0c32bb2f9f68d5de8a2eb380e74b
|
// { dg-do compile }
template<int size>
struct Foobar {
// Contents irrelevant
};
template <typename A>
struct Wrapper {
// Contents irrelevant
};
template <typename A>
Foobar<sizeof(Wrapper<A>)> *
compiler_bug (A)
{
return 0;
}
int main()
{
compiler_bug(1);
}
|
google
|
chromium
|
defarg2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/defarg2.C
| 127 |
utf_8
|
21ce3e77355010aaab1b59936da8bfbb
|
struct X {
X ();
};
template <int> struct O {
struct I {
I (const X & = X());
};
};
template struct O<2>;
|
google
|
chromium
|
nontype6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nontype6.C
| 456 |
utf_8
|
2e2a05523958d5aa3d0c12c592bceb37
|
// { dg-do compile }
// Origin: <v dot haisman at sh dot cvut dot cz>
// PR c++/13957: Improved error message for type in template (when non-type
// is expected).
template <class T>
struct A
{
typedef int type;
};
template <class T>
void func(void)
{
(void)A<T>::type(); // { dg-error "non-type" "non-type" }
// { dg-message "if a type" "note" { target *-*-* } 15 }
}
template void func<float>(void); // { dg-message "instantiated from here" }
|
google
|
chromium
|
canon-type-3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/canon-type-3.C
| 362 |
utf_8
|
b62e207ee0e30db17c7ebfec8f4afd39
|
// Origin PR c++/39754
// { dg-do "compile" }
template<typename> struct A ;
template<typename T , typename = A<T> > struct B { } ;
template<class W , class > struct D
{
typedef W X ;
typedef X (FP) ();
A<FP&> a ;
} ;
template < class Y > struct E
{
typedef Y (FP) ();
B<FP&> b ;
} ;
E < int > e ;
|
google
|
chromium
|
new8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/new8.C
| 263 |
utf_8
|
b24f740838d028187b26372fe5358fca
|
// PR c++/34336
// { dg-do compile }
struct A;
template <class T>
struct S
{
T *m;
T &operator* () { return *m; }
};
struct B
{
B (const A &);
};
template <class T>
struct C
{
C ();
S<A> c;
};
template <class T>
C<T>::C ()
{
B *b = new B (*c);
}
|
google
|
chromium
|
crash21
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash21.C
| 915 |
utf_8
|
e11ee09376a4af9fd0b4e8a0131f1ad5
|
// { dg-do compile }
// PR c++/16706: Dependent type calculation during access checking
template <typename> struct B {
B() throw() {}
struct S { };
static int i;
typedef unsigned short int dummy;
};
template <typename _Tp>
struct allocator: B<_Tp> {
template<typename _Tp1> struct rebind
{ typedef allocator<_Tp1> other; };
};
template<typename T, typename>
struct X {
typename allocator<T>::template rebind<int>::other i;
typedef int* dummy;
};
template <class T> class A {
typedef typename X<T,allocator<T> >::dummy dummy;
template <class TP> class XWrapper;
};
template <class T>
template <class TP> struct A<T>::XWrapper<TP *>
{
XWrapper() {}
X<int,allocator<int> > x;
};
template class A<int>::XWrapper<int *>;
|
google
|
chromium
|
unify11
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/unify11.C
| 451 |
utf_8
|
d9da96e713c167a395e4c07da7c74a15
|
// Origin: PR c++/40684
// { dg-options "-std=c++0x" }
struct A
{
};
template <typename S, typename T, typename U, typename S::v = &S::v::s>
typename S::A
foo (S c, T t, U u)
{
}
struct B
{
struct C
{
template <typename U>
C (U t)
{
A a;
A b = foo (this, a, t); // { dg-error "no matching function" }
}
} c;
B () : c (A ())
{
}
};
int
main ()
{
B f;
}
|
google
|
chromium
|
friend4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend4.C
| 548 |
utf_8
|
56e71f86759e703664c2ed50998932fd
|
// { dg-do compile }
// PR 109, dependent member friends
struct B
{
static int foo ();
struct N
{
static int bar ();
};
};
template <class T>
class A
{
friend int T::foo ();
friend int T::N::bar ();
private:
static int m;
};
template <class T>
class C
{
friend struct T::N;
private:
static int m;
};
int B::foo ()
{
return A<B>::m;
}
int B::N::bar ()
{
return A<B>::m + C<B>::m;
}
|
google
|
chromium
|
non-dependent12
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/non-dependent12.C
| 259 |
utf_8
|
c68de3013fc66d5b9ca387b1f0f294ad
|
template<typename T> void foo(T &t)
{
int i = static_cast<int>(t);
}
|
google
|
chromium
|
spec18
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec18.C
| 150 |
utf_8
|
f9db6cb49e2fa6c6968fe9e4a6f2a111
|
// PR c++/17936
template<int, int N> struct A
{
void foo();
};
template<int N> struct A<1, N>
{
void foo();
};
template<> void A<1, 2>::foo();
|
google
|
chromium
|
typedef10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typedef10.C
| 200 |
utf_8
|
da5e10dcd0d113f42f94806f2313be36
|
// PR c++/34573
template < class Gtr_>
void compute_gr()
{
typedef int Less_chain;
struct utils {
utils(const Less_chain& lc) {};
};
utils U(1);
}
int main(void){
compute_gr<int>();
}
|
google
|
chromium
|
void11
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/void11.C
| 189 |
utf_8
|
334f2b6dd7bbf1694010e0f30e5058f9
|
// PR c++/31446
template<void> struct A // { dg-error "valid type" }
{
template<int> friend void foo();
};
void bar()
{
foo<0>(); // { dg-error "not declared|primary-expression" }
}
|
google
|
chromium
|
qualttp6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp6.C
| 339 |
utf_8
|
08683258d49e31d3eb73ace3d1433c01
|
// { dg-do compile }
template <template <class> class TT> class C {
};
template <class T> struct D {
C<T::template B> c; // { dg-error "no class template" }
};
struct E {
};
D<E> d; // { dg-message "instantiated" }
|
google
|
chromium
|
member2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/member2.C
| 254 |
utf_8
|
cabe816ff29ed547a0c78ab109ad97d0
|
// PR c++/8660
// Bug: we were treating the definition of the non-template as a definition
// of the template, which broke.
struct BadgerBuf
{
void ReadPod();
template<class B>
void ReadPod();
};
void BadgerBuf::ReadPod ()
{ ReadPod<int> (); }
|
google
|
chromium
|
friend29
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend29.C
| 184 |
utf_8
|
a0d74e429e0416fe8fd207b1ee020c7a
|
// PR c++/15701
template<template<int> class T> struct A : T<0>
{
void foo();
template<template<int> class U> friend void A<U>::foo();
};
template<int> struct B {};
A<B> a;
|
google
|
chromium
|
instantiate7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/instantiate7.C
| 258 |
utf_8
|
cb17733e32e1d70e72ba5449d93b192f
|
// PR c++/19498
// { dg-do compile }
template<typename T> struct A
{
template<T&> struct B; // { dg-error "reference to void" }
};
A<void> a; // { dg-message "instantiated" }
|
google
|
chromium
|
init1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/init1.C
| 233 |
utf_8
|
f30fe425de51d4cb2ab5ff05b71d616a
|
// { dg-do compile }
// PR c++/9457: ICE tsubst'ing initializers in templates.
template <typename> void foo (int count) {
int i = {count};
}
template void foo<int> (int);
|
google
|
chromium
|
spec12
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec12.C
| 472 |
utf_8
|
5887f7286f7e8d72346052184c20f45e
|
// { dg-do compile }
// Contributed by: Wolfgang Bangerth <bangerth at dealii dot org>
// PR c++/14409: Accepts invalid function signature for explicit instantiation
struct X
{
template <typename U>
void foo (U) {}
template <typename U>
void foo_const (U) const {}
};
template void X::foo (int);
template void X::foo_const (int) const;
template void X::foo (int) const; // { dg-error "" }
template void X::foo_const (int); // { dg-error "" }
|
google
|
chromium
|
crash85
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash85.C
| 274 |
utf_8
|
fac18fbcfe10c67843c28437a6b92d3c
|
// Origin: PR c++/37142
// { dg-do compile }
template<typename T, const T a, template <typename U, U u> class W> struct A {};
template<typename T, const T t> struct B {};
int
main ()
{
A<long, 0, B> a;
return 0;
}
|
google
|
chromium
|
repo6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/repo6.C
| 368 |
utf_8
|
e6ff031ac5c6f3902abdc8613e547a95
|
// PR c++/34178
// { dg-options "-frepo" }
// { dg-final { cleanup-repo-files } }
// { dg-require-host-local "" }
template<typename T>
class A
{
private:
static const int x;
static int y;
public:
int getX () { return x + y; }
};
template<typename T> const int A<T>::x = 0;
template<typename T> int A<T>::y = 0;
int
main ()
{
A<int> a;
return a.getX();
}
|
google
|
chromium
|
redecl4
|
.C
|
native_client/nacl-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
|
memfriend6
|
.C
|
native_client/nacl-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); // { dg-error "candidate" }
};
class C {
int ii;
template <class U> friend void A<U>::f(U); // { dg-error "not match" }
template <class U> template <class V>
friend void A<U>::g(); // { dg-error "not match|cannot be overloaded" }
template <class U> friend int A<U>::h(); // { dg-error "not match|cannot be overloaded" }
template <class U> friend void A<U>::i(char); // { dg-error "not match" }
};
|
google
|
chromium
|
restrict1
|
.C
|
native_client/nacl-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/nacl-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/nacl-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/nacl-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/nacl-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:
foo(){ i = 0; }
template <class U>
foo(const foo<U>& f){ i = f.i; }
};
template <class T>
class foo;
template <class T>
bool must_be_friend_proc(const foo<T>& f);
template <class T>
bool must_be_friend_proc(const foo<T>& f)
{ return f.i != 0; }
template <class T>
class foobar
{
int i;
public:
template <class U>
foobar(const foo<U>& f)
{ i = f.i; }
};
int test()
{
foo<int> fi;
foo<double> fd(fi);
(void) &fd; // avoid "unused variable" warning
foobar<long> fb(fi);
(void) &fb; // avoid "unused variable" warning
return 0;
}
}
|
google
|
chromium
|
assign1
|
.C
|
native_client/nacl-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/nacl-gcc/gcc/testsuite/g++.dg/template/crash84.C
| 364 |
utf_8
|
c43dd07e18bb076a009c04c9ed9dd5ce
|
// 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 "instantiated from here" }
}
|
google
|
chromium
|
redecl1
|
.C
|
native_client/nacl-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/nacl-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/nacl-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 *t2) { return 4; }
int main()
{
if (qCompare("a", "b") != 4)
return 1;
}
|
google
|
chromium
|
typename2
|
.C
|
native_client/nacl-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>
class ctype2 : public __ctype_abstract_base<_CharT>
{
typedef mask mask; // { dg-error "does not name a type" "no type" }
// { dg-message "note" "note" { target *-*-* } 24 }
};
|
google
|
chromium
|
arg6
|
.C
|
native_client/nacl-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/nacl-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/nacl-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/nacl-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/nacl-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/nacl-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<typename T> struct is_incr : bool_var< is_inc_::impl<T>::value> {};
struct not_incr{};
typedef int sa1[ is_incr<not_incr>::value ? -1 : 1];
|
google
|
chromium
|
crash1
|
.C
|
native_client/nacl-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/nacl-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 main()
{
try
{
Test<int> test;
}
catch(...)
{
return 1;
}
return 0;
}
|
google
|
chromium
|
array1-2
|
.C
|
native_client/nacl-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/nacl-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 *>::a<char *> q;
b<void *>::a<char> w(q);
return 0;
}
|
google
|
chromium
|
using12
|
.C
|
native_client/nacl-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/nacl-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/nacl-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/nacl-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/nacl-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
|
stmtexpr1
|
.C
|
native_client/nacl-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/nacl-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/nacl-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/nacl-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_cast <int> (operator T2 ());
}
};
int main ()
{
int r;
C<int> c;
r = c.Foo ();
if (r)
return 1;
r = c.Baz<int> ();
if (r)
return 2;
r = c.Baz<float> ();
if (!r)
return 3;
return 0;
}
|
google
|
chromium
|
crash17
|
.C
|
native_client/nacl-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/nacl-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/nacl-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
|
crash50
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash50.C
| 139 |
utf_8
|
cba5348987312926d5bd6854ffc13bb6
|
// PR c++/27398
// { dg-do compile }
struct A
{
template<int> void* foo(; // { dg-error "primary-expression|initialization|static" }
};
|
google
|
chromium
|
using1
|
.C
|
native_client/nacl-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;
bar.j = 2;
if (bar.foo() != 1)
return 1;
if (bar.baz() != 2)
return 1;
return 0;
}
|
google
|
chromium
|
non-dependent9
|
.C
|
native_client/nacl-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/nacl-gcc/gcc/testsuite/g++.dg/template/memfriend16.C
| 614 |
utf_8
|
3c8d60eb2a84a4ac96ec9e16cadb0848
|
// { 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> template <class U> void A<T>::B2<U>::f()
{
C c;
c.i = 0; // { dg-error "context" }
}
int main()
{
A<int>::B2<int> b1;
b1.f(); // { dg-message "instantiated" }
}
|
google
|
chromium
|
ptrmem1
|
.C
|
native_client/nacl-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) const { return (c.*M)(); }
};
struct A
{
int get();
};
static Closure<A, int (), & A::get> get_closure;
void Foo ()
{
A a;
get_closure (a);
}
|
google
|
chromium
|
ptrmem6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ptrmem6.C
| 199 |
utf_8
|
c341261c190bf4a6a9280b8bf11ebfd2
|
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 "instantiated" }
|
google
|
chromium
|
unify10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/unify10.C
| 1,742 |
utf_8
|
510fd3ce84e62045e22325b3b40e2abb
|
// { 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 vMethod() volatile throw() {}
void cvMethod() const volatile throw() {}
};
template<class CLASS>
void mFunction(void (CLASS::* method)()) {}
template<class CLASS>
void cFunction(void (CLASS::* method)() const) {}
template<class CLASS>
void vFunction(void (CLASS::* method)() volatile) {}
template<class CLASS>
void cvFunction(void (CLASS::* method)() const volatile) {}
int main() {
mFunction(&MyClass::mMethod);
mFunction(&MyClass::cMethod); // { dg-error "no matching function" }
mFunction(&MyClass::vMethod); // { dg-error "no matching function" }
mFunction(&MyClass::cvMethod); // { dg-error "no matching function" }
cFunction(&MyClass::mMethod); // { dg-error "no matching function" }
cFunction(&MyClass::cMethod);
cFunction(&MyClass::vMethod); // { dg-error "no matching function" }
cFunction(&MyClass::cvMethod); // { dg-error "no matching function" }
vFunction(&MyClass::mMethod); // { dg-error "no matching function" }
vFunction(&MyClass::cMethod); // { dg-error "no matching function" }
vFunction(&MyClass::vMethod);
vFunction(&MyClass::cvMethod); // { dg-error "no matching function" }
cvFunction(&MyClass::mMethod); // { dg-error "no matching function" }
cvFunction(&MyClass::cMethod); // { dg-error "no matching function" }
cvFunction(&MyClass::vMethod); // { dg-error "no matching function" }
cvFunction(&MyClass::cvMethod);
return 0;
}
|
google
|
chromium
|
sfinae3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sfinae3.C
| 307 |
utf_8
|
df70bad533a0f47bbceddb5ae41c6a53
|
// PR c++/24671
// { dg-options "" }
template<typename> struct A
{
typedef int X;
static const int i = 0;
};
template<typename> struct B
{
B(const B&); // { dg-message "candidate" }
typedef typename A<char[A<B>::i]>::X Y;
template<typename T> B(T, Y); // { dg-error "call" }
};
B<int> b(0,0);
|
google
|
chromium
|
dtor4
|
.C
|
native_client/nacl-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/nacl-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/nacl-gcc/gcc/testsuite/g++.dg/template/ttp22.C
| 239 |
utf_8
|
b29aec661b5b00820f2fcebc0dad251e
|
// 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
|
error8
|
.C
|
native_client/nacl-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
|
sfinae4
|
.C
|
native_client/nacl-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_if<false, T> { };
template<typename T>
typename enable_if<(sizeof(foo(create_a<T const&>()), 1) > 0),
yes_type>::type
check_has_foo(const volatile T&);
no_type check_has_foo(...);
template<typename T>
struct has_foo
{
static const bool value =
(sizeof(check_has_foo(create_a<T const&>())) == sizeof(yes_type));
};
struct X { };
int a1[has_foo<int>::value? 1 : -1];
int a2[has_foo<long>::value? 1 : -1];
int a3[has_foo<int*>::value? 1 : -1];
int a4[has_foo<X>::value? -1 : 1];
int a5[has_foo<int X::*>::value? -1 : 1];
|
google
|
chromium
|
unify6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/unify6.C
| 476 |
utf_8
|
63e91a546ca33b6fb3126c637052a11d
|
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);
void Bar ()
{
Foo1 (&Baz); // #1
Foo2 (&Baz);
Foo3 (&Baz);
Foo3 (&Baz, &Baz); // { dg-error "no matching function" "" }
}
|
google
|
chromium
|
call7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/call7.C
| 285 |
utf_8
|
653870efc0beb2f7f74e9279886c39eb
|
// 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/nacl-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 T> struct enable_if<false, T> { };
#define JOIN( X, Y ) DO_JOIN( X, Y )
#define DO_JOIN( X, Y ) DO_JOIN2(X,Y)
#define DO_JOIN2( X, Y ) X##Y
template<typename T>
typename enable_if<(sizeof(new T, 0) > 0), yes_type>::type
check_new(int);
template<typename T> no_type check_new(...);
template<typename T>
struct has_new
{
static const bool value =
(sizeof(check_new<T>(0)) == sizeof(yes_type));
};
template<typename T, typename U>
typename enable_if<(sizeof((new T(create_a<U>())), 0) > 0),
yes_type>::type
check_new_one_arg(int);
template<typename T, typename U> no_type check_new_one_arg(...);
template<typename T, typename U>
struct has_new_one_arg
{
static const bool value =
(sizeof(check_new_one_arg<T, U>(0)) == sizeof(yes_type));
};
template<typename T, typename U, U N>
typename enable_if<(sizeof(new T[N], 0) > 0), yes_type>::type
check_array_new(int);
template<typename T, typename U, U N> no_type check_array_new(...);
template<typename T, typename U, U N>
struct has_array_new
{
static const bool value =
(sizeof(check_array_new<T, U, N>(0)) == sizeof(yes_type));
};
#ifdef __GXX_EXPERIMENTAL_CXX0X__
# define STATIC_ASSERT(Expr) static_assert(Expr, #Expr)
#else
# define STATIC_ASSERT(Expr) int JOIN(a,__LINE__)[Expr? 1 : -1]
#endif
struct X {
X(int);
};
struct Y { int foo; };
STATIC_ASSERT((has_new<Y>::value));
STATIC_ASSERT(!(has_new<X>::value));
STATIC_ASSERT((has_new_one_arg<Y, Y>::value));
STATIC_ASSERT((has_new_one_arg<X, float>::value));
STATIC_ASSERT(!(has_new_one_arg<X, int X::*>::value));
STATIC_ASSERT((has_array_new<Y, int, 5>::value));
STATIC_ASSERT(!(has_array_new<X, int Y::*, &Y::foo>::value));
STATIC_ASSERT((has_array_new<X, int, 5>::value));
|
google
|
chromium
|
error37
|
.C
|
native_client/nacl-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/nacl-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/nacl-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/nacl-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 std::ostream& operator<<(std::ostream& ostr, const Handle& r)
{
right++;
return ostr << "in operator<<(ostream&, const Handle&)";
}
};
typedef Handle<Buggy> Buggy_h;
bool cmp (const Buggy_h& b1, const Buggy_h& b2)
{
std::cout << b1 << " " << b2 << std::endl;
return false;
}
int main()
{
Buggy o;
cmp (&o, &o);
return !(right == 2 && !wrong);
}
|
google
|
chromium
|
error26
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error26.C
| 146 |
utf_8
|
d6f93055afe5bb78dbd6073dd989bdef
|
// 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/nacl-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/nacl-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/nacl-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_rAllocator);
};
class MotionSearcherY : public MotionSearcher<1, int> {};
|
google
|
chromium
|
local2
|
.C
|
native_client/nacl-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.f(0,0)*x.f(2,1);
double t20 = x.f(1,2)*x.f(3,3);
double t22 = x.f(1,3)*x.f(3,2);
double t24 = x.f(0,0)*x.f(3,1);
double t25 = x.f(1,2)*x.f(2,3);
double t27 = x.f(1,3)*x.f(2,2);
double t29 = x.f(1,0)*x.f(0,1);
double t32 = x.f(1,0)*x.f(2,1);
double t33 = x.f(0,2)*x.f(3,3);
double t35 = x.f(0,3)*x.f(3,2);
double t37 = x.f(1,0)*x.f(3,1);
double t38 = x.f(0,2)*x.f(2,3);
double t40 = x.f(0,3)*x.f(2,2);
double t42 = t14*t15-t14*t17-t19*t20+t19*t22+
t24*t25-t24*t27-t29*t15+t29*t17+
t32*t33-t32*t35-t37*t38+t37*t40;
double t43 = x.f(2,0)*x.f(0,1);
double t46 = x.f(2,0)*x.f(1,1);
double t49 = x.f(2,0)*x.f(3,1);
double t50 = x.f(0,2)*x.f(1,3);
double t52 = x.f(0,3)*x.f(1,2);
double t54 = x.f(3,0)*x.f(0,1);
double t57 = x.f(3,0)*x.f(1,1);
double t60 = x.f(3,0)*x.f(2,1);
double t63 = t43*t20-t43*t22-t46*t33+t46*t35+
t49*t50-t49*t52-t54*t25+t54*t27+
t57*t38-t57*t40-t60*t50+t60*t52;
double t65 = 1/(t42+t63);
double t71 = x.f(0,2)*x.f(2,1);
double t73 = x.f(0,3)*x.f(2,1);
double t75 = x.f(0,2)*x.f(3,1);
double t77 = x.f(0,3)*x.f(3,1);
double t81 = x.f(0,1)*x.f(1,2);
double t83 = x.f(0,1)*x.f(1,3);
double t85 = x.f(0,2)*x.f(1,1);
double t87 = x.f(0,3)*x.f(1,1);
double t101 = x.f(1,0)*x.f(2,2);
double t103 = x.f(1,0)*x.f(2,3);
double t105 = x.f(2,0)*x.f(1,2);
double t107 = x.f(2,0)*x.f(1,3);
double t109 = x.f(3,0)*x.f(1,2);
double t111 = x.f(3,0)*x.f(1,3);
double t115 = x.f(0,0)*x.f(2,2);
double t117 = x.f(0,0)*x.f(2,3);
double t119 = x.f(2,0)*x.f(0,2);
double t121 = x.f(2,0)*x.f(0,3);
}
template void X<double>::g (X<double>&);
|
google
|
chromium
|
instantiate6
|
.C
|
native_client/nacl-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/nacl-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/nacl-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/nacl-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/nacl-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/nacl-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/nacl-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>;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.