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
|
sizeof3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sizeof3.C
| 205 |
utf_8
|
f459df99e9efaf925b83daefe81c3127
|
// The call to f is not potentially evaluated (3.2), so f<int> is not used,
// so it should not be instantiated.
template <class T>
T f (T)
{
typename T::X x;
}
int main()
{
int i = sizeof (f(0));
}
|
google
|
chromium
|
friend24
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend24.C
| 408 |
utf_8
|
c81920c34b3ea8295fc494118d9e89af
|
// { dg-do compile }
// PR c++/495: Fail to locate primary class template that is
// injected by friend declaration.
template <int N> struct X
{
template <int dim> friend struct Y;
};
X<2> x;
template <int dim> struct Y
{
void f (Y);
void g (Y);
};
template <int dim> void Y<dim>::f (Y)
{
}
template <int dim> void Y<dim>::g (Y<dim>)
{
}
|
google
|
chromium
|
ctor8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ctor8.C
| 177 |
utf_8
|
4ed33c1007f1b16ad7f6fa2811b165ba
|
// PR c++/28711
// { dg-do compile }
// { dg-options "" }
template<int> struct A
{
int x[1][1];
A() : x((int[1][]){{0}}) {} // { dg-error "except the first" }
};
A<0> a;
|
google
|
chromium
|
crash18
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash18.C
| 329 |
utf_8
|
3a58be91fa3ebac110f04aa317762b98
|
// { dg-do compile }
// Contributed by: <leif dot lonnblad at thep dot lu dot se>
// PR c++/15064: typeid does not form an integral constant expression
#include <typeinfo>
template <typename T>
void dummy() {
const std::type_info& t = typeid(T);
const std::type_info& t2 = typeid(float);
}
template void dummy<int>(void);
|
google
|
chromium
|
memtmpl1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memtmpl1.C
| 360 |
utf_8
|
a028161f345a592e44b9dd2c85780ba8
|
// { dg-do compile }
// PR 11347. ICE in tsubst
template <class T> struct T1 {
enum {N};
};
template<class T> struct T2 {
template <class S, bool Z = T1<S>::N + 1> struct B {};
struct C {};
};
T2<int> t;
T2<int>::B<int> s;
|
google
|
chromium
|
crash67
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash67.C
| 91 |
utf_8
|
4d18a79ebe27fdc9fc1cfb181d77510d
|
// PR c++/32561
template<int N, int N> struct A; // { dg-error "redefinition|declared" }
|
google
|
chromium
|
repo3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/repo3.C
| 260 |
utf_8
|
62140095f73953013945a8ee134b2ce5
|
// { dg-options "-frepo -DF='a'" }
// { dg-require-host-local "" }
template <typename A, typename B> void f () {}
template <typename A, typename B> void g () { f<int,int>(); }
int main () { g<int,int>(); }
char c = F;
// { dg-final { cleanup-repo-files } }
|
google
|
chromium
|
static1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static1.C
| 112 |
utf_8
|
0511bd747b9cf7ef36970e1f15d3bb0b
|
template <typename T> struct A
{
static const int t[1][1]={{0}}; // { dg-error "brace-enclosed|in-class" }
};
|
google
|
chromium
|
error29
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error29.C
| 175 |
utf_8
|
f942827c4c8f49e463f6196ed54942bb
|
// PR c++/33209
template<typename T> void foo(int, T::x); // { dg-error "T::x" }
template<template<typename> class T> void foo2(int, T<int>::x); // { dg-error "T<int>::x" }
|
google
|
chromium
|
friend27
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend27.C
| 308 |
utf_8
|
5d0b7c7f0422e1347c115a5773dea497
|
// PR c++/15265
enum Relation {equalOp};
template<typename B>
class A {
public:
static
bool Relop(const A&, const A&, Relation);
friend
bool operator==(const A& a1, const A& a2) {
return Relop(a1, a2, equalOp);
}
B* b;
};
int main() {
A<int> a; a == a;
return 0;
}
|
google
|
chromium
|
expr1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/expr1.C
| 184 |
utf_8
|
d9a08dd82988a25d2840d767d582837f
|
// PR c++/18161
// { dg-options "" }
template <class T> struct Y;
template <> struct Y<bool> {};
template <typename T = typeof (1 == 1)> struct X { Y<T> a; };
template struct X <>;
|
google
|
chromium
|
sizeof1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sizeof1.C
| 261 |
utf_8
|
8af3d67f6d9f4dd6cda097137e1aaa5e
|
// Test use of `sizeof' as a template parameter.
// { dg-do compile }
template <unsigned I> struct A { static char *value; };
template <typename SizeType>
struct B
{
char * f() const
{
return (A<sizeof(void *)>::value);
}
};
|
google
|
chromium
|
repo2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/repo2.C
| 374 |
utf_8
|
5a3839c8b995df789d1577d1dd8db95d
|
// PR c++/17163
// { dg-options "-frepo" }
// { dg-require-host-local "" }
template <int __inst>
struct __Atomicity_lock
{
static unsigned char _S_atomicity_lock;
};
template <int __inst>
unsigned char __Atomicity_lock<__inst>::_S_atomicity_lock = 0;
template unsigned char __Atomicity_lock<0>::_S_atomicity_lock;
int main () {
}
// { dg-final { cleanup-repo-files } }
|
google
|
chromium
|
error12
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error12.C
| 81 |
utf_8
|
6fe651ff5a3f3b8ff9d8a9597b35e055
|
// PR c++/15044
template class <num_t> class a { num_t n; } // { dg-error "" }
|
google
|
chromium
|
pseudodtor1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/pseudodtor1.C
| 431 |
utf_8
|
b1805d4b386b8dcd432f41c68e255100
|
// PR c++/32384
// { dg-do compile }
struct A
{
typedef int T;
T foo ();
A () { foo ().~T (); }
};
template<typename> struct B
{
typedef int T;
T foo ();
B () { foo ().~T (); }
};
template<typename T> struct C
{
T t;
C () { t.~T (); }
};
template<typename S> struct D
{
typedef int T;
S foo ();
D () { foo ().~T(); }
};
struct Z
{
Z () {}
~Z () {}
};
A a;
B<int> b;
C<int> c1;
C<Z> c2;
D<int> d;
|
google
|
chromium
|
unify5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/unify5.C
| 303 |
utf_8
|
a356fc4e8d85f399c730f255f0823551
|
// PR:c++/14007
template <typename T> struct X {}; // #1
template <typename T> struct X<const T>; //#2
template struct X<int&>; //#3
|
google
|
chromium
|
strlen1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/strlen1.C
| 119 |
utf_8
|
3a8d2192bd70af17c62b2fedd505e1e1
|
template <typename A1>
void monk2 (A1) {}
unsigned int strlen (const char*);
void monk ()
{
monk2 (strlen (""));
}
|
google
|
chromium
|
local6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/local6.C
| 509 |
utf_8
|
184645988b5ea62486430be140bea022
|
template <class T> struct PCVector2
{ // { dg-message "candidates" }
template <class T2> PCVector2(const PCVector2<T> &cv) ;
PCVector2<T> operator- (const PCVector2<T> &ov) const
{
return PCVector2<T>(ov.xFIELD, ov.yFIELD); // { dg-error "matching" }
}
T xFIELD, yFIELD;
};
void findIntersection( PCVector2<double>& p0, PCVector2<double>& p1);
void findIntersection( PCVector2<double>& p0, PCVector2<double>& p1)
{
PCVector2<double> e = p1 - p0; // { dg-message "instantiated" }
}
|
google
|
chromium
|
memclass2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memclass2.C
| 360 |
utf_8
|
cdd15f6514749074086ff789caa565f2
|
namespace ns {
template<typename T>
struct Foo {
template<typename U> struct Bar;
};
template<typename T>
template<typename U>
struct Foo<T>::Bar {
template<typename V> struct Baz;
};
template<typename T>
template<typename U>
template<typename V>
struct Foo<T>::Bar<U>::Baz {
Foo<T> chokes;
ns::Foo<T> works;
};
}
|
google
|
chromium
|
spec21
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec21.C
| 554 |
utf_8
|
b03d3fac8b47ebc0e95fe00fc6b76bb1
|
// { dg-do run }
// DR214
template <class T> T f(int) {return 0;}
template <class T, class U> T f(U){return 1;}
template <typename T, typename R> T checked_cast (R const &) {return 0;}
template <typename T, typename R> T checked_cast (R *) {return 1;}
int main ()
{
int i = 0;
if (f<int>(1))
return 1;
if (checked_cast<int>(i) != 0)
return 2;
if (checked_cast<int>(&i) != 1)
return 3;
return 0;
}
|
google
|
chromium
|
partial4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/partial4.C
| 306 |
utf_8
|
dbd288590e967c40dee79909821124df
|
// PR c++/25342
template < typename eval >
struct tpl_seq_search {
typedef typename eval::enum_type Enum;
template < Enum first, Enum last >
struct range {
};
template < Enum val >
struct range<val,val> {
};
};
struct xxx {
typedef int enum_type;
tpl_seq_search<xxx>::range<0, 1> a;
};
|
google
|
chromium
|
typedef21
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typedef21.C
| 157 |
utf_8
|
7e520cd2a2f5f287069b2ee21c8ea862
|
// PR c++/37037
typedef void F(void);
template <typename T> struct S
{
static F f;
};
template class S<int>;
template <class T> void S<T>::f(void)
{}
|
google
|
chromium
|
ptrmem12
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ptrmem12.C
| 442 |
utf_8
|
adf178bf638c6b871c4bd9abf0c44c53
|
template <class _Ret, class _Tp>
void mem_fun_ref(_Ret (_Tp::*__f)());
struct A {
double f();
};
void h ()
{
mem_fun_ref(&A::f);
}
template <class T>
void f()
{
mem_fun_ref(&A::f);
}
void g()
{
f<int>();
}
|
google
|
chromium
|
call4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/call4.C
| 331 |
utf_8
|
865f009ddc0a20c3f776c322940208a1
|
// PR c++/25364
class OFX_PropertySuiteV1
{
static int propGetDouble ();
};
template<int dimension,
class T,
int (*PROPGET)()
>
struct OFX_AnimatedNumberParam
{
virtual int paramSetValueAtTime()
{
return PROPGET();
}
};
void f()
{
new OFX_AnimatedNumberParam<2,double,OFX_PropertySuiteV1::propGetDouble>();
}
|
google
|
chromium
|
typename16
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typename16.C
| 429 |
utf_8
|
72f97d6e8b102635f9bd980db11112f9
|
// PR37314 rejects-valid, from w.doeringer
template <typename T>
struct A {
typedef __PTRDIFF_TYPE__ difference_type;
struct B {
typedef typename A<T>::difference_type difference_type;
difference_type operator-(B const&) const;
T t;
};
};
//
template <typename T>
typename A<T>::B::difference_type A<T>::B::operator-(B const&) const {
return -1;
}
//
int main() {
A<int>::B i;
++i.t;
return 0;
}
|
google
|
chromium
|
friend23
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend23.C
| 565 |
utf_8
|
7ad7118de3eccd5d74c51db173d4e326
|
// { dg-do compile }
// PR c++/11876: Friend of its own class diagnostics
template <typename T>
class A
{
friend class A<int>;
friend class A<float>;
protected:
T _data;
inline A() : _data(0) {}
template <typename U>
inline A(const A<U>& r) : _data(r._data) {}
};
class B : public A<int>
{
public:
inline B() {}
inline B(const B& r) : A<int>(r) {}
};
class C : public A<float>
{
public:
inline C() {}
inline C(const B& r) : A<float>(r) {}
};
int main(int, char*[])
{
B b1, b2(b1);
C c(b1);
return 0;
}
|
google
|
chromium
|
const2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/const2.C
| 319 |
utf_8
|
98b1720316bc749eaed8150f3ddb776c
|
// PR c++/39608
// We were improperly considering dependent members of the current
// instantiation to be non-constant (and therefore invalid template
// non-type arguments).
template <int I>
struct C {};
template <class T>
struct A
{
static const T x = 1;
C<A<T>::x> c; // { dg-bogus "invalid" }
};
A<int> a;
|
google
|
chromium
|
using10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/using10.C
| 167 |
utf_8
|
943abc979a64f6701f0ff51d172a78bb
|
// PR c++/22136
struct B {
void foo();
};
template <typename T> class I : public B {};
template <typename T> class D : private I<T> {
I<T>::B::foo;
};
|
google
|
chromium
|
crash47
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash47.C
| 95 |
utf_8
|
ecaf2d9019ae9b82fd94645b37dbc4c9
|
// PR c++/27102
template<typename T> void T::X::foo() {} // { dg-error "invalid|not a type" }
|
google
|
chromium
|
instantiate4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/instantiate4.C
| 243 |
utf_8
|
7d69f16e359b40571c6da6dde60dde8d
|
// { dg-do compile }
// PR c++/10682: Typedef to enum template instantiation logic.
template <typename T>
struct Foo {
enum E {a,b,c};
typedef E EE;
};
void Baz(Foo<int>::EE x);
|
google
|
chromium
|
crash7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash7.C
| 484 |
utf_8
|
3902d5ed7ee7e17148eac86f171af999
|
// { dg-do compile }
// PR c++/10108: ICE in tsubst_decl for error due to non-existence
// nested type.
template <typename> struct A
{ // { not-dg-error "candidates" }
template <typename> A(typename A::X) {} // { dg-error "no type" }
};
A<void> a; // { not-dg-error "instantiated|no match" }
// We currently don't give the "no match" error because we don't add the
// invalid constructor template to TYPE_METHODS.
|
google
|
chromium
|
non-dependent4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/non-dependent4.C
| 107 |
utf_8
|
c74bd06e4f01d82b6dffe8568a9f9286
|
int temp(const char *temp);
template <int> int g() { return temp("Hi"); }
int g1() { return temp("Hi"); }
|
google
|
chromium
|
inherit3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/inherit3.C
| 186 |
utf_8
|
1c9360dccd50f544e413d4c00432d88e
|
template <typename T>
struct set {
void insert (const T&);
template <class X>
void insert (X, X);
};
struct C : public set<int> {
void f (const int i) {
insert (i);
}
};
|
google
|
chromium
|
error13
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error13.C
| 113 |
utf_8
|
23d1d88880eac44a4f6c4209f4d1c9c0
|
// PR c++/15227
template<typename> struct A {};
template<typename T> void A<T>::B::foo() {} // { dg-error "" }
|
google
|
chromium
|
static16
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static16.C
| 533 |
utf_8
|
ad55298cbb7ecb4c0c032a17f174564f
|
// PR c++/23691
namespace std {
class type_info {
bool operator==(const type_info& __arg) const;
};
}
template <class T, T val> struct integral_constant {
static const T value = val;
};
template< typename T > struct is_integral : integral_constant<bool,false> {};
template <bool B> struct enable_if_c {};
template<typename Functor>
typename enable_if_c<(is_integral<Functor>::value)>::type
operator==(const int& f, Functor g);
template<class D>
int get_deleter( std::type_info const & ti )
{
return ti == typeid(D);
}
|
google
|
chromium
|
enum6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/enum6.C
| 136 |
utf_8
|
294cb584d05edd3313c80b73e8cd5f4d
|
// PR c++/34774
template<int shifts>
struct shift {
enum {
n0 = (unsigned)shifts,
n = n0 ? 0 : n0,
n_comp = -n
} x;
};
|
google
|
chromium
|
typeid-template-argument
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typeid-template-argument.C
| 202 |
utf_8
|
c8309bdff0cfda521b4e7ea53eaf9126
|
// This used to ICE (PR28420)
// { dg-do compile }
template<int> struct A;
int i = sizeof(A<typeid>); // { dg-error "operator cannot appear in a constant-expression|template argument 1 is invalid" }
|
google
|
chromium
|
string1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/string1.C
| 70 |
utf_8
|
e7593ecf5b119a379bc82dc107ccab12
|
// PR c++/28337
template <int> void foo()
{
(0 ? "" : "X") + 1;
}
|
google
|
chromium
|
ntp2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ntp2.C
| 358 |
utf_8
|
506fde7f525665b80bb8ae93c21fa34f
|
// { dg-do compile }
// PR 3784: We were confusing non-type template parms.
template <unsigned N> class X { };
template <short N> void foo1(X<N>);
template <unsigned N> void foo2(X<N>);
int main() {
X<2> x;
foo2(x);
}
|
google
|
chromium
|
qualttp16
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp16.C
| 599 |
utf_8
|
d5117f3f1bc5abfa2a210383b5c90542
|
// { dg-do run }
extern "C" void abort();
struct A
{
template <class T> class B {};
};
template <template <class> class TT, class T> struct X
{
TT<int> y;
T z;
int f() { return 0; }
};
template <class T> struct X<T::template B, T>
{
typename T::template B<int> y;
T z;
int f() { return 1; }
};
template <class T> struct C
{
X<T::template B, A> x;
};
int main()
{
C<A> c;
X<A::B, A> x1;
X<A::B, int> x2;
if (x1.f() != 1)
abort();
if (x2.f() != 0)
abort();
}
|
google
|
chromium
|
spec2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec2.C
| 371 |
utf_8
|
1133f61b139dcbae6d0d62799d821c00
|
// { dg-do compile }
// Bug: Overloading of ordinary and template member function
// which enclosing class is specialized is not handled correctly.
template <class T>
struct A
{
void f(T) {}
};
template<>
struct A<int>
{
void f(int) {}
template <class T> void f(T) {}
};
template
void A<int>::f(int);
|
google
|
chromium
|
conv9
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/conv9.C
| 163 |
utf_8
|
8de20cec2491fd7ca8d7d9e44e45478a
|
// PR c++/28557
struct A
{
template<typename T> operator T() { return T(); }
};
template<int> void foo()
{
A().operator int();
}
void bar()
{
foo<0>();
}
|
google
|
chromium
|
access7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access7.C
| 310 |
utf_8
|
313a589d3cd51e8f767696645063ec3f
|
// { dg-do compile }
// PR c++/3663
// Enforce access of nested type.
template <typename A>
class S {
class T {}; // { dg-error "private" }
};
template <typename A>
typename A::T* f (A) { // { dg-error "this context" }
return 0;
}
void g () {
f (S<int> ()); // { dg-message "instantiated" }
}
|
google
|
chromium
|
ttp7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp7.C
| 602 |
utf_8
|
8ef73a0d2fb7b35129f101b657888692
|
// { dg-do compile }
// Contributed by Andrew Pinski <pinskia at gcc dot gnu dot org>
// PR c++/13810: ICE while parsing invalid default argument for a
// template template parameter.
struct X;
template<int> struct A {};
template<template<int> class = X > struct B1 {}; // { dg-error "as a default value" }
template<template<int> class = A<0> > struct B2 {}; // { dg-error "as a default value" }
template <typename T>
struct S {
template <template <typename> class = S> struct I1 {}; // { dg-error "as a default value" }
template <template <typename> class = ::S> struct I2 {};
};
|
google
|
chromium
|
redecl3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/redecl3.C
| 221 |
utf_8
|
49436cd5609a16d69d797b84c7f00598
|
// PR c++/19980
// { dg-do compile }
int foo; // { dg-error "previous declaration" }
template<int> void foo() {} // { dg-error "redeclared" }
|
google
|
chromium
|
static18
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static18.C
| 255 |
utf_8
|
edf490d7a540447062e06ed56692070f
|
// PR c++/23914
template <class T>
struct foo_template {
static const unsigned complexity = 0;
};
template <int x> struct STATIC_ASSERTION {};
void gcc_402_problem_minimal()
{
sizeof(STATIC_ASSERTION< foo_template<int>::complexity >);
}
|
google
|
chromium
|
error2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error2.C
| 671 |
utf_8
|
8d566cebeca82efbe1221a6ffb2623ac
|
// { dg-do compile }
// instantiated from did not indicate the nested class
template<class T> struct X
{
T m; // { dg-error "as type 'void'" "void" }
// { dg-error "incomplete type" "incomplate" { target *-*-* } 10 }
// { dg-error "invalid" "invalid" { target *-*-* } 10 }
};
template<class T >
struct Derived
{
class Nested : public X<T>
{ // { dg-message "instantiated" "" }
};
Nested m; // { dg-message "instantiated" "" }
void Foo ();
};
void Foo (Derived<void> &x)
{
x.Foo (); // { dg-message "instantiated" "" }
}
|
google
|
chromium
|
sfinae7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sfinae7.C
| 6,738 |
utf_8
|
ddcb9be925a64a1c49b8f8cc6c154cf3
|
// DR 339
//
// Test of the use of various 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<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
#define DEFINE_INFIX_BINARY_TRAIT(Name,Op) \
template<typename T, typename U> \
typename enable_if<(sizeof(create_a<T>() Op create_a<U>(), 1) > 0), \
yes_type>::type \
JOIN(check_,Name)(type<T>, type<U>); \
\
no_type JOIN(check_,Name)(...); \
\
template<typename T, typename U = T> \
struct Name \
{ \
static const bool value = \
(sizeof(JOIN(check_,Name)(type<T>(), type<U>())) == sizeof(yes_type)); \
}
template<typename T, typename U>
typename enable_if<(sizeof(create_a<T>()[create_a<U>()], 1) > 0),
yes_type>::type
check_subscript(int);
template<typename T, typename U>
no_type check_subscript(...);
template<typename T, typename U>
struct can_subscript
{
static const bool value =
(sizeof(check_subscript<T, U>(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 { };
struct Y { int operator[](X); };
// is_addable
DEFINE_INFIX_BINARY_TRAIT(is_addable, +);
X operator+(X, X);
X operator+(X, Y);
STATIC_ASSERT((is_addable<int>::value));
STATIC_ASSERT((is_addable<int, long>::value));
STATIC_ASSERT((is_addable<X>::value));
STATIC_ASSERT((is_addable<int*, int>::value));
STATIC_ASSERT((!is_addable<int*>::value));
STATIC_ASSERT((is_addable<X, Y>::value));
STATIC_ASSERT((!is_addable<Y>::value));
// is_subtractable
DEFINE_INFIX_BINARY_TRAIT(is_subtractable, -);
X operator-(X, X);
X operator-(X, Y);
STATIC_ASSERT((is_subtractable<int>::value));
STATIC_ASSERT((is_subtractable<int, long>::value));
STATIC_ASSERT((is_subtractable<X>::value));
STATIC_ASSERT((is_subtractable<int*, int>::value));
STATIC_ASSERT((is_subtractable<int*>::value));
STATIC_ASSERT((is_subtractable<X, Y>::value));
STATIC_ASSERT((!is_subtractable<Y>::value));
STATIC_ASSERT((!is_subtractable<int X::*>::value));
// is_multiplicable
DEFINE_INFIX_BINARY_TRAIT(is_multiplicable, *);
X operator*(X, X);
X operator*(X, Y);
STATIC_ASSERT((is_multiplicable<int>::value));
STATIC_ASSERT((is_multiplicable<int, long>::value));
STATIC_ASSERT((is_multiplicable<X>::value));
STATIC_ASSERT((!is_multiplicable<int*, int>::value));
STATIC_ASSERT((!is_multiplicable<int*>::value));
STATIC_ASSERT((is_multiplicable<X, Y>::value));
STATIC_ASSERT((!is_multiplicable<Y>::value));
STATIC_ASSERT((!is_multiplicable<int X::*>::value));
// is_divisible
DEFINE_INFIX_BINARY_TRAIT(is_divisible, /);
X operator/(X, X);
X operator/(X, Y);
STATIC_ASSERT((is_divisible<int>::value));
STATIC_ASSERT((is_divisible<int, long>::value));
STATIC_ASSERT((is_divisible<X>::value));
STATIC_ASSERT((!is_divisible<int*, int>::value));
STATIC_ASSERT((!is_divisible<int*>::value));
STATIC_ASSERT((is_divisible<X, Y>::value));
STATIC_ASSERT((!is_divisible<Y>::value));
STATIC_ASSERT((!is_divisible<int X::*>::value));
// has_remainder
DEFINE_INFIX_BINARY_TRAIT(has_remainder, %);
X operator%(X, X);
X operator%(X, Y);
STATIC_ASSERT((has_remainder<int>::value));
STATIC_ASSERT((has_remainder<int, long>::value));
STATIC_ASSERT((!has_remainder<float>::value));
STATIC_ASSERT((has_remainder<X>::value));
STATIC_ASSERT((!has_remainder<int*, int>::value));
STATIC_ASSERT((!has_remainder<int*>::value));
STATIC_ASSERT((has_remainder<X, Y>::value));
STATIC_ASSERT((!has_remainder<Y>::value));
STATIC_ASSERT((!has_remainder<int X::*>::value));
// has_xor
DEFINE_INFIX_BINARY_TRAIT(has_xor, ^);
X operator^(X, X);
X operator^(X, Y);
STATIC_ASSERT((has_xor<int>::value));
STATIC_ASSERT((has_xor<int, long>::value));
STATIC_ASSERT((!has_xor<float>::value));
STATIC_ASSERT((has_xor<X>::value));
STATIC_ASSERT((!has_xor<int*, int>::value));
STATIC_ASSERT((!has_xor<int*>::value));
STATIC_ASSERT((has_xor<X, Y>::value));
STATIC_ASSERT((!has_xor<Y>::value));
STATIC_ASSERT((!has_xor<int X::*>::value));
// has_bitand
DEFINE_INFIX_BINARY_TRAIT(has_bitand, &);
X operator&(X, X);
X operator&(X, Y);
STATIC_ASSERT((has_bitand<int>::value));
STATIC_ASSERT((has_bitand<int, long>::value));
STATIC_ASSERT((!has_bitand<float>::value));
STATIC_ASSERT((has_bitand<X>::value));
STATIC_ASSERT((!has_bitand<int*, int>::value));
STATIC_ASSERT((!has_bitand<int*>::value));
STATIC_ASSERT((has_bitand<X, Y>::value));
STATIC_ASSERT((!has_bitand<Y>::value));
STATIC_ASSERT((!has_bitand<int X::*>::value));
// has_bitor
DEFINE_INFIX_BINARY_TRAIT(has_bitor, |);
X operator|(X, X);
X operator|(X, Y);
STATIC_ASSERT((has_bitor<int>::value));
STATIC_ASSERT((has_bitor<int, long>::value));
STATIC_ASSERT((!has_bitor<float>::value));
STATIC_ASSERT((has_bitor<X>::value));
STATIC_ASSERT((!has_bitor<int*, int>::value));
STATIC_ASSERT((!has_bitor<int*>::value));
STATIC_ASSERT((has_bitor<X, Y>::value));
STATIC_ASSERT((!has_bitor<Y>::value));
STATIC_ASSERT((!has_bitor<int X::*>::value));
// has_left_shift
DEFINE_INFIX_BINARY_TRAIT(has_left_shift, <<);
X operator<<(X, X);
X operator<<(X, Y);
STATIC_ASSERT((has_left_shift<int>::value));
STATIC_ASSERT((has_left_shift<int, long>::value));
STATIC_ASSERT((!has_left_shift<float>::value));
STATIC_ASSERT((has_left_shift<X>::value));
STATIC_ASSERT((!has_left_shift<int*, int>::value));
STATIC_ASSERT((!has_left_shift<int*>::value));
STATIC_ASSERT((has_left_shift<X, Y>::value));
STATIC_ASSERT((!has_left_shift<Y>::value));
STATIC_ASSERT((!has_left_shift<int X::*>::value));
// has_right_shift
DEFINE_INFIX_BINARY_TRAIT(has_right_shift, >>);
X operator>>(X, X);
X operator>>(X, Y);
STATIC_ASSERT((has_right_shift<int>::value));
STATIC_ASSERT((has_right_shift<int, long>::value));
STATIC_ASSERT((!has_right_shift<float>::value));
STATIC_ASSERT((has_right_shift<X>::value));
STATIC_ASSERT((!has_right_shift<int*, int>::value));
STATIC_ASSERT((!has_right_shift<int*>::value));
STATIC_ASSERT((has_right_shift<X, Y>::value));
STATIC_ASSERT((!has_right_shift<Y>::value));
STATIC_ASSERT((!has_right_shift<int X::*>::value));
// can_subscript
STATIC_ASSERT((can_subscript<int*, int>::value));
STATIC_ASSERT((can_subscript<int, int*>::value));
STATIC_ASSERT((can_subscript<int(&)[7], int>::value));
STATIC_ASSERT((can_subscript<int, int(&)[7]>::value));
STATIC_ASSERT((!can_subscript<X, Y>::value));
STATIC_ASSERT((can_subscript<Y, X>::value));
|
google
|
chromium
|
friend34
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend34.C
| 290 |
utf_8
|
861190a2944f470305adf84080e394bd
|
// { dg-do compile }
// PR c++/9783: Forward declaration of class in template.
template <typename T>
struct C {
void foo (struct X *);
};
struct X {};
template <typename T>
void C<T>::foo(struct X *) {}
|
google
|
chromium
|
access17
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access17.C
| 274 |
utf_8
|
092b63314ea4c83dfe2ff66c762901cd
|
// PR c++/27339
class A
{
private:
enum private_enum {a};
template<A::private_enum v> // OK
struct B
{
void bm();
};
public:
void am()
{
B<a> instance; //OK
instance.bm();
}
};
template<A::private_enum v> // FAIL
void
A::B<v>::bm(){}
|
google
|
chromium
|
ttp21
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp21.C
| 130 |
utf_8
|
54aa5e13e0b421f81c0decbd0545680e
|
// PR c++/28853
// { dg-do compile }
template<template<int> class A>
int A<0>::i; // { dg-error "template template parameter" }
|
google
|
chromium
|
crash20
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash20.C
| 322 |
utf_8
|
7d60f1e42e3a0cb9fb843525c06fc428
|
// { dg-do compile }
// ICE with incompletable type.
class INC;
template <typename T> class B {};
template<typename T> void Foo (B<T> &);
void Foo (INC &);
void Baz (INC *p)
{
Foo (*p);
}
|
google
|
chromium
|
memfriend14
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memfriend14.C
| 1,005 |
utf_8
|
cd21edd34d2428c1c7c7904f894a44f7
|
// { dg-do compile }
// Nested class template of class template as friend
template<class T> struct A
{
template <T t> struct B
{
void f();
};
};
template <class U> class C {
int i;
template<class T> template <T t> friend struct A<T>::B;
};
template<class T> struct A<T*>
{
template <T* t> struct B
{
void f();
};
};
template<> struct A<char>
{
template <char t> struct B
{
void f();
};
};
template<class T> template <T t> void A<T>::B<t>::f()
{
C<int> c;
c.i = 0;
}
template<class T> template <T* t> void A<T*>::B<t>::f()
{
C<int> c;
c.i = 0;
}
template <char t> void A<char>::B<t>::f()
{
C<int> c;
c.i = 0;
}
template <> void A<char>::B<'b'>::f()
{
C<int> c;
c.i = 0;
}
int d2 = 0;
int main()
{
A<int>::B<0> b1;
b1.f();
A<int *>::B<&d2> b2;
b2.f();
A<char>::B<'a'> b3;
b3.f();
A<char>::B<'b'> b4;
b4.f();
}
|
google
|
chromium
|
crash6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash6.C
| 199 |
utf_8
|
503d2ceca1151ace69073bc94b2e3181
|
template <class> struct A { static const int n = 1; } ;
template <int> struct B;
template <class S>
struct restype_order {
static const int s = A<S>::n;
typedef typename B<(s > 0)>::t t;
};
|
google
|
chromium
|
explicit-args1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/explicit-args1.C
| 483 |
utf_8
|
e55630cc11be91571d5b580292e51090
|
// PR c++/34950
template <class T = int> struct policy {
typedef int unnecessary;
};
template <class Policy> struct A {
typedef int type;
typedef typename Policy::unnecessary unused;
};
template <class T> struct S {
typedef int type;
typedef typename A<T>::type unused;
};
template <class, class T> typename S<T>::type foo();
template <class> S<policy<> >::type foo();
template <typename T> int def(T);
const int i = def(foo<int>);
|
google
|
chromium
|
class1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/class1.C
| 127 |
utf_8
|
706f2857327f695c7b984df9d14be0b0
|
extern const int a;
template <const int&> class X {};
template <typename> struct Y {
X<a> x;
};
template struct Y<int>;
|
google
|
chromium
|
partial-specialization
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/partial-specialization.C
| 295 |
utf_8
|
e187a317d102d915368fe357726202ba
|
// { dg-do compile }
struct B
{
int i;
};
template <class _T, class _M, _M _T::* _V>
struct A;
template <class _T, int _T::* _V>
struct A<_T, int, _V>
{
};
int main()
{
A<B, int, & B::i> a;
}
|
google
|
chromium
|
explicit8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/explicit8.C
| 233 |
utf_8
|
ad629aa6efcf1374753dbd987791a144
|
namespace N {
template <typename T>
struct S {
void f() {}
};
namespace I {
template void S<double>::f(); // { dg-error "namespace" }
}
}
namespace K {
template void N::S<int>::f(); // { dg-error "namespace" }
}
|
google
|
chromium
|
unify9
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/unify9.C
| 438 |
utf_8
|
1867b7471bb6b624bf0ce243348a15f3
|
// PR 21799: deduction of cvqualifiers on member functions was wrong
template <class T> void f (T &, void (T::*)() );
struct X {
void g() const {}
};
const X *x;
int main () {
f (*x, &X::g); // { dg-error "no matching function" }
}
|
google
|
chromium
|
friend12
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend12.C
| 470 |
utf_8
|
b0a401cf45ed38cceaf9b0b254083c87
|
// { dg-do compile }
// PR 9030. Perform access checking to parameter and return type of
// function template correctly when the template is friend.
template <class T> class Outer {
private:
struct Inner {};
template <class T_>
friend typename Outer<T_>::Inner foo ();
};
template <class T>
typename Outer<T>::Inner
foo () {
return typename Outer<T>::Inner();
}
void f() {
foo<int>();
}
|
google
|
chromium
|
lvalue1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/lvalue1.C
| 621 |
utf_8
|
c0214387b51fcbd1778447a0a4a88720
|
// PR c++/38877
template<class _T1, class _T2>
struct pair
{
typedef _T1 first_type;
typedef _T2 second_type;
_T1 first;
_T2 second;
pair () : first(), second() { }
pair(const _T1& __a, const _T2& __b)
: first(__a), second(__b) { }
};
template<class _T1, class _T2>
inline pair<_T1, _T2>
make_pair(_T1 __x, _T2 __y)
{
return pair<_T1, _T2>(__x, __y);
}
template <int dim> class bar;
template <int dim>
pair<bar<dim> *, unsigned int>
foo (unsigned int position)
{
const pair<int,unsigned int> tmp;
return make_pair (new bar<dim>(tmp.first),
position);
}
|
google
|
chromium
|
error4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error4.C
| 245 |
utf_8
|
767c10eb63bc3c8f259a1f247aad4fe4
|
template<class T> struct C1
{
template<class U> struct C2
{ class Type { }; };
};
template<class T, class U>
void foo(typename C1<T>::C2<U>::Type *) { } // { dg-error "template" "error " }
// { dg-message "note" "note" { target *-*-* } 8 }
|
google
|
chromium
|
inherit
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/inherit.C
| 248 |
utf_8
|
0ce7717b93949f5490ac817b51482e8a
|
// { dg-do compile }
template<typename T>
struct X { void f() { } };
struct Z : X<int> { };
int main()
{
Z z;
z.X::f(); // { dg-error "template parameters" "" }
}
|
google
|
chromium
|
canon-type-5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/canon-type-5.C
| 340 |
utf_8
|
de48d8ab66a3547836d818ea051f3111
|
// Origin PR c++/39754
// { dg-do "compile" }
struct Foo {};
template<typename> struct A ;
template<typename T ,typename = A<T> > struct B { } ;
template<class W, class>
struct D
{
typedef W X ;
A<X Foo::*> a ;
} ;
template<class Y>
struct E
{
B<Y Foo::*> b ;
} ;
E < int > e ;
|
google
|
chromium
|
spec25
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec25.C
| 168 |
utf_8
|
5858bf93d5d479c31bf4e3cc414cd2ff
|
namespace N {
template <typename T>
struct S {
void f() {}
};
}
namespace K {
template <> void N::S<char>::f() {} // { dg-error "namespace|definition" }
}
|
google
|
chromium
|
crash8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash8.C
| 286 |
utf_8
|
899e82cfa1eab0c5e96b47962c693262
|
// { dg-do compile }
// PR c++/11513: ICE due to incorrect decision whether the tag is template.
template <typename T>
struct bar
{
struct foo
{
int a;
};
template <typename U>
int wom(U c)
{
struct foo b;
}
};
|
google
|
chromium
|
ttp13
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp13.C
| 376 |
utf_8
|
dcb32e2136f330749a2276bb4d351b2b
|
// { dg-do compile }
// PR c++/15664: Template substitution of template template parameter
template <int N> struct S {
template<template<typename> class A>
friend void foo();
};
template<template<typename> class A>
void foo();
template <typename> struct X {};
int main () {
S<1> s;
foo<X>();
}
|
google
|
chromium
|
qualttp15
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp15.C
| 500 |
utf_8
|
ebbe781125455c724f34cf709f9a1365
|
// { dg-do compile }
struct A
{
template <class T> class B {};
};
template <template <class> class TT> struct X
{
TT<int> y;
};
template <class T> struct X<T::template B>
{ // { dg-error "previous" }
T z;
};
template <class T> struct X<T::template B> // { dg-error "redefinition" }
{
T z;
};
template <class T> struct C
{
X<T::template B> x;
};
int main()
{
C<A> c;
}
|
google
|
chromium
|
repo1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/repo1.C
| 235 |
utf_8
|
3a0b9566efedfd5ec75bfbfa5b764574
|
// { dg-options "-frepo" }
// { dg-require-host-local "" }
struct A {
A();
};
A::A() {}
template <typename T>
struct B : public A {
B() {} // { dg-bogus "" }
};
B<int> b;
int main () {}
// { dg-final { cleanup-repo-files } }
|
google
|
chromium
|
class2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/class2.C
| 100 |
utf_8
|
4a9fdbf9e37ab379d97118860f6e5744
|
// PR c++/13451
template <class T>
struct A {
struct B;
struct A::B { }; // { dg-error "" }
};
|
google
|
chromium
|
void14
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/void14.C
| 208 |
utf_8
|
25f480eeead08db92a5bce8ac9a6c4ed
|
// PR c++/36411
// { dg-do compile }
template<template<void> class> struct A // { dg-error "not a valid type" }
{
template<template<int> class T> A<T> foo(); // { dg-error "mismatch|expected|invalid" }
};
|
google
|
chromium
|
duplicate1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/duplicate1.C
| 126 |
utf_8
|
8f66b4b808e15a65e9eb6c04d2d02e4e
|
//PR c++/19439
template<int> struct A
{
~A() {} // { dg-error "with" }
~A() {} // { dg-error "cannot be overloaded" }
};
|
google
|
chromium
|
error34
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error34.C
| 725 |
utf_8
|
411a4732230a0fbd8972e03886c8d341
|
// PR c++/33842
// { dg-do compile }
template<typename T> struct A
{
A<__builtin_offsetof(T, x)>(); // { dg-error "type/value mismatch|offsetof\\(T, x\\)" }
};
template<typename T> struct B
{
B<__builtin_offsetof(T, x.y)>(); // { dg-error "type/value mismatch|offsetof\\(T, x.y\\)" }
};
template<typename T> struct C
{
C<__builtin_offsetof(T, x[6])>(); // { dg-error "type/value mismatch|offsetof\\(T, x\\\[6\\\]\\)" }
};
template<typename T> struct D
{
D<__builtin_offsetof(T, x.y[6].z)>(); // { dg-error "type/value mismatch|offsetof\\(T, x.y\\\[6\\\].z\\)" }
};
struct E { int x; };
template<typename T> struct F
{
F<__builtin_offsetof(E, x)>(); // { dg-error "type/value mismatch|offsetof\\(E, x\\)" }
};
|
google
|
chromium
|
spec16
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec16.C
| 283 |
utf_8
|
e1e36aaa11bbca99a39b8202198829ce
|
// { dg-do compile }
// Contributed by Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// PR c++/14497: Reject specialization without template headers
template <int N>
struct A {
template<int M> void B () ;
};
void A<0>::B<0>() { // { dg-error "parameter-lists" }
}
|
google
|
chromium
|
spec7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec7.C
| 367 |
utf_8
|
c815e2045db2912ff4ac5e6626f81264
|
// { dg-do compile }
// PR c++/6440: Specialization of member class template.
template<class T> struct A
{
template<class U> struct B {};
};
template<> template<class U>
struct A<int>::B
{
void f();
template <class V> void g(V);
};
template<> template<> template <class V> void A<int>::B<char>::g(V)
{
}
A<int>::B<char> b;
int h()
{
b.f();
b.g(0);
}
|
google
|
chromium
|
void2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/void2.C
| 143 |
utf_8
|
28483e5e5ebefbb2745d92348d976139
|
// PR c++/27496
// { dg-do compile }
template<int> struct A
{
template<void> friend class X; // { dg-error "void|valid type" }
};
A<0> a;
|
google
|
chromium
|
warn1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/warn1.C
| 598 |
utf_8
|
268062e51ac8a7f247d4ac0e9d278be0
|
// { dg-do compile }
// { dg-options "-Wall" }
// PR 11512. erroneous warnings
template <class T> void Foo(T i)
{
i++, i++;
i, i++; // { dg-warning "left-hand operand" "" }
i++, i; // { dg-warning "right-hand operand" "" }
for (;; --i, ++i)
;
}
void Bar ()
{
Foo (1); // { dg-message "instantiated" }
}
struct M {};
struct C
{
M m;
C () :m (M ()) {}
};
void Baz (int i)
{
i ? i + 1 : i + 2; // { dg-warning "operand of" }
i ? i++ : 0;
}
|
google
|
chromium
|
access11
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access11.C
| 536 |
utf_8
|
b8660e2dd04e44b2e51e72b470d5d357
|
// { dg-do compile }
// Access checking during explicit instantiation.
class A {
typedef int X; // { dg-error "private" }
};
class X {
private:
template <typename T> struct Y;
};
template <> struct X::Y<int> {
A::X x; // { dg-error "this context" }
};
template <typename T> struct X::Y {
typename T::X x; // { dg-error "this context" }
};
template struct X::Y<A>; // { dg-message "instantiated" }
|
google
|
chromium
|
friend14
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend14.C
| 414 |
utf_8
|
2c569073aac74ea8a9886428ec873202
|
// { dg-do compile }
// Perform access checking to parameter and return type of
// function template correctly when the template is friend.
template <class T> class O {
struct I { I (int); };
template <class T_>
friend typename O<T_>::I f ();
};
template <class T_>
typename O<T_>::I f () { return 1; }
struct X {
void g() { f<int>(); }
};
|
google
|
chromium
|
array14
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/array14.C
| 133 |
utf_8
|
00d9cd9feffed8cd62a0330e5742bbb9
|
// PR c++/23993
const int data[2][4] = {
{ 0, 1, 2, 3 }
};
template <typename T>
void t(int k) {
int candidate = data[1][k];
}
|
google
|
chromium
|
sizeof6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sizeof6.C
| 324 |
utf_8
|
8d7b68da161169ea74382da5f4a8c8fb
|
// { dg-do compile }
// Contributed by Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// PR c++/13683: bogus warning about passing non-PODs through ellipsis
struct B {};
struct NonPOD : B {};
struct A
{
static int check(...);
static NonPOD GetNonPOD(void);
enum { value = sizeof(A::check(A::GetNonPOD())) };
};
|
google
|
chromium
|
inline1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/inline1.C
| 484 |
utf_8
|
e11043be34a3a4669d6240f263aa30d2
|
// { dg-do compile }
// { dg-options "-fno-default-inline -O0" }
// { dg-final { scan-assembler-not "\n_?_ZN1X3FooIiEEvT_\[: \t\n\]" } }
// PR 10047. bogus warning.
struct X
{
template <typename T> static void Foo (T) {}
};
extern template void X::Foo<int> (int); // extern, so don't emit it
int main () {
X::Foo (1); // ok, we've seen the defn
}
|
google
|
chromium
|
crash31
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash31.C
| 68 |
utf_8
|
e3731e3425655eda73d8d1ac61cdadb3
|
// PR c++/19063
template<operator< struct A {}; // { dg-error "" }
|
google
|
chromium
|
lookup7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/lookup7.C
| 115 |
utf_8
|
863f99213222c2c03bf6c2f03bfc91c6
|
class S;
template<class T>
int f(T, S);
class S {
template<class T>
friend int f(T t, S) { t; return 0; }
};
|
google
|
chromium
|
array19
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/array19.C
| 364 |
utf_8
|
d6ed514093a999f1e4b15b3133a67692
|
// PR c++/33553
// { dg-do compile }
template <class T> struct S { static const int sz = 2; };
template <class T> struct U { enum { sz = 2 }; };
template <class R>
struct P
{
template <class T> void bar (int (&x)[S<T>::sz]);
template <class T> void baz (int (&x)[U<T>::sz]);
};
P<int> p;
void
foo (void)
{
int x[2];
p.bar<int> (x);
p.baz<int> (x);
}
|
google
|
chromium
|
memclass3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memclass3.C
| 740 |
utf_8
|
0d33a29a97363269ef67e175452d1251
|
// PR c++/17132
template <typename T>
struct has_deref
{
struct impl
{
template <
typename Type,
typename Type::reference (Type::*Func)(void) const>
struct func_tag;
template <typename Type>
static char (& test(
Type *,
func_tag<Type, &Type::operator*> * = 0
))[2];
static char test(void *);
};
static const bool value = (sizeof(impl::test((T *) 0)) == 2);
};
template <typename T>
struct container
{
struct iterator
{
typedef T & reference;
reference operator*() const;
};
};
int main()
{
typedef container<int>::iterator iter;
int result = has_deref<iter>::value;
return result;
}
|
google
|
chromium
|
lookup8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/lookup8.C
| 267 |
utf_8
|
97437823fade3b3d3a9381c8da0c575b
|
// PR c++/38030
// The call to f should be resolved at template definition time.
// { dg-do link }
struct B { };
struct D : public B { };
D d;
void f (B &) { }
template < class T >
void g ()
{
return f (d);
}
void f (D &);
int main ()
{
g<int> ();
return 0;
}
|
google
|
chromium
|
conv1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/conv1.C
| 618 |
utf_8
|
32f254d8ff7fc2dadfbb4100169c8710
|
// { dg-do compile }
// PR 4361. Template conversion operators were not overloaded.
template <class T> struct Second;
template<class T> struct First
{
int Foo ();
template <class U> operator Second<U>();
template <class U> operator First<U>();
};
template <class T> int First<T>::Foo ()
{} // This is here to make sure we didn't smash Foo's decl in the
// method vector
struct B { };
struct D { };
void Foo ()
{
First<B> (First<D>::*pf)() = &First<D>::operator First<B>;
}
|
google
|
chromium
|
crash83
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash83.C
| 143 |
utf_8
|
8feaa48f5e36ee2582e8cf59664d8c67
|
// PR c++/37650
template<int> struct A {};
template<typename = class A<0>: > struct B {}; // { dg-error "explicit specialization|expected" }
|
google
|
chromium
|
nested4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nested4.C
| 196 |
utf_8
|
b12c9a151e46871b430564ee47c57714
|
template <typename T> struct A {
template<typename S> struct B { typedef A<S> X; };
};
template<typename> void f() {
typedef A<int>::B<double>::X X;
}
template void f<int> ();
|
google
|
chromium
|
void5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/void5.C
| 102 |
utf_8
|
29bdbfbe89710bff6d9ae0b64b0d06f5
|
//PR c++/28640
template<void> struct A; // { dg-error "not a valid type" }
template<int> struct A;
|
google
|
chromium
|
static14
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static14.C
| 176 |
utf_8
|
ff5a3d46b4c279a829a0b1e0eb4acdac
|
struct Base {
int x;
};
template <typename T>
struct A {
static const int N = sizeof(static_cast<Base*>(T()));
int a[N];
};
struct Derived : Base {
A<Derived*> a;
};
|
google
|
chromium
|
spec30
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec30.C
| 176 |
utf_8
|
bcc1e7cd1681ae2c1d9e35cde8abbbc4
|
// { dg-do compile }
template<int N>
inline int
foo (int a)
{
return a;
}
template<>
inline int
foo<0> (int a = 123) // { dg-error "default argument" }
{
return a + 1;
}
|
google
|
chromium
|
explicit5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/explicit5.C
| 475 |
utf_8
|
bfbe469c91f678acc5c06f6a7a92f9c6
|
// { dg-do compile }
// Failed to spot specialization using a template-id expr
template <typename n> class A {};
template <int m> class R {};
template <typename n, typename x> struct Trait { enum {m = sizeof (n)}; };
template <typename n, typename x> R<Trait<n,x>::m> f(A<x>);
template <> R<Trait<char,char>::m> f<char>(A<char>) {return R<1>();}
|
google
|
chromium
|
friend30
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend30.C
| 239 |
utf_8
|
1d0be2d7ae4ecc088986fba42e7ee292
|
// PR c++/14930
template<typename T> class Point;
template<> class Point<double> {
friend class Plane;
double v;
};
struct Plane {
double get(const Point<double>& p);
};
double Plane::get(const Point<double> &p) { return p.v; }
|
google
|
chromium
|
sizeof9
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sizeof9.C
| 171 |
utf_8
|
12df473d69cf94653ec8c2821cfe853f
|
// PR c++/21025
template<int N> struct X { char x[N]; };
template<typename T> X<1 + sizeof(T) - sizeof(T)> F(T const &);
template<int N> struct S { int d() { F(1); } };
|
google
|
chromium
|
crash52
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash52.C
| 172 |
utf_8
|
f58855114e5ac6f9d257056219515c0c
|
// PR c++/27665
template<int> struct A
{
struct B
{
struct C {};
};
};
template<int N> void foo()
{
class A<N>::B::C X;
}
void bar()
{
foo<0>();
}
|
google
|
chromium
|
static10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static10.C
| 457 |
utf_8
|
22b831fe887011fbf9bec264ae3b8112
|
// PR c++/19555
namespace __gnu_debug_def { }
namespace std
{
using namespace __gnu_debug_def;
template<typename _Tp> class allocator {};
}
namespace __gnu_debug_def
{
template<typename _Tp,
typename _Allocator = std::allocator<_Tp> >
class vector
{
void
swap(vector<_Tp,_Allocator>& __x);
};
}
namespace std
{
template<> void
vector<int, allocator<int> >::swap(vector<int, allocator<int> >&) { } // { dg-error "" }
}
|
google
|
chromium
|
koenig7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/koenig7.C
| 344 |
utf_8
|
2e7cb1dcf45bb8b5519d06247d085cc7
|
// PR c++/13549
// We need to do arg-dep lookup for g<T>(j) at instantiation time because
// g<T> is dependent, even though (j) is not; at that point we can find
// g(h).
template <typename T> int g(int);
class h{};
template <typename T> int l(){h j; return g<T>(j);}
template <typename T> int g(const h&);
class j{};
int jj(){return l<j>();}
|
google
|
chromium
|
spec1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec1.C
| 338 |
utf_8
|
2c4280f67b1e22c2fbb0f60584f52297
|
// { dg-do compile }
// Bug: ICE during invalid instantiation of member function
// which enclosing class is specialized.
template <class T>
struct A
{
void f(T) {}
};
template<>
struct A<int>
{
void f(int) {}
};
template
void A<int>::f(int); // { dg-error "not match" }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.