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
|
nontype13
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nontype13.C
| 367 |
utf_8
|
afffb606baf8ab2126ce6a7582546c76
|
// PR c++/19004
template<typename T>
struct Dummy
{
void evil()
{
this->template tester<true>();
}
template<bool B>
void tester()
{
bar<evil>()(); // { dg-error "constant" }
}
template<bool B>
struct bar
{
void operator()()
{ }
};
};
int main()
{
Dummy<int> d;
d.tester<true> (); // { dg-message "instantiated" }
}
|
google
|
chromium
|
spec20
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec20.C
| 387 |
utf_8
|
ed4d5e577ced48d91b3a5054ba58d4c5
|
// Bug 19203: Failure to implement DR 214
template <class A>
void foo(const A& a);
template <class RET, class ARG1>
int foo(RET (&)(ARG1)); // this one
float decl(int);
int bar(void)
{
return foo(decl);
}
|
google
|
chromium
|
deduce3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/deduce3.C
| 162 |
utf_8
|
c8c5dde19f7b188668caeeb506ac6852
|
template <typename T>
void f(int, T (*)() = 0);
void g() {
typedef int A[2];
f<A>(0); // { dg-error "" }
typedef void F();
f<F>(0); // { dg-error "" }
}
|
google
|
chromium
|
error18
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error18.C
| 195 |
utf_8
|
e0e0adf8e99a8d206f7e74340f4b67e5
|
// PR c++/20157
template<typename AT>
struct A{
template<typename T>
void function(T);
};
template<>
template<typename ABC,typename DEF>
void A<int>::function(ABC); // { dg-error "match" }
|
google
|
chromium
|
overload9
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/overload9.C
| 370 |
utf_8
|
31f85468f99137d5b067ad5f280c42f6
|
// PR c++/32232
template <typename T> struct A;
template <typename T> struct B {};
template <typename T> A<T>& operator<<(A<T>&, const B<T>&);
template <typename T>
struct A
{
A<T>& operator<<(A<T>& (*)(A<T>&)); // { dg-message "candidate" }
};
template <typename T> A<T>& foo(A<T>&);
extern A<char> c;
int main () {
c << (1, foo); // { dg-error "no match" }
}
|
google
|
chromium
|
defarg5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/defarg5.C
| 512 |
utf_8
|
84d085b3ed907df1747cc523efd8d714
|
// { dg-do compile }
// PR c++/17344: Substitution failure is not an error
// for default template argument
template <class> struct intTraits;
template<> struct intTraits<int> {
static const int i = 0;
};
template<typename E, E i = intTraits<E>::i> struct A {};
struct S {
template <template <typename> class X> S(X<void>);
};
int bar(S);
int bar(A<int,0>);
A<int> bed;
int i = bar(bed);
|
google
|
chromium
|
ref4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ref4.C
| 176 |
utf_8
|
c3bbc6f642a26de6b3238750b8f9c01f
|
// PR c++/41972
struct X {
static const double x;
};
template <const double& _test_>
class Foo { };
template <typename _ignore_>
struct Y {
typedef Foo<X::x> type;
};
|
google
|
chromium
|
explicit6
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/explicit6.C
| 297 |
utf_8
|
0f1992cf38a7f4a3d4febc06bbe2dc39
|
// Bug 19895: ICE on invalid
struct A;
template A<>::A(); // { dg-error "(not a template)|(explicit qualification)" "" }
|
google
|
chromium
|
spec24
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec24.C
| 443 |
utf_8
|
756d8965e92fbeb951248f1d353ce9a9
|
template <int i> struct Mutex
{
static int mutex;
};
template <int i>
int Mutex<i>::mutex = {1};
template <> int Mutex<0>::mutex;
template <> int Mutex<0>::mutex = 0;
void g()
{
Mutex<0>::mutex = 0;
}
|
google
|
chromium
|
dtor7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/dtor7.C
| 428 |
utf_8
|
c8e779ef365daa82fe0eec85042627d9
|
// PR c++/40373
// { dg-compile }
struct A; // { dg-bogus "candidates are" "" { xfail *-*-* } }
namespace
{
struct A; // { dg-bogus "struct" "" { xfail *-*-* } }
}
struct B {};
template <typename T> void
foo (T t)
{
t.~A (); // { dg-error "does not match destructor name" }
}
void
bar ()
{
foo (B ()); // { dg-bogus "instantiated from here" "" { xfail *-*-* } }
}
// { dg-bogus "is ambiguous" "" { xfail *-*-* } 15 }
|
google
|
chromium
|
arg2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/arg2.C
| 340 |
utf_8
|
7bea6580b2b65de331f30831724d355f
|
// { dg-do compile }
// PR 9708. We accepted a local class
template <typename T> class X {};
void fn ()
{
class L {};
X<L> f; // { dg-error "uses local type|trying to instantiate|no type|invalid type" "" }
}
|
google
|
chromium
|
nested2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nested2.C
| 115 |
utf_8
|
1cf2f3c9d70e586c16763a10c08d9972
|
template <class T> class CO {
class CI1 {
class CI2;
};
};
template <class T>
class CO<T>::CI1::CI2 {};
|
google
|
chromium
|
qualttp13
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp13.C
| 433 |
utf_8
|
bbc53060e714151a182a421e8691abd5
|
template <class U> struct A
{
template <class V> struct AA {
template <class T> struct B {
int i;
B() : i(1) {}
};
};
};
template <template <class> class TT> struct X
{
TT<int> y;
};
template <class T, class U> struct C
{
X<T::template AA<U>::template B> x;
};
int main()
{
C<A<char>, int> c;
}
|
google
|
chromium
|
ref2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ref2.C
| 380 |
utf_8
|
a02f5612e9219b8cd807bc11c6baa86d
|
struct t
{
void f() const;
};
template <typename _Tp>
struct A
{
static t const& c;
};
template <typename _Tp>
void g(void)
{
A<_Tp>::c.f();
}
void h(void)
{
g<int>();
}
|
google
|
chromium
|
error19
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error19.C
| 269 |
utf_8
|
c141fe6a264c757500f6ee4ed30842f6
|
// PR c++/23293
template < typename > struct P;
struct S;
void *unrelated_function()
{
typedef S K;
P < K > * p;
return p;
}
template < typename U >
void generate_warning()
{
U::x(); // { dg-error "P<S>" }
}
int main()
{
generate_warning< P < S > >();
}
|
google
|
chromium
|
ttp9
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp9.C
| 588 |
utf_8
|
32ec8290dcb76d620e429687f0236c40
|
// { dg-do compile }
// PR c++/12170: Deducing template template parameter from nested
// class template.
template <typename> struct W {};
template< template<typename> class F, typename T>
int foo(W< F<T> >);
template<typename T>
struct L {
static int const value = sizeof(foo(W<T>()));
typedef T type;
};
template <typename>
struct Y {
template <typename> struct X { typedef int type; };
typedef typename L<X<int> >::type type;
};
template struct Y<int>;
|
google
|
chromium
|
nontype15
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nontype15.C
| 289 |
utf_8
|
e4e6038ded9c7ed667109894758cea89
|
struct foo {
typedef int (*fun)(int);
static int f(int); // overload between static & non-static
int f();
static int g(int); // non-overloaded static
};
template<foo::fun>
struct f_obj {
// something ..
};
int foo::f() {
f_obj<f> f1;
f_obj<g> f2;
return 0;
}
|
google
|
chromium
|
friend28
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend28.C
| 449 |
utf_8
|
5242e61bb45530434007931e7e9949d2
|
// PR c++/15629
// { dg-do link }
template<int a, int b> class T;
template<int a, int b> void func(T<a, b> * t);
template<int a> void func(T<a, 3> * t) {}
template void func<2>(T<2, 3>*);
template<int a, int b> struct T {
friend void func<a, b>(T<a, b> * t);
friend void func<a> (T<a, 3> * t);
void foo();
};
template<int a, int b> void T<a, b>::foo() {
func((T<2,3>*)0);
}
int main() {
T<2,3>().foo();
}
|
google
|
chromium
|
sfinae11
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sfinae11.C
| 1,508 |
utf_8
|
52303ab3e71ec37ab5f5099984d9715b
|
// DR 339
//
// Test of the use of the comma operator 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 U>
typename enable_if<(sizeof(create_a<T>(), create_a<U>()) > 0),
yes_type>::type
check_comma(int);
template<typename T, typename U> no_type check_comma(...);
template<typename T, typename U>
struct has_comma
{
static const bool value =
(sizeof(check_comma<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 { };
struct Z { };
bool operator,(X&, Y);
bool operator,(X, Z);
void operator,(const Y&, const Z&);
STATIC_ASSERT((has_comma<int, float>::value));
STATIC_ASSERT((has_comma<int, X>::value));
STATIC_ASSERT((has_comma<X, X>::value));
STATIC_ASSERT((has_comma<X, Y>::value));
STATIC_ASSERT((has_comma<X&, Y>::value));
STATIC_ASSERT((has_comma<X, Z>::value));
STATIC_ASSERT((!has_comma<Y, Z>::value));
|
google
|
chromium
|
crash69
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash69.C
| 228 |
utf_8
|
2fe8caf6bfc48e5dbc0d295b6d6b0cf0
|
// PR c++/31132
template<typename T> class A
{
static int i; // { dg-error "is private" }
friend int T::foo(); // { dg-error "does not match" }
};
struct B
{
void foo() { A<B>::i; } // { dg-error "within|candidate" }
};
|
google
|
chromium
|
crash76
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash76.C
| 167 |
utf_8
|
f1a8c42b37d318db77076e2f45ccbce5
|
// PR c++/34486
template<typename> struct A
{
typedef A* X;
};
template<typename T> struct B
{
using A<T>::X::Y; // { dg-error "not a base type" }
};
B<int> b;
|
google
|
chromium
|
error14
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error14.C
| 104 |
utf_8
|
059b8fc25423ba0f718bb1feff4898e7
|
// PR c++/16904
template<typename T> struct X
{
X() { this->T::i; } // { dg-error "" }
};
X<int> x;
|
google
|
chromium
|
friend36
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend36.C
| 413 |
utf_8
|
4a3d535a6673c42778883751bb5d71cd
|
// PR c++/22139
// { dg-options "--param ggc-min-expand=0 --param ggc-min-heapsize=0" }
template <int rank, int dim> class Tensor;
template <int rank, int dim> struct SymmetricTensor {
SymmetricTensor (const Tensor<2,dim> &t);
friend void foo();
};
template <> SymmetricTensor<2,2>::SymmetricTensor (const Tensor<2,2> &t) {}
template <> SymmetricTensor<2,3>::SymmetricTensor (const Tensor<2,3> &t) {}
|
google
|
chromium
|
ttp19
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp19.C
| 184 |
utf_8
|
00132c35b440c6f38de75bfaed01af9d
|
// PR c++/27689
void f (...);
template <template <typename> class F, typename T> void f (F<T>);
template <typename> struct foo { struct bar {}; };
void g (foo<int>::bar x) { f(x); }
|
google
|
chromium
|
koenig2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/koenig2.C
| 233 |
utf_8
|
5e527c865bacdb52386cdb2f216a99d4
|
namespace nsp_foo {
struct A {};
struct foo {};
}
namespace nsp_bar {
void foo(nsp_foo::A) {}
template <class T>
void bar(T t)
{
nsp_bar::foo(t); // line 16
}
}
int main()
{
nsp_bar::bar(nsp_foo::A());
}
|
google
|
chromium
|
error28
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error28.C
| 94 |
utf_8
|
d977c0ff2fe276dbe8cf1ea701e05180
|
// PR c++/27211
struct A {};
template<int> void A::foo(); // { dg-error "member function" }
|
google
|
chromium
|
typedef3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typedef3.C
| 126 |
utf_8
|
ccd975f84b8531606ff90ff87ff98010
|
// PR c++/19397
// { dg-do compile }
template<typename> struct A
{
typedef int ::template; // { dg-error "template" }
};
|
google
|
chromium
|
repo5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/repo5.C
| 338 |
utf_8
|
2b2531f6118b232bccf5bc1f4798bf47
|
// PR c++/25625
// { dg-options "-frepo" }
// { dg-final { cleanup-repo-files } }
// { dg-require-host-local "" }
template< typename T, T N > struct integral_c {
static const T value = N;
typedef integral_c< T, value + 1 > next;
};
template< typename T, T N > T const integral_c< T, N >::value;
integral_c<int,0> a;
int main () {}
|
google
|
chromium
|
friend44
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend44.C
| 207 |
utf_8
|
ca014134ba946687331d24b91db8c563
|
// { dg-options "-fshow-column" }
//PR c++/28260
template<int> struct A
{
friend int foo(); // { dg-error "14:new declaration" }
};
void foo() { A<0> a; } // { dg-error "6:ambiguates old declaration" }
|
google
|
chromium
|
ctor2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ctor2.C
| 140 |
utf_8
|
5a69c7531482ab0af57cca8c90779073
|
// { dg-do run }
int i;
template <class T>
struct S
{
S () { i = 1; }
};
static S<int> s[1];
int main ()
{
if (!i)
return 1;
}
|
google
|
chromium
|
pr28301
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/pr28301.C
| 239 |
utf_8
|
d3ba333f92088ba255ebad2bc17cd0cf
|
// PR c++/28301
// { dg-do compile }
template<typename> struct A
{
template<int> void foo()
}; // { dg-error "initializer" }
template<> struct A<void>
{
template<int> void foo();
};
void bar()
{
A<void> a;
a.foo<0>();
}
|
google
|
chromium
|
qualttp19
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp19.C
| 918 |
utf_8
|
5d01ff95ca3a7d8da4e70d7477555e72
|
// { dg-do compile }
// PR 2645
template <typename T>
struct call_traits
{
public:
typedef T type_less_spec;
};
template <typename T>
struct call_traits<T&>
{
typedef T type_more_spec;
};
int main()
{
int num;
// Two typedefs lead to the instant. of the less spec. ("wrong") template
typedef int& r_type;
typedef const r_type cr_type;
call_traits<cr_type>::type_less_spec var = num; // { dg-error "" "" }
// The explicit type leads to the instantiation of the "correct" one
call_traits<const int&>::type_more_spec var2 = num;
// As happen with a single typedef!
typedef const int& std_cr_type;
call_traits<std_cr_type>::type_more_spec var3 = num;
// As happen, indeed, without the cv-qualifier
call_traits<r_type>::type_more_spec var4;
}
|
google
|
chromium
|
memfriend8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memfriend8.C
| 340 |
utf_8
|
975bbbbf89c7ed7467afe0db4642b444
|
// { dg-do compile }
// PR c++/5369: Member function of class template as friend
template <class T>
struct S
{
int foo () {
return S<int>::bar ();
}
private:
template <class U>
friend int S<U>::foo ();
static int bar () { return 0; }
};
int main ()
{
S<char>().foo ();
}
|
google
|
chromium
|
redecl2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/redecl2.C
| 284 |
utf_8
|
8c26da9476ca0b8d2908af7ab2348832
|
// { dg-do compile }
// PR c++/14428: Redeclaration of class template with wrong
// non-type template parameter.
template <int i> struct X; // { dg-error "template parameter" }
template <int* p> struct X; // { dg-error "redeclared here" }
|
google
|
chromium
|
qualttp2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp2.C
| 322 |
utf_8
|
e1b6f19153852a341aae2955eb8ea280
|
// { dg-do compile }
struct A
{
template <class T> class B {};
};
template <int i> struct X
{
};
template <class T> struct C
{
X<T::template B> x; // { dg-error "type" }
};
int main()
{
C<A> c;
}
|
google
|
chromium
|
error24
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error24.C
| 113 |
utf_8
|
6c54776e760954055280860b689859b0
|
// PR c++/30863
template <typename T>
struct s {};
void f() {
unsigned s<int> x; // { dg-error "invalid" }
}
|
google
|
chromium
|
using13
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/using13.C
| 166 |
utf_8
|
acded0229c96d99f990ffa1d7bc1d123
|
//PR c++/28051
template<int> struct A {};
template<int N> struct B : A<N>
{
using A<N>::operator typename A<N>::X; // { dg-error "no type named" }
};
B<0> b;
|
google
|
chromium
|
static22
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static22.C
| 157 |
utf_8
|
bae55093a55e080f11929eea52536a38
|
// PR c++/26266
template<typename> struct A
{
static const int i = 1;
static const int j = i;
static const int k = int(j);
int x[k];
};
A<char> a;
|
google
|
chromium
|
qual1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qual1.C
| 335 |
utf_8
|
5512deff68cfd95af05439dc39d36f5c
|
// { dg-do compile }
template<class T>
class Link_array
{
public:
void sort (int (*compare) (T *const&,T *const&));
};
int shift_compare (int *const &, int *const &) {}
template<class T> void
Link_array<T>::sort (int (*compare) (T *const&,T *const&))
{
}
void f ()
{
Link_array<int> clashes;
clashes.sort (shift_compare);
}
|
google
|
chromium
|
crash68
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash68.C
| 328 |
utf_8
|
c1f00d9dd86a49d2de34225f9a691ce2
|
// PR c++/33035
template<class A>
struct a {
template<class B>
struct b {
template<class C>
void f()
{
struct g
{
~g() {}
};
}
};
};
|
google
|
chromium
|
defarg7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/defarg7.C
| 188 |
utf_8
|
8fdfe04193de5eb0eac57ce398f4c5ec
|
// PR c++/25337
template <typename T> T& MakeT();
template <typename U, int N = sizeof (MakeT<U>().operator[](0))>
struct helper{};
template <typename U>
static char is_here(helper<U>*);
|
google
|
chromium
|
wrap1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/wrap1.C
| 553 |
utf_8
|
577a7a4f76f06bf7384ad303d275f983
|
// { dg-do compile }
// instance of an actual pattern in 252.eon from SPEC2000
// The last Wrapper<char> once wasn't completed when applying '='.
template <class T>
class Wrapper {
public:
Wrapper (T& a);
Wrapper (const Wrapper<char>& ref);
};
template <class T>
class Element {
public:
T * operator[](int x);
};
void test()
{
char bla = 42;
Element< Wrapper <unsigned char> > elem;
elem[1][1] = Wrapper<char> (bla);
}
|
google
|
chromium
|
error10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error10.C
| 1,375 |
utf_8
|
a5aedd671af7a8cdd7d4e6c0bc538ee6
|
// { dg-do compile }
// { dg-options "-std=gnu++98" }
// Origin: <tilps at hotmail dot com>
// c++/9154: poor error message for ">>" vs "> >" in template argument list
/*
* Test that the error message is issued properly
*/
template <class T>
class A {};
A<A<int>> blah; // { dg-error "should be '> >' within" }
A<int>> blah2; // { dg-error "spurious '>>'" }
/*
* Test that a few valid constructs containing a ">>" token in a
* template argument list are handled correctly.
*/
template <int N>
void B(void) {}
int Btest()
{
B<256 >> 4>();
}
template <int N = 123>>4>
struct C {};
template <int> struct D {};
template <typename> struct E {};
E<D< 1>>2 > > E1;
const int x = 0;
E<D< 1>>x > > E2;
template <int> struct F {
typedef int I;
};
template <typename T = F< 1>>2 >::I>
struct G {};
/*
* In this special case, a valid type-id (H() is a function type) is followed
* by '>>', but the argument should still be parsed as an expression, which
* will then be rejected as non-constant expression.
*/
struct H
{
int operator >>(int);
};
template <int V> struct L {};
L<H() >> 5> l; // { dg-error "" "non-constant" }
/*
* This case used to not emit the nice error message because of a typo
* in the code.
*/
template <void (*)(void)>
struct K {};
void KFunc(void);
A<K<&KFunc>> k1; // { dg-error "" }
K<&KFunc>> k2; // { dg-error "" }
|
google
|
chromium
|
defarg9
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/defarg9.C
| 257 |
utf_8
|
bbc0cedc0c23e5084b73fd2bd7d12be0
|
// PR c++/28048
template<typename T> struct Boom;
template<typename T, bool D = Boom<T>::Internal::Value> // <--ICE
struct Foo
{
};
template<typename T> struct Boom
{
struct Internal
{
static const bool Value = false;
};
};
|
google
|
chromium
|
ptrmem18
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ptrmem18.C
| 606 |
utf_8
|
c29b186e715b166abc3703fea2205647
|
// PR c++/33616
// { dg-do run }
// { dg-options "-O2" }
extern "C" void abort ();
struct S {
int c;
S () : c (0) {}
virtual void f1 () { c += 1; }
virtual void f2 () { c += 16; }
};
struct T {
S s;
};
typedef void (S::*Q) ();
template <Q P>
void test1 (T *t)
{
(t->s.*P)();
}
template <Q P>
void test2 (T *t)
{
S &s = t->s;
(s.*P)();
}
int
main ()
{
T t;
test1 <&S::f1> (&t);
if (t.s.c != 1)
abort ();
test1 <&S::f2> (&t);
if (t.s.c != 17)
abort ();
test2 <&S::f1> (&t);
if (t.s.c != 18)
abort ();
test2 <&S::f2> (&t);
if (t.s.c != 34)
abort ();
}
|
google
|
chromium
|
spec4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec4.C
| 291 |
utf_8
|
2a1077a58e27e49e8f92e9122c330685
|
// { dg-do compile }
// PR c++/2863
// Default function argument and template specialization.
struct X {
template <int dim> void f(int=0);
};
template <> void X::f<1> () {} // { dg-error "(not match|declaration)" }
|
google
|
chromium
|
overload7
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/overload7.C
| 535 |
utf_8
|
d98c22f6d2dfeb8d0131c9e0467d2655
|
// { dg-do run }
struct A
{
virtual int Foo () { return 1; }
};
struct B : public A
{
virtual int Foo () { return 2; }
};
template <class T>
int Bar (T *a)
{
if (static_cast<A*>(a)->A::Foo () != 1)
return 1;
if (static_cast<A*>(a)->Foo () != 2)
return 2;
return 0;
}
int main ()
{
return Bar (new B);
}
|
google
|
chromium
|
conv5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/conv5.C
| 386 |
utf_8
|
65388659b6ed4f0befbd55edf3402b26
|
// { dg-do compile }
// PR 764. Failed to find friend in overload resolution
template <class T>
struct S
{
friend bool operator== (const S&, const S&) {
return true;
}
};
int main ()
{
// S<int> s;
const S<int> *p = 0;
*p == *p; // error
}
|
google
|
chromium
|
crash79
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash79.C
| 144 |
utf_8
|
76687bbc8d545fc7d2a44561dca5fdb4
|
// PR c++/36404
struct A
{
A(int);
template<int> enum { e }; // { dg-error "template|expected" }
}; // { dg-error "expected" }
A a(A::e);
|
google
|
chromium
|
anon3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/anon3.C
| 217 |
utf_8
|
fb2e00c0df67ca0bdb82db579b06a881
|
// PR c++/28370
// { dg-do run }
namespace
{
template<typename T> struct A { static int *a; };
template<typename T> int *A<T>::a = 0;
}
int *
foo ()
{
return A<int>::a;
}
int
main ()
{
return foo() != 0;
}
|
google
|
chromium
|
crash33
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash33.C
| 113 |
utf_8
|
204eff887d15d36069d7065b01240cf5
|
// PR c++/19253
namespace N {}
template<typename> struct A
{
A<typename N::X<int> > a; // { dg-error "" }
};
|
google
|
chromium
|
ptrmem19
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ptrmem19.C
| 295 |
utf_8
|
0560572d5223bb42d46f697f052023bb
|
// PR c++/40780
// { dg-do compile }
template <class T1, typename T2, typename T3>
struct A
{
typedef T2 (T1::*m) (T3);
A (m) {}
};
struct B;
struct C
{
void foo (B *);
};
typedef A <C, void, B *> D;
typedef void (C::*E) (B *);
struct F;
typedef void (C::*G) (F);
D d ((E) (G) & C::foo);
|
google
|
chromium
|
typename3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typename3.C
| 119 |
utf_8
|
baaa577db3fc32c6dd18e8cfa76705eb
|
// { dg-do compile }
// crash test - PR 7266
template <class A>
struct B {
typedef A::C::D E; // { dg-error "" }
};
|
google
|
chromium
|
crash28
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash28.C
| 132 |
utf_8
|
902d626992584b53e5dc2b44257c55a4
|
// PR c++/18445
struct a
{
int what();
};
void g(void*);
template<class T>
void f()
{
a ex;
g(ex.what); // { dg-error "" }
}
|
google
|
chromium
|
sizeof10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sizeof10.C
| 125 |
utf_8
|
c3dde08186236701373c41bd64c9338e
|
// PR c++/23357
template<typename T> bool foo()
{
const long int i = sizeof(T) > 1 ? sizeof(T) : 0;
return i > 0;
}
|
google
|
chromium
|
access8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access8.C
| 341 |
utf_8
|
51a27bac3d6d8fa430db3b405c07c5af
|
// { dg-do compile }
// Template instantiate during deferred access check
template <class T> struct C {
typedef typename T::X Y;
};
class A {
typedef int X;
template <class T> friend struct C;
};
C<A>::Y f(int);
|
google
|
chromium
|
crash22
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash22.C
| 512 |
utf_8
|
1a93146cc62f110f6b65fd8e3eb06d85
|
// { dg-do compile }
// PR c++/16706: Dependent type calculation during access checking
template<typename> struct A
{
A();
template<typename> struct X {};
};
template<typename T> struct B
{
typename A<T>::template X<int> x;
template<typename> struct C;
};
template<typename T> template<typename U> struct B<T>::C<U*>
{
C() {}
A<int> a;
};
template struct B<int>::C<int*>;
|
google
|
chromium
|
typedef23
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typedef23.C
| 303 |
utf_8
|
a2356f34f02acc6500996b77569f619f
|
// Origin PR c++/42069
// { dg-do compile }
struct A
{
static const int N = 0;
};
template<int> struct B {};
template<typename T, int>
struct C
{
typedef T U;
B<U::N> b;
};
template<typename T>
struct C<T*, 0>
{
B<T::N> b;
};
C<A*, 0> c;
|
google
|
chromium
|
crash82
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash82.C
| 106 |
utf_8
|
48025659900eff63e716215d6ceef06e
|
// PR c++/37649
struct A
{
template<int> struct {}; // { dg-error "template class without a name" }
};
|
google
|
chromium
|
anon2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/anon2.C
| 327 |
utf_8
|
989ad07a7ee0d8ab918018598ad338ab
|
// PR c++/28279
// finish_static_data_member_decl was confused by the anonymous
// namespace causing TREE_PUBLIC to be unset
template<typename T>
struct is_pointer_impl {
static const bool value = true;
};
namespace {
class prefix_name_mapper {};
}
static const bool val = is_pointer_impl<prefix_name_mapper>::value;
|
google
|
chromium
|
error23
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error23.C
| 229 |
utf_8
|
b4c360f4d0cd0589e95ae87a4d8e500e
|
// PR c++/29632
struct nullptr_type {
nullptr_type ( void ) {}
template < typename T >
operator T* ( void ) const {
return ( 0 );
}
} const nullptr;
int main ( void ) {
0 == nullptr; // { dg-error "match" }
}
|
google
|
chromium
|
unify4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/unify4.C
| 435 |
utf_8
|
feb3d3e768d415765fa75c15289189a8
|
// { dg-do compile }
// PR 9437. We'd unify 'T *' with 'U C::*', which is obviously broken
struct X
{
template <typename T>
operator T* () const { return static_cast<T*> (0); }
} null;
struct A { int i; };
static void f (int A::* pmi) { }
int main () { f (null); } // { dg-error "cannot convert" "" }
|
google
|
chromium
|
type2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/type2.C
| 346 |
utf_8
|
7bd261d29e895f70198d2995a62cbd35
|
// { dg-do compile }
// PR c++/8442
// Type template parameter incorrectly treated as template template
// parameter.
template <typename T> struct A {};
template <typename T> struct B
{
template <typename U> struct C {};
template <typename U> A<C<U> > foo(U);
};
B<void> b;
|
google
|
chromium
|
friend3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend3.C
| 520 |
utf_8
|
d4c8a44deef0bfb76c6964c75b741416
|
// { dg-do compile }
// PR 775 friend classes with qualified names inside template classes.
struct A
{
struct B {
B () { }
};
};
template <class T>
struct C: A {
friend A::B::B (); // 2.95.2 ICE
friend struct A;
friend struct A::B; // 2.97 error
};
template class C<char>;
template <typename T> class TPL
{
class nested;
};
template <typename T> class TPL<T>::nested
{
};
|
google
|
chromium
|
dependent-name2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/dependent-name2.C
| 359 |
utf_8
|
18d61b100652dfe4816b8b9c6cefa923
|
// { dg-do compile }
// PR 10530. Thought a type was dependent.
template <typename T>
struct Foo {
struct Inner {
typedef int type;
};
};
template <typename A> struct Bar {
typedef typename Foo<int>::Inner::type type;
};
|
google
|
chromium
|
new3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/new3.C
| 268 |
utf_8
|
50c39919581c9fbbef2a6c41a57ff89e
|
extern void *operator new(__SIZE_TYPE__); // { dg-message "candidate" }
template <class T >
struct C
{
void f() {
int* node;
new (&node) int(0); // { dg-error "new" }
}
};
void* operator new(__SIZE_TYPE__, void* __p);
void g() {
C<int> c;
c.f();
}
|
google
|
chromium
|
non-dependent8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/non-dependent8.C
| 298 |
utf_8
|
663136a11c36aa84d57fc0129b2be73d
|
// { dg-do compile }
// Two-phase name lookup for address of member:
// Detecting error during parsing
struct S
{
char i;
};
template<int S::*p>
struct X
{};
template <class T>
struct Foo
{
X<&S::i> x; // { dg-error "convert|no type" }
};
|
google
|
chromium
|
ctor3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ctor3.C
| 269 |
utf_8
|
eb5e9f0376abe643c647f3a9d5b69532
|
struct A {};
struct B;
template <class TP> struct X: virtual A {
template <class TP2> X(TP2* ptr) {}
template <class TP2> X(const X<TP2>) {}
};
struct Y : X<B> {
Y(A* a) : X<B>(a) {}
};
void func1(X<B>);
void func2() {
A a;
Y y(&a);
func1(X<A>(&a));
}
|
google
|
chromium
|
anon1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/anon1.C
| 271 |
utf_8
|
0badf7e9336f7d06bd6b5e8cad37e171
|
struct x {
int foo () {}
};
template <class T>
struct vector {
T& bar () {}
};
template <class T>
struct y {
typedef struct {
x t;
} s;
vector<s> array;
int foo ()
{ return array.bar().t.foo(); }
};
int i = y<x>().foo ();
|
google
|
chromium
|
friend26
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend26.C
| 216 |
utf_8
|
6013e213776d77767ad0de2ceddba65f
|
// PR c++/14359
template<typename> struct A {};
template<typename> struct B
{
template<typename T> friend void foo(const A<T>& a, const B&) { a; }
};
void bar()
{
A<void> a;
B<void> b;
foo(a,b);
}
|
google
|
chromium
|
crash65
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash65.C
| 165 |
utf_8
|
0442a3c405a770df830f5c0e3594c438
|
// PR c++/29732
struct A
{
template<int> template<typename T> friend void foo(T) {} // { dg-error "parameter" }
void bar() { foo(0); } // { dg-error "foo" }
};
|
google
|
chromium
|
qualttp10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp10.C
| 292 |
utf_8
|
cf85da2c6ae4bcc2396f5f90e574f5cd
|
// { dg-do compile }
template <template <class> class TT> class C {
};
template <class T> struct D {
template <class U> class B {};
C<D<T>::template B> c;
};
D<int> d;
|
google
|
chromium
|
error15
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error15.C
| 336 |
utf_8
|
5c61ee227ce8d484caf24918cf6fc907
|
// PR c++/16929
template <class T>
class A {
int x;
};
template <class T>
class B {
protected:
A<T> a; // { dg-error "" }
void f(const A<T> * a1 = &a); // { dg-error "this location" }
void g(void);
};
template <class T>
void B<T>::g(void) {
f(); // { dg-error "default argument" }
}
template class B<long>;
|
google
|
chromium
|
ttp25
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp25.C
| 648 |
utf_8
|
5e3a01a7a30fee16dc34f86fca7f25aa
|
// { dg-do compile }
template<typename T, template<T> class C>
void f1(T, C<5>);
template<typename T, template<T> class C>
void f2(C<5>, T);
template<typename T, template<T> class C>
void f3(C<5>, T);
template<typename T> struct metafun { typedef T type; };
template<> struct metafun<short> { typedef int type; };
template<typename T, template<typename metafun<T>::type> class C>
void f4(T, C<5>);
template<int N> struct X {};
void g() {
f1(5l, X<5>()); // { dg-error "no matching" }
f2(X<5>(), 5);
f3(X<5>(), 5l); // { dg-error "no matching" }
f4(5, X<5>());
f4(5l, X<5>()); // { dg-error "no matching" }
f4((short)5, X<5>());
}
|
google
|
chromium
|
memfriend10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memfriend10.C
| 982 |
utf_8
|
88f5f474357358b46b62eb6b6fdc9b8a
|
// { dg-do compile }
// Nested class template of class template as friend
template <class T> struct A
{
template <class U> struct B
{
void f();
};
};
class C {
int i;
template <class T> template <class U> friend struct A<T>::B;
};
template <class T> struct A<T*>
{
template <class U> struct B
{
void f();
};
};
template <> struct A<char>
{
template <class U> struct B
{
void f();
};
};
template <class T> template <class U> void A<T>::B<U>::f()
{
C c;
c.i = 0;
}
template <class T> template <class U> void A<T*>::B<U>::f()
{
C c;
c.i = 0;
}
template <class U> void A<char>::B<U>::f()
{
C c;
c.i = 0;
}
template <> void A<char>::B<int>::f()
{
C c;
c.i = 0;
}
int main()
{
A<int>::B<int> b1;
b1.f();
A<int *>::B<int> b2;
b2.f();
A<char>::B<char> b3;
b3.f();
A<char>::B<int> b4;
b4.f();
}
|
google
|
chromium
|
offsetof1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/offsetof1.C
| 230 |
utf_8
|
0278f61baf9894baa55e08be6e4d1217
|
// { dg-do compile }
// PR c++/17221
#include <cstddef>
template <int N> struct Bar;
template <> struct Bar<3> {};
template <class T>
struct Foo {
Bar<offsetof(T, a) + 3> k;
};
struct A { int a; };
template struct Foo<A>;
|
google
|
chromium
|
crash88
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash88.C
| 84 |
utf_8
|
59238bcb93582e024a0c5cb12c7ab7e1
|
// PR c++/34397
template<typename T, int = T()[0]> struct A
{
typedef A<T> B;
};
|
google
|
chromium
|
ref1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ref1.C
| 110 |
utf_8
|
23d3f217b6bc78941fad8dd51cb41408
|
class a {} a1;
template <a & p> class b { public: b() { static_cast <a &> (p); } };
int main() { b <a1> b1; }
|
google
|
chromium
|
memfriend2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memfriend2.C
| 874 |
utf_8
|
3087e3c10234e9ef3745a413e6043727
|
// { dg-do compile }
// Member function template of class template as friend
template <class T> struct A
{
template <class U> void f();
};
class C {
int i;
template <class T> template <class U> friend void A<T>::f();
};
template <class T> struct A<T*>
{
template <class U> void f();
};
template <> struct A<char>
{
template <class U> void f();
};
template <class T> template <class U> void A<T>::f()
{
C c;
c.i = 0;
}
template <class T> template <class U> void A<T*>::f()
{
C c;
c.i = 0;
}
template <class U> void A<char>::f()
{
C c;
c.i = 0;
}
template <> void A<char>::f<int>()
{
C c;
c.i = 0;
}
int main()
{
A<int> a1;
a1.f<char>();
A<int *> a2;
a2.f<char>();
A<char> a3;
a3.f<char>();
a3.f<int>();
}
|
google
|
chromium
|
array11
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/array11.C
| 462 |
utf_8
|
5c9702e760be4db613f93c64564000c5
|
// { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// PR c++/19208: Fold dependent array domains
template <class C> struct if_t { typedef int type; };
template <class T> struct ffff { static const bool value = true; };
template <class A>
struct bound_member_action
{
typedef char f[ffff<A>::value ? 1 : 2];
template <class CT>
bound_member_action(CT i, typename if_t<f>::type g) {}
};
bound_member_action<int> a(0, 1);
|
google
|
chromium
|
crash37
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash37.C
| 315 |
utf_8
|
83bb0ddc05e27f6cff349794e4edc644
|
// PR c++/21352
struct coperator_stack
{
template<class type>
void push3()
{
}
};
struct helper {};
template<class F>
void bla(F f) // { dg-message "candidates" }
{
}
template <typename ScannerT>
struct definition
{
definition()
{
bla(coperator_stack::push3<helper>); // { dg-error "matching" }
}
};
|
google
|
chromium
|
dependent-name4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/dependent-name4.C
| 349 |
utf_8
|
147338e18276d105fca28005404df2a8
|
// { dg-do compile }
// Dependent arrays of invalid size cause template instantiation failure.
// We'll get an error message (duplicate matching templates) if the first
// pattern is incorrectly allowed to match.
template<int M> void foobar (int (*) [M] = 0 );
template<int M> void foobar ( );
void fn (void)
{
foobar<0>();
foobar<-1>();
}
|
google
|
chromium
|
qualttp4
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp4.C
| 447 |
utf_8
|
2745ef7da3c5773b4c7a4a8a6cb6308f
|
// { dg-do compile }
struct A
{
template <class T> struct B {};
};
template <template <class, class> class TT> // { dg-error "provided" }
struct X
{
TT<int> y; // { dg-error "number" }
};
template <class T> struct C
{
X<T::template B> x; // { dg-error "type" }
};
int main()
{
C<A> c; // { dg-message "instantiated" }
}
|
google
|
chromium
|
error25
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error25.C
| 426 |
utf_8
|
88e5836eca5b1d6a4995747486ad482a
|
// PR c++/31923
template<class T>
static void f1 ();
template<>
static void f1<void> (); // { dg-error "explicit template specialization cannot have a storage class" }
template<class T>
extern void f2 ();
template<>
extern void f2<void> (); // { dg-error "explicit template specialization cannot have a storage class" }
export template<class T> // { dg-warning "keyword 'export' not implemented" }
static void* f3 ();
|
google
|
chromium
|
decl3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/decl3.C
| 131 |
utf_8
|
bc26ef84f5a062823e14f4e50d2e1e8c
|
// c++/32560
namespace N {}
template<typename> struct A
{
int A<typename N::X>; // { dg-error "namespace|argument|before" }
};
|
google
|
chromium
|
access10
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access10.C
| 306 |
utf_8
|
71d21b2797de6268bae8a876a61f64ac
|
// { dg-do compile }
// PR c++/10849: Incorrect access checking on template specialization.
class X {
private:
template <typename T> struct Y;
};
template <> struct X::Y<int> {};
template <typename T> struct X::Y {};
template struct X::Y<int>;
|
google
|
chromium
|
static20
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static20.C
| 378 |
utf_8
|
a86e0443f116a5ab2c8f6e11d42e7473
|
// PR c++/24277
template< int Bits > struct uint_t {
typedef unsigned short fast;
};
template < int Bits > struct mask_uint_t {
typedef typename uint_t< Bits >::fast fast;
static const fast sig_bits = 1;
static const fast sig_bits_fast = fast(sig_bits);
};
template < int Bits> int checksum ( ) {
return 1 & mask_uint_t<Bits>::sig_bits_fast;
}
int i = checksum<1>();
|
google
|
chromium
|
sfinae8
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sfinae8.C
| 7,167 |
utf_8
|
ba8c778672d795dcc90d77c278cd187a
|
// DR 339
//
// Test of the use of various boolean binary operators with SFINAE
// Boilerplate helpers
typedef char yes_type;
struct no_type { char data[2]; };
template<typename T> T create_a();
template<typename T> struct type { };
template<bool, typename T = void> struct enable_if { typedef T type; };
template<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
bool accepts_bool(bool);
#define DEFINE_BINARY_PREDICATE_TRAIT(Name,Op) \
template<typename T, typename U> \
typename enable_if<sizeof(accepts_bool(create_a<T>() Op create_a<U>())), \
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)); \
}
#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 { };
struct convertible_to_bool {
operator int convertible_to_bool::* ();
};
struct not_convertible_to_bool { };
// is_less_than_comparable
DEFINE_BINARY_PREDICATE_TRAIT(is_less_than_comparable,<);
bool operator<(X, X);
convertible_to_bool operator<(X, Y);
not_convertible_to_bool operator<(Y, X);
STATIC_ASSERT((is_less_than_comparable<int>::value));
STATIC_ASSERT((is_less_than_comparable<int, long>::value));
STATIC_ASSERT((is_less_than_comparable<int*>::value));
STATIC_ASSERT((is_less_than_comparable<X>::value));
STATIC_ASSERT((is_less_than_comparable<X, Y>::value));
STATIC_ASSERT((!is_less_than_comparable<Y, X>::value));
STATIC_ASSERT((!is_less_than_comparable<Y>::value));
// is_less_equal_comparable
DEFINE_BINARY_PREDICATE_TRAIT(is_less_equal_comparable,<=);
bool operator<=(X, X);
convertible_to_bool operator<=(X, Y);
not_convertible_to_bool operator<=(Y, X);
STATIC_ASSERT((is_less_equal_comparable<int>::value));
STATIC_ASSERT((is_less_equal_comparable<int, long>::value));
STATIC_ASSERT((is_less_equal_comparable<int*>::value));
STATIC_ASSERT((is_less_equal_comparable<X>::value));
STATIC_ASSERT((is_less_equal_comparable<X, Y>::value));
STATIC_ASSERT((!is_less_equal_comparable<Y, X>::value));
STATIC_ASSERT((!is_less_equal_comparable<Y>::value));
// is_greater_than_comparable
DEFINE_BINARY_PREDICATE_TRAIT(is_greater_than_comparable,>);
bool operator>(X, X);
convertible_to_bool operator>(X, Y);
not_convertible_to_bool operator>(Y, X);
STATIC_ASSERT((is_greater_than_comparable<int>::value));
STATIC_ASSERT((is_greater_than_comparable<int, long>::value));
STATIC_ASSERT((is_greater_than_comparable<int*>::value));
STATIC_ASSERT((is_greater_than_comparable<X>::value));
STATIC_ASSERT((is_greater_than_comparable<X, Y>::value));
STATIC_ASSERT((!is_greater_than_comparable<Y, X>::value));
STATIC_ASSERT((!is_greater_than_comparable<Y>::value));
// is_greater_equal_comparable
DEFINE_BINARY_PREDICATE_TRAIT(is_greater_equal_comparable,>=);
bool operator>=(X, X);
convertible_to_bool operator>=(X, Y);
not_convertible_to_bool operator>=(Y, X);
STATIC_ASSERT((is_greater_equal_comparable<int>::value));
STATIC_ASSERT((is_greater_equal_comparable<int, long>::value));
STATIC_ASSERT((is_greater_equal_comparable<int*>::value));
STATIC_ASSERT((is_greater_equal_comparable<X>::value));
STATIC_ASSERT((is_greater_equal_comparable<X, Y>::value));
STATIC_ASSERT((!is_greater_equal_comparable<Y, X>::value));
STATIC_ASSERT((!is_greater_equal_comparable<Y>::value));
// is_equality_comparable
struct Z : X { };
DEFINE_BINARY_PREDICATE_TRAIT(is_equality_comparable,==);
bool operator==(X, X);
convertible_to_bool operator==(X, Y);
not_convertible_to_bool operator==(Y, X);
STATIC_ASSERT((is_equality_comparable<int>::value));
STATIC_ASSERT((is_equality_comparable<int, long>::value));
STATIC_ASSERT((is_equality_comparable<int*>::value));
STATIC_ASSERT((is_equality_comparable<X>::value));
STATIC_ASSERT((is_equality_comparable<X, Y>::value));
STATIC_ASSERT((!is_equality_comparable<Y, X>::value));
STATIC_ASSERT((!is_equality_comparable<Y>::value));
STATIC_ASSERT((is_equality_comparable<int X::*>::value));
STATIC_ASSERT((!is_equality_comparable<int X::*, int Y::*>::value));
STATIC_ASSERT((is_equality_comparable<int*, float*>::value));
STATIC_ASSERT((is_equality_comparable<X*, Z*>::value));
STATIC_ASSERT((!is_equality_comparable<X*, Y*>::value));
// is_not_equal_comparable
DEFINE_BINARY_PREDICATE_TRAIT(is_not_equal_comparable,!=);
bool operator!=(X, X);
convertible_to_bool operator!=(X, Y);
not_convertible_to_bool operator!=(Y, X);
STATIC_ASSERT((is_not_equal_comparable<int>::value));
STATIC_ASSERT((is_not_equal_comparable<int, long>::value));
STATIC_ASSERT((is_not_equal_comparable<int*>::value));
STATIC_ASSERT((is_not_equal_comparable<X>::value));
STATIC_ASSERT((is_not_equal_comparable<X, Y>::value));
STATIC_ASSERT((!is_not_equal_comparable<Y, X>::value));
STATIC_ASSERT((!is_not_equal_comparable<Y>::value));
STATIC_ASSERT((is_not_equal_comparable<int X::*>::value));
STATIC_ASSERT((!is_not_equal_comparable<int X::*, int Y::*>::value));
STATIC_ASSERT((is_not_equal_comparable<int*, float*>::value));
STATIC_ASSERT((is_not_equal_comparable<X*, Z*>::value));
STATIC_ASSERT((!is_not_equal_comparable<X*, Y*>::value));
// has_logical_and
DEFINE_BINARY_PREDICATE_TRAIT(has_logical_and,&&);
bool operator&&(X, X);
convertible_to_bool operator&&(X, Y);
not_convertible_to_bool operator&&(Y, X);
STATIC_ASSERT((has_logical_and<int>::value));
STATIC_ASSERT((has_logical_and<int, long>::value));
STATIC_ASSERT((has_logical_and<int*>::value));
STATIC_ASSERT((has_logical_and<X>::value));
STATIC_ASSERT((has_logical_and<X, Y>::value));
STATIC_ASSERT((!has_logical_and<Y, X>::value));
STATIC_ASSERT((!has_logical_and<Y>::value));
STATIC_ASSERT((has_logical_and<int X::*>::value));
STATIC_ASSERT((has_logical_and<int X::*, int Y::*>::value));
STATIC_ASSERT((has_logical_and<int*, float*>::value));
STATIC_ASSERT((has_logical_and<X*, Z*>::value));
STATIC_ASSERT((has_logical_and<X*, Y*>::value));
// has_logical_or
DEFINE_BINARY_PREDICATE_TRAIT(has_logical_or,||);
bool operator||(X, X);
convertible_to_bool operator||(X, Y);
not_convertible_to_bool operator||(Y, X);
STATIC_ASSERT((has_logical_or<int>::value));
STATIC_ASSERT((has_logical_or<int, long>::value));
STATIC_ASSERT((has_logical_or<int*>::value));
STATIC_ASSERT((has_logical_or<X>::value));
STATIC_ASSERT((has_logical_or<X, Y>::value));
STATIC_ASSERT((!has_logical_or<Y, X>::value));
STATIC_ASSERT((!has_logical_or<Y>::value));
STATIC_ASSERT((has_logical_or<int X::*>::value));
STATIC_ASSERT((has_logical_or<int X::*, int Y::*>::value));
STATIC_ASSERT((has_logical_or<int*, float*>::value));
STATIC_ASSERT((has_logical_or<X*, Z*>::value));
STATIC_ASSERT((has_logical_or<X*, Y*>::value));
|
google
|
chromium
|
void1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/void1.C
| 98 |
utf_8
|
23655735fa447bdfd2100e025e21ee03
|
// PR c++/27430
// { dg-do compile }
template<void[]> struct A; // { dg-error "array of void" }
|
google
|
chromium
|
error32
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error32.C
| 90 |
utf_8
|
95475caa3d2f02af77559820e82ebb1c
|
// PR c++/33843
struct A {};
void foo(A* p())
{
p->A::~A(); // { dg-error "A::~A" }
}
|
google
|
chromium
|
elab1
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/elab1.C
| 288 |
utf_8
|
318b45c84de8e1474d71ee390dc7b68c
|
// { dg-do compile }
// Elaborate type specifier of class template
template <class T> class A {
class B;
};
template <class T> class A<T>::B {
friend class A;
};
|
google
|
chromium
|
scope2
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/scope2.C
| 534 |
utf_8
|
e98caaa9887061e13fd115d5af2dd146
|
// { dg-do compile }
// checked instantiated bases in wrong scope.
class Helper {};
template<class T> struct X { };
template<class T> class Base
{
protected:
typedef Helper H;
};
template<class T >
struct Derived : Base<T>
{
typedef Base<T> Parent;
typedef typename Parent::H H;
class Nested : public X<H> {};
Nested m;
void Foo ();
};
void Foo (Derived<char> &x)
{
x.Foo ();
}
|
google
|
chromium
|
spec35
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec35.C
| 838 |
utf_8
|
727f8f63a8b88495ab866b70455ef74e
|
// PR c++/31923
// C++ DR 605 -- "...the linkage of an explicit specialization must be that of
// the template."
// { dg-require-weak "" }
// { dg-do compile { target i?86-*-* x86_64-*-* } }
template<class T>
static void f1 (T) { }
// { dg-final { scan-assembler-not ".glob(a|)l\[\t \]*_?_Z2f1IfEvT_" } }
template<>
void f1<float> (float) { } // Expected to have static linkage
template<class T>
void f2 (T) { }
// { dg-final { scan-assembler ".glob(a|)l\[\t \]*_?_Z2f2IfEvT_" } }
template<>
void f2<float> (float) { } // Expected to have global linkage
void instantiator ()
{
// { dg-final { scan-assembler-not ".glob(a|)l\[\t \]*_?_Z2f1IiEvT_" } }
f1(0); // Expected to have static linkage
// { dg-final { scan-assembler ".weak(_definition)?\[\t \]*_?_Z2f2IiEvT_" } }
f2(0); // Expected to have weak global linkage
}
|
google
|
chromium
|
crash75
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash75.C
| 130 |
utf_8
|
3f3886cb6cade0a026bbcff85e44887b
|
// PR c++/34776
template<typename T> struct A
{
T::X<0> x; // { dg-error "non-template|T::template|base type" }
};
A<int*> a;
|
google
|
chromium
|
array21
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/array21.C
| 920 |
utf_8
|
00136c7ca590bf08c5e9d3fa200ab503
|
// PR c++/42447
template<int>
void* get(int);
template<typename>
struct unique_ptr;
template<typename _Tp>
struct unique_ptr<_Tp[]>
{
typedef int __tuple_type;
void*
get() const
{ return ::get<0>(_M_t); }
__tuple_type _M_t;
};
template <typename T> class dynamic_dispatch;
template <typename TC>
struct dynamic_dispatch<void (TC::*)(int&)>
{
struct entry { };
unique_ptr<entry[]> m_Start;
template <typename UC>
void attach_handler(void (UC::*m)(int&))
{
entry* p = 0;
do {
} while(--p != m_Start.get());
}
};
template <typename TC>
class request_dispatcher
: private dynamic_dispatch<void (TC::*)(int&)>
{ request_dispatcher(); };
struct file_reader
{
void execute_command(int&);
};
template <>
request_dispatcher<file_reader>::request_dispatcher()
{ this->attach_handler(&file_reader::execute_command); }
|
google
|
chromium
|
crash74
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash74.C
| 168 |
utf_8
|
09d3303991504ae057667a46bb5c6899
|
// PR c++/34089
// { dg-do compile }
// { dg-options "" }
template<typename F> void foo () { }
template<typename F> struct foo<F> { }; // { dg-error "redeclared as" }
|
google
|
chromium
|
overload3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/overload3.C
| 179 |
utf_8
|
98ebf130b836485f9a7ceae171151be5
|
// PR c++/16870
struct A
{
int operator[](int) const;
};
template<int> A foo();
A bar(A(*)());
template<int> int baz() { return (bar(&foo<0>))[0]; }
template int baz<0>();
|
google
|
chromium
|
sfinae5
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sfinae5.C
| 964 |
utf_8
|
d489a85672b2d956beff65b15b095039
|
// DR 339
//
// Test of the use of member functions with SFINAE
typedef char yes_type;
struct no_type { char data[2]; };
template<typename T> T create_a();
template<bool, typename T = void> struct enable_if { typedef T type; };
template<typename T> struct enable_if<false, T> { };
template<typename T>
typename enable_if<(sizeof(create_a<T>().foo(), 1) > 0),
yes_type>::type
check_has_member_foo(const volatile T&);
no_type check_has_member_foo(...);
template<typename T>
struct has_foo
{
static const bool value =
(sizeof(check_has_member_foo(create_a<T const&>())) == sizeof(yes_type));
};
struct X { };
struct Y {
void foo();
};
struct Z {
void foo(int);
};
struct A {
int foo;
};
struct B {
static int foo();
};
int a1[has_foo<X>::value? -1 : 1];
int a2[has_foo<Y>::value? 1 : -1];
int a3[has_foo<Z>::value? -1 : 1];
int a4[has_foo<int>::value? -1 : 1];
int a5[has_foo<A>::value? -1 : 1];
int a6[has_foo<B>::value? 1 : -1];
|
google
|
chromium
|
koenig3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/koenig3.C
| 316 |
utf_8
|
84d2678d3ce8241c254dd0501f0e4816
|
// PR c++/13157
namespace aa
{
double abs(double);
long double abs(long double);
}
namespace fu
{
template <class T>
struct X
{};
template <class T>
X<T> test(X<T> x)
{
using ::aa::abs;
return abs(x);
}
template <class T>
X<T> abs(X<T>);
X<int> x;
X<int> z = test(x);
}
|
google
|
chromium
|
partial3
|
.C
|
native_client/nacl-gcc/gcc/testsuite/g++.dg/template/partial3.C
| 370 |
utf_8
|
629ba41b72a6f4a573aa2b2fc66bf5c8
|
// { dg-do compile }
// Origin: John Maddock <john at johnmaddock dot co dot uk>
// PR c++/13997: Error while matching partial specialization of array type
template <typename T>
struct is_array;
template <typename T, unsigned int N>
struct is_array<T[N]>;
template <typename T, unsigned int N>
struct is_array<const T[N]> {};
template struct is_array<int const[2]>;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.