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 | new2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/new2.C | 198 | utf_8 | b8243d46589815a568bb0992cb04adec | // PR c++/21336
typedef __SIZE_TYPE__ size_t;
template<class _T> void* operator new( size_t Size, _T&);
struct B {
int a;
int* m() {
return new(a) int;
}
};
B* n() {
return new B();
}
|
google | chromium | sfinae13 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sfinae13.C | 3,343 | utf_8 | fd186f6ad5502f92e5c2137c6fc41c9a | // DR 339
//
// Test of the use of casts 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<f... |
google | chromium | deduce1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/deduce1.C | 413 | utf_8 | a1ee69de58a5087bc0a5772d3b7f8309 | // { dg-do run }
template <typename T> int Foo (T const *)
{
return 1;
}
template <typename T> int Foo (T const &)
{
return 2;
}
template <typename T, __SIZE_TYPE__ I> int Foo (T const (&ref)[I])
{
return 0;
}
int main ()
{
static int array[4] = {};
return Foo (array);
} |
google | chromium | non-dependent11 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/non-dependent11.C | 453 | utf_8 | 6f26c028ea69c4705c77b4a0544f848d | // { dg-do compile }
template<int> struct I {
int o ();
int o () const;
};
template <int> void bar (void) {
foo <int, I<1> > (&I<1>::o);
} |
google | chromium | new4 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/new4.C | 164 | utf_8 | ee60767832489389f13d0474ac598f82 | // PR c++/27559
// { dg-do compile }
struct A
{
template<typename T>
static void* operator new(T) {} // { dg-error "first parameter|invalid template" }
};
|
google | chromium | qualttp1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp1.C | 324 | utf_8 | b21ab1ce79ce2d2e11762d15de7d8e95 | // { dg-do compile }
struct A
{
template <class T> class B {};
};
template <class T> struct X
{
};
template <class T> struct C
{
X<T::template B> x; // { dg-error "type" }
};
int main()
{
C<A> c;
} |
google | chromium | ptrmem3 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ptrmem3.C | 340 | utf_8 | 171d82f45a76129388539c01e3212ec9 | template <typename T,double (T::*fun)() const>
struct I {
};
struct R {
R() { }
};
class H: public R {
public:
H(): R() { }
double& f() { return a; }
double f() const { return 1.0; }
double a;
};
struct A {
typedef I<H,&H::f> F;
A() { }
}; |
google | chromium | dependent-name3 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/dependent-name3.C | 333 | utf_8 | 0c3e325271a377838c5d47bb6fb94dd1 | // { dg-do compile }
// Dependent arrays of invalid size generate appropriate error messages
template<int I> struct A
{
static const int zero = 0;
static const int minus_one = -1;
};
template<int N> struct B
{
int x[A<N>::zero]; // { dg-error "zero" }
int y[A<N>::minus_one]; // { dg-error "negative" }... |
google | chromium | typename13 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typename13.C | 402 | utf_8 | ca4a61ed1c2da506a98ef392ad06676a | // { dg-do compile }
template <typename T> struct A
{
struct B;
typedef typename B::type type;
};
template <typename T> struct A<T>::B
{
typedef typename A<T>::type type;
type Foo ();
};
template <typename T>
typename A<T>::B::type
A<T>::B::Foo ()
{
return 0;
} |
google | chromium | init4 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/init4.C | 326 | utf_8 | e920cba477d63f2866ea0710ce55a2ce | // { dg-do compile }
int f1(char);
template <int t>
void f(void)
{
const char* const suffixes = "plpv";
f1(suffixes[t]);
} |
google | chromium | static23 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static23.C | 200 | utf_8 | 55ffcdd6cb9d31737ce21132239b5d71 | // PR c++/26266
template<typename> struct A
{
static const int i = 1;
};
template<typename> struct B
{
static const int j = A<char>::i;
static const int k = int(j);
int x[k];
};
B<char> b;
|
google | chromium | canon-type-2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/canon-type-2.C | 327 | utf_8 | 717ead67d335fd7d52dcdbff51945315 | // Origin PR c++/39754
// { dg-do "compile" }
template < typename > struct A ;
template < typename T , typename = A < T > > struct B { } ;
template < class W , class > struct D
{
typedef W X ;
A< X()> a ;
};
template < class Y > struct E
{
B< Y()> b ;
};
E<int> e ; |
google | chromium | static8 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static8.C | 139 | utf_8 | 6dbdfa91bc4e4ea29a3ec7f4b44ba16f | // PR c++/17585
template <void (*p)(void)> struct S03 {};
class C03 {
public:
static void f(void) {}
void g(void) { S03<&f> s03; }
};
|
google | chromium | error3 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error3.C | 113 | utf_8 | 0e96862a75ffea6e3b8357e5251534dd | // PR 12762
template <typename> struct A { A() {}};
typedef A<int> Ac;
Ac<double> a; // { dg-error "template" }
|
google | chromium | crash80 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash80.C | 190 | utf_8 | c9dc4ab7acea171537b7ea2d00500ffa | // PR c++/37087
namespace a {
template <typename T> class Foo;
}
namespace b {
template <> class ::a::Foo<double> {}; // { dg-error "global qualification of class name is invalid" }
}
|
google | chromium | ptrmem5 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ptrmem5.C | 449 | utf_8 | c1d71028a4f69f5c3fcfd2fd8a35f919 | // { dg-do compile }
// PR 10119 (part). We failed to tsubst the args of a template-id-expr
template <class T, void (T::* const U)()> struct Good
{
static int const value = 0;
};
struct A
{
template <typename U> void good ()
{
int s_id = Good<A, &A::good<U> >::value;
}
};
int main()
{
A().good<int>();
} |
google | chromium | access5 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access5.C | 417 | utf_8 | 043c53bbc7cad60a3c72bfa79987f011 | // { dg-do compile }
// PR c++/7348
// Access control for typename in function return type
class Outer {
template <int dim> struct Inner {
typedef int T;
T foo ();
};
public:
Outer();
};
template <int dim>
typename Outer::Inner<dim>::T Outer::Inner<dim>::foo () {
return 1;
}
template st... |
google | chromium | repo9 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/repo9.C | 1,141 | utf_8 | 9179fff868f0d76d8658fb167ef756e9 | // PR c++/36364
// { dg-options "-frepo" }
// { dg-final { cleanup-repo-files } }
// { dg-require-host-local "" }
template <typename C> struct A
{
static void assign (C &c1, const C &c2) { c1 = c2; }
};
template <typename C, typename T> struct B
{
struct D
{
static const C terminal;
static unsigned long... |
google | chromium | qualttp14 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp14.C | 436 | utf_8 | 872b95cdec1729cec20c4f30444d01c5 | // { dg-do link }
struct A
{
template <class T> class B {};
};
template <template <class> class TT, class T> struct X
{
TT<int> y;
T z;
};
template <class T> struct X<T::template B, T>
{
typename T::template B<int> y;
T z;
};
template <class T> struct C
{
X<T::template B, A> x;
};
int main()
{
C<A> c;
} |
google | chromium | friend18 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend18.C | 377 | utf_8 | c8d90e11af5004983158fb9d1e72ccfc | // { dg-do run }
// PR 10158. implicit inline template friends ICE'd
template <int N> struct X
{
template <int M> friend int foo(X const &)
{
return N * 10000 + M;
}
};
X<1234> bring;
int main() {
return foo<5678> (bring) != 12345678;
} |
google | chromium | memfriend3 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memfriend3.C | 669 | utf_8 | fb47ef062f1c0907f4bd591ea44dd1ea | // { dg-do compile }
// Member function of class template as friend
template<class T> struct A
{
void f(T);
};
class C {
int i;
template<class T> friend void A<T>::f(T);
};
template<class T> struct A<T*>
{
void f(T*);
};
template<> struct A<char>
{
void f(char);
};
template<class T> void A<T>::f(T)
{
C c;
... |
google | chromium | pseudodtor3 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/pseudodtor3.C | 677 | utf_8 | a4f0590114aea315ae757507b2d7eab4 | // PR c++/32241
// { dg-do compile }
struct A
{
typedef int T;
T &foo ();
A () { foo.~T (); } // { dg-error "does not have class type|expected" }
};
template <typename T> struct B
{
T &foo ();
B () { foo.~T (); } // { dg-error "invalid use of member" }
};
B<int> b;
template <typename T, typename S> struct... |
google | chromium | access4 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access4.C | 354 | utf_8 | 7ea6af968e54287945d17d2352e36fd6 | // { dg-do compile }
// PR c++/7347
// Access control for typename during instantiation
template <int dim> class Base {
protected:
typedef int T;
};
template <int dim> class D : public Base<dim> {
public:
typedef typename Base<dim>::T T1;
D (T1 t);
};
D<2> d(1); |
google | chromium | char1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/char1.C | 95 | utf_8 | a8067ac68b36a7f6b81ed3e72bd5d218 | template <class CharType, CharType line_terminator = 0>
class String {};
String<char, 255> s;
|
google | chromium | static28 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static28.C | 215 | utf_8 | 3f4fc4769c54c1f623ff36f774008e54 | // PR c++/29518
template< bool C > int assertion_failed( int);
template< class >
struct N
{
static bool const okay = true;
enum {
t = sizeof( assertion_failed<okay>( 0))
};
};
int main()
{
N<int> n;
}
|
google | chromium | nontype4 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nontype4.C | 341 | utf_8 | f725d274103ab74a7c16aa6087ab401f | // { dg-do compile }
// PR c++/13797: ICE invalid nontype template parameter
template <int> struct A
{
typedef A<0> B; // { dg-error "previous declaration" }
template <B> struct B {}; // { dg-error "not a valid type|typedef" }
};
A<0> a; |
google | chromium | eh1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/eh1.C | 59 | utf_8 | 9c78ecb5ca87b2a81cbd9c1796b2c13e | template <class T>
void foo()
{
try {}
catch(T e) {}
}
|
google | chromium | sfinae12 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/sfinae12.C | 1,504 | utf_8 | 52f7c4200182090df187eb901e5e01fe | // DR 339
//
// Test of the use of the ternary 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> str... |
google | chromium | access19 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access19.C | 551 | utf_8 | 632a853ba7c56a24f2a12cffcf689f45 | /* PR c++/29475 The error diagnostic contained "U = U" instead of "U = char" */
/* { dg-do "compile" } */
template< class T >
class explicit_t
{
public:
explicit_t( const T& c ): value( c ) { }
operator T&() { return value; }
private:
template< class U >
explicit_t( U t ); /*... |
google | chromium | spec28 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec28.C | 180 | utf_8 | d7344703a351e2d4d50cf9f8383b2013 | // PR c++/25854
// Bad diagnostic
// { dg-do compile }
template<typename> struct A {}; // { dg-error "provided" }
template<> struct A<> {}; // { dg-error "wrong number" }
|
google | chromium | spec5 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec5.C | 85 | utf_8 | ac4700345bbf0d5aafda66965305864b | template <int i> struct A;
template <> struct A<0> { struct B; };
struct A<0>::B {};
|
google | chromium | static2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static2.C | 153 | utf_8 | aa3092ca5ce677694305032fa51a9486 | class A;
template<int A::* P>
class B
{
public:
static int A::* const p = P; // { dg-error "" }
};
class A
{
public:
int dummy;
B<&A::dummy> d;
};
|
google | chromium | mem-partial2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/mem-partial2.C | 512 | utf_8 | ddb3b643353af64559b17335859b3a54 | // PR c++/14032
// { dg-do run }
template <bool compare>
struct outer
{
template <bool compare_with,bool second>
struct inner // unspecialized compare != compare_with
{
static inline bool test()
{
return false;
}
};
template <bool second> // specialization compare == compare_with
... |
google | chromium | arg4 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/arg4.C | 109 | utf_8 | c306ff6eb2399c47b955c0f32952ba01 | // PR c++/23437
template <void (*p)()> struct S {
static const int i = 10;
};
void g();
int a[S<g>::i];
|
google | chromium | static9 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static9.C | 218 | utf_8 | 61df0aabe51e412ae0347dc4fa36408f | // PR c++/17524
template<typename T> struct A
{
static const T i = 0; // { dg-error "declared void" "void" }
// { dg-error "invalid" "invalid" { target *-*-* } 5 }
};
A<void> a; // { dg-message "instantiated" }
|
google | chromium | void3 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/void3.C | 133 | utf_8 | 30d3ef85884811b1e84895da90d2a724 | //PR c++/28637
template<void> struct A {}; // { dg-error "not a valid type" }
A<0> a; // { dg-error "type" }
|
google | chromium | error6 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error6.C | 193 | utf_8 | 8f931fa8690071fcefc2b1d1d7483bfc | template<int n>
struct tento {
enum {value = 10*tento<n-1>::value};
};
struct tento<0> { // { dg-error "" }
enum {value=1};
};
int main() {
if (tento<4>::value != 10000) return -1;
}
|
google | chromium | nontype10 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nontype10.C | 219 | utf_8 | c2cc8082649ad5953b27efb310d1929e | // { dg-do compile }
// Contributed by: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
#include <cstddef>
template <int T> struct A {};
template <void* T> struct B {};
A<NULL> a;
B<NULL> b; // { dg-error "" }
|
google | chromium | static5 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static5.C | 318 | utf_8 | e5538275a590133055e80d957d76fab1 | // { dg-do compile }
// PR c++/12932: ICE address of static function as template argument
struct Test {
static void fun();
};
template <void (*fun)()>
void foo () { (*fun)(); }
template
void foo<Test::fun> (); |
google | chromium | static3 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static3.C | 469 | utf_8 | 7df73f11db0cd12460178945538e192f | template <class data> class foo
{
public:
static const int a;
static const int b;
static const int c;
static const int d;
};
template <class data> const int foo<data>::a = 1;
template <class data> const int foo<data>::b = a;
template <class data> const int foo<data>::c = b;
template <class data> const int foo<... |
google | chromium | class3 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/class3.C | 81 | utf_8 | 478acfe8108cf9d573a8ff95d3dcf91d | // PR c++/25634
template<int> template<int> struct A; // { dg-error "too many" }
|
google | chromium | crash77 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash77.C | 166 | utf_8 | f24a600e43d06d3cdd9d3eca14cb1abc | // PR c++/34603
template<typename> struct A; // { dg-error "declaration" }
template<typename T> A<T>::A( struct A; // { dg-error "definition|expected|incomplete" }
|
google | chromium | repo7 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/repo7.C | 304 | utf_8 | 3b611a23b9613ee9803351135487ed59 | // PR c++/34340
// { dg-options "-frepo" }
// { dg-final { cleanup-repo-files } }
// { dg-require-host-local "" }
struct A
{
int a;
};
template <typename T> struct D
{
static const A b;
};
template<typename T> const A D<T>::b = { 2 };
template class D<A>;
const A *x = &D<A>::b;
int
main ()
{
}
|
google | chromium | crash32 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash32.C | 204 | utf_8 | b17b6f8116ba3725c4d80f6dcdfb1f41 | // PR c++/19667
struct integral_constant { };
template<typename _Tp>
struct is_function : public integral_constant { };
template<>
struct is_function : public integral_constant { }; // { dg-error "" }
|
google | chromium | explicit7 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/explicit7.C | 312 | utf_8 | 9710691c4af4b589e4831b829d124e2e | // PR c++/22263
// { dg-do link }
template <class T> struct S { T foo (); T bar (); };
template <class T> T S<T>::foo () { return bar (); }
template struct S<int>;
template <class T> T S<T>::bar () { return T (); }
#if !__GXX_WEAK__
template int S<int>::bar ();
#endif
int main () { return S<int>().foo (); }
|
google | chromium | using3 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/using3.C | 607 | utf_8 | 2131f7be9d523457118116995b368d74 | // { dg-do run }
// PR 9447. Using decls in template classes.
template <class T>
struct Foo {
int i (int) {return 1;}
};
struct Baz
{
int k (int) {return 2;}
};
template <class T>
struct Bar : public Foo<T> , Baz {
using Foo<T>::i;
using Baz::k;
int i (float) {return 3;}
int k (float) {return 3;}
int ... |
google | chromium | error11 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error11.C | 109 | utf_8 | 92cc57f022fdde0a0e1d5b1eb3c129b3 | // PR c++/12132
inline template <int> void foo () {} // { dg-error "<" }
void abort (); // { dg-error ";" }
|
google | chromium | ptrmem7 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ptrmem7.C | 447 | utf_8 | 71bf635a4274ef3549d8487b25847e94 | // { dg-do compile }
// Origin: <togawa at acm dot arg>
// c++/2094: unsupported 'ptrmem_cst' in type unification
struct R
{
int i;
};
struct S
{
int i;
int j;
};
struct S2 : S
{};
template<int S::*p, typename>
struct X
{
X ();
template<typename U> X(const X<p,U> &);
};
X<&S::i,S> x = X<&S::i,S>();
X<&S... |
google | chromium | overload8 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/overload8.C | 90 | utf_8 | cb3fd3ad47dd95cf7f0463be80d0a9b3 | // PR c++/24915
struct A
{
template<int> void foo() {}
template<int> int foo() {}
};
|
google | chromium | memfriend9 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memfriend9.C | 716 | utf_8 | 6602e9e6cba784386891556ebd44b430 | // { dg-do compile }
// Nested class of class template as friend
template<class T> struct A
{
struct B
{
void f();
};
};
class C {
int i;
template<class T> friend struct A<T>::B;
};
template<class T> struct A<T*>
{
struct B
{
void f();
};
};
template<> struct A<char>
{
struct B
{
void f(... |
google | chromium | ttp11 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp11.C | 335 | utf_8 | 7bb81c37796ee57799e21215b653e144 | // { dg-do compile }
// PR c++/14429: Matching of template template parameter containing
// non-type parameter with type that depends on earlier parameter.
template <template <typename U, U* p> class T>
struct X {};
template <template <typename U, U* p> class T>
struct Y {
X<T> x;
}; |
google | chromium | ttp12 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp12.C | 472 | utf_8 | 40c193a789a7cdd7cf2b6550ea810505 | // { dg-do compile }
// Check the type of non-type parameter in template template parameter
// only if it is dependent.
template <template <int* p> class T>
struct X {};
template <typename U, template <U* p> class T>
struct Y {
X<T> x;
};
template <int* p> struct Z {};
Y<int, Z> y1;
Y<char, Z> y2; // { dg-error "m... |
google | chromium | nontype8 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/nontype8.C | 439 | utf_8 | 2db8591db13ac8e8cf2e26468f9d18e3 | // { dg-do compile }
// Origin: C++ standard, [temp.arg.nontype]/3
template<int* p> class X { };
int a[10];
struct S { int m; static int s; } s;
X<&a[2]> x3; // { dg-error "" } address of array element
X<&s.m> x4; // { dg-error "" } address of non-static member
X<&s.s> x5; ... |
google | chromium | array7 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/array7.C | 175 | utf_8 | 579905889abdf110f78879708a88d557 | // PR c++/16246
template <typename T> void foo (T, T);
template <unsigned N, unsigned M>
int bar( const char(&val)[M] )
{
foo (N,M);
}
int i = bar<10>("1234");
|
google | chromium | static21 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static21.C | 392 | utf_8 | 2f60676fe6640df70e647dc7565eebca | // PR c++/24389
// { dg-additional-sources "static21-a.cc" }
// { dg-do link }
template<int dummy>
struct X
{
static const int n_primes = 256;
static const unsigned long primes[n_primes + 1];
};
template<int dummy>
const int X<dummy>::n_primes;
template<int dummy>
const unsigned long X<dummy>::primes[n_primes + ... |
google | chromium | non-dependent10 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/non-dependent10.C | 342 | utf_8 | ac32a3394ac7dad60204cd2cccb6ba46 | // { dg-do compile }
// Two-phase name lookup for address of member:
// Detecting overloading function error during parsing
struct S
{
int f(char);
int f(int);
};
template<int (S::*p)()>
struct X
{};
template <class T>
struct Foo
{
X<&S::f> x; // { dg-error "convert|no type" }
}; |
google | chromium | instantiate11 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/instantiate11.C | 386 | utf_8 | 8095fd8717b385911f23d51f2a4cad60 | // PR c++/42608
// { dg-do compile }
template <class U, class V>
struct A;
template <class V>
struct A<int, V>
{
void f ();
};
template struct A<int, int>;
int
main ()
{
A<int, int> a;
a.f ();
return 0;
}
// Make sure we get undefined reference error if
// A<int, int>::f () isn't instantiated elsewhere.
//... |
google | chromium | arg7 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/arg7.C | 308 | utf_8 | 7e62b14830c51291d78003b50bf7c034 | // PR c++/27425, 34274
template<typename T> struct A
{
template<template<T> class> struct B {}; // { dg-error "void|mismatch|expected" }
// { dg-bogus "not supported" "" { target *-*-* } 5 }
template<T> struct C; // { dg-error "void" }
B<C> b;
};
A<void> a; // { dg-message "instantiated" }
|
google | chromium | incomplete1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/incomplete1.C | 533 | utf_8 | 43017cf348a37638085196f74ac68fe3 | // { dg-do compile }
// Origin: Ivan Godard <igodard at pacbell dot net>
// PR c++/17447: Detect parameters of dependent types even in templates
struct B; // { dg-error "forward declaration" }
template<typename T> struct A {
friend A& operator <<(A& a, B b) { return a; } // { dg-error "incomplete" }
friend ... |
google | chromium | ttp3 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/ttp3.C | 745 | utf_8 | dae42b78445fb03f0f7c80954fe880b4 | // { dg-do compile }
// PR 5213. We failed to spot that class List was a template, rather
// than a non-template or specialization
template <class T> class vector { };
class OUTER {
public:
template <class T>
class List { };
vector<class List> data; // { dg-error "invalid|required|ISO C" "" }
};
template <cl... |
google | chromium | spec26 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec26.C | 762 | utf_8 | db213be2f1542903882424960efec00b | // dg-do run
struct A
{
template<class T> int operator+(T&) { return 1;}
};
template<class T> struct B
{
int operator-(A&) {return 2;}
template<typename R> int operator*(R&) {return 3;}
};
template <typename T, typename R> int operator-(B<T>, R&) {return 4;}
template<class T> int operator+(A&, B<T>&) { return 5... |
google | chromium | crash57 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash57.C | 254 | utf_8 | e8689f24f46b2d103e7556f1cd9fe1e3 | //PR c++/27397
template<int(> struct A; // { dg-error "token" }
template<typename> struct B
{
template<int(> struct C; // { dg-error "token" }
};
A<char> a; // { dg-error "type/value mismatch|constant|declaration" }
|
google | chromium | defarg4 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/defarg4.C | 190 | utf_8 | 64d2588370b2c020d9d5828deadfc7dc | // PR c++/14763
struct A {
int get() const {}
static A *foo();
};
template<bool> struct S {
S(unsigned int = A::foo()->get()) ;
};
void foo() throw() {
S<false> f;
}
|
google | chromium | qualttp21 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/qualttp21.C | 290 | utf_8 | d7668570c380f7a54655435e409395c9 | // { dg-do compile }
template <class A>
class foo {
int _foo;
public:
foo() {}
protected:
~foo() {} // { dg-error "~foo" }
};
int main()
{
foo<int> a; // { dg-error "context" }
} |
google | chromium | template-id-2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/template-id-2.C | 376 | utf_8 | b4bce8b2552e37c82393fd04cfc950dd | // { dg-do compile }
// PR c++/12924
template<typename> struct A {};
template<> struct A<void>
{
template<typename T> void foo()
{
A<T> a;
a.template foo<int>(); // { dg-error "no member" }
}
};
void bar()
{
A<void> a;
a.foo<int>(); // { dg-message "instantiated" }
} |
google | chromium | friend37 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend37.C | 194 | utf_8 | 19ae206b65ef32c57066f4c9d603d478 | // PR c++/22147
template<typename> struct A;
template<typename T> void foo(A<T>* p) { *p; }
template<typename> struct A
{
friend void foo<class X>(A<X>*);
};
void bar()
{
foo<int>(0);
}
|
google | chromium | non-dependent1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/non-dependent1.C | 247 | utf_8 | da1df58fc40e198de8f0c5d88494d89e | //PR c++/8222
// { dg-do run }
struct Foo
{
template <class>
void func() {}
};
template <class>
void Bar(Foo* p)
{
p->func<int>();
}
int main()
{
Foo c;
Bar<int>(&c);
} |
google | chromium | non-type1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/non-type1.C | 911 | utf_8 | c68d85d18e13eca7b98c51e07b278cf0 | // PR c++/4377
template < int I1, int I2 >
class unit
{
public:
typedef unit<I1,I2> my_type;
unit() {}
unit( const unit<I1,I2>& ) {}
template< int Q1, int Q2 >
unit< I1 + Q1, I2 + Q2 > operator * ( const unit< Q1, Q2 >& rhs ) const {
return unit< I1 + Q1, I2 + Q2 >();
}
template< int Q1, int ... |
google | chromium | error21 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error21.C | 244 | utf_8 | d8c534ccbad9bbbc650685d274b0d2ca | // PR c++/20173
template<typename AT>
struct A{
template<typename T>
void function(T){}
};
template<>
template<typename T>
void A<int>::function(T){}
template<>
template<typename T>
void A<double>::function(T*){} // { dg-error "match" }
|
google | chromium | canon-type-7 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/canon-type-7.C | 345 | utf_8 | 4eb3398a3947a8275a3eeb127768d862 | // 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::*) (X)> a ;
};
template<class Y>
struct E
{
B<Y (Foo::*) (Y)> b ;
};
E<int> e ; |
google | chromium | cond4 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/cond4.C | 244 | utf_8 | 8e0316960b82711ee5f56b8b469d01b1 | // PR c++/14369
struct A { };
template<class T>
struct X : A {
const A* bar() const
{ return this; }
const A& foo() const;
};
template<class T>
const A& X<T>::foo() const
{
const A* t = bar();
return *(t ? t : throw 0);
}
|
google | chromium | union2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/union2.C | 115 | utf_8 | f2546316a67aacdf1c81fa8ce5b2a1f6 | /* PR c++/40557 */
/* { dg-do "compile" } */
struct A
{
typedef int X;
};
template<int> union B
{
A::X x;
};
|
google | chromium | lookup6 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/lookup6.C | 142 | utf_8 | 90ee492e747c2328ed39e4f06ad61d36 | struct S
{
template<typename T> static void g();
};
template<typename T>
void f() { return S::template g<T>(); }
void g() {
f<int>();
}
|
google | chromium | lookup5 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/lookup5.C | 230 | utf_8 | 3ab3f4b8b6e13f0c873ee865529608c0 | // PR c++/13925
namespace N {
template <class T> void f(T);
namespace M {
class A {
friend void f<int>(int);
};
}
template <class T> void f(T) {}
template <> void f<int>(int )
{
f<long>(0);
}
}
|
google | chromium | friend | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend.C | 460 | utf_8 | c6cdc41eef6b33a55c43db84fd711a3f | class ostream;
extern ostream& cout;
template <class T> struct s;
template <class T>
ostream& operator<<(ostream &o, const typename s<T>::t &x)
{
return o;
}
template <class T>
struct s {
struct t
{
friend ostream&
operator<<<T>(ostream&, const typename s<T>::t &);
};
t x;
};
int main()
{
s<int>::t ... |
google | chromium | explicit3 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/explicit3.C | 499 | utf_8 | 3b0207ca15de6320946949f657d95b9a | // { dg-do compile }
// Failed to spot specialization using a template-id expr
template <int n> class A {};
template <int m> class R {};
template <int n, int x> struct Trait { enum {m = n}; };
template <int n, int x> R<Trait<n,x>::m> f(A<x>);
template <> R<Trait<1,1>::m> f<1>(A<1>) {return R<1>();}
void Baz ()
{
R<Tr... |
google | chromium | lookup3 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/lookup3.C | 196 | utf_8 | 0287287b4b02081228b1429a9526248d | // PR c++/12397
struct foo { };
template <typename T> struct bar
{
bar(){}
int i;
bar (const bar<T>& foo) : i (foo.i) {}
};
int main()
{
bar<int> b1;
bar<int> b2(b1);
}
|
google | chromium | function1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/function1.C | 683 | utf_8 | 143b363ba35c6ce16dd59184f1d26306 | // PR c++/38647
// { dg-do compile }
template<const char *, int> struct A {};
const char func[] = "abc";
template<int N> struct A<func, N> {}; // { dg-error "cannot appear|is invalid" }
char a1[1];
A<a1, 0> a;
template<const char *, int> struct B {};
template<int N> struct B<__FUNCTION__, N> {}; // { dg-error "canno... |
google | chromium | crash58 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash58.C | 230 | utf_8 | d723188e66b53d1b47c72e45d36126b7 | //PR 26938
template<int, int = 0> struct A; // { dg-message "previous declaration" }
template<int> struct A // { dg-error "template" }
{
A();
};
A<0> a; // { dg-error "incomplete type" }
|
google | chromium | memfriend1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/memfriend1.C | 635 | utf_8 | 57fc8e37f6a64f03e3bea12e44f46909 | // { dg-do compile }
// Member function of class template as friend
template<class T> struct A
{
void f();
};
class C {
int i;
template<class T> friend void A<T>::f();
};
template<class T> struct A<T*>
{
void f();
};
template<> struct A<char>
{
void f();
};
template<class T> void A<T>::f()
{
C c;
c.i = 0;... |
google | chromium | operator8 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/operator8.C | 131 | utf_8 | 008f8ee400a759592c959c78c66d11b2 | //PR c++/27494
struct A
{
template<operator+> void foo() {} // { dg-error "identifier|non-function|template arguments" }
};
|
google | chromium | crash45 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash45.C | 143 | utf_8 | 427cd25234ee759c72800281459c7270 | // PR c++/26365
struct A {};
namespace N
{
template<int> void foo();
}
void bar(A *p)
{
p->N::foo<0>; // { dg-error "not a member" }
}
|
google | chromium | dtor3 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/dtor3.C | 130 | utf_8 | c46251d092a454420a2658cd0fcc8c15 | // PR c++/19762
template<int> struct A { ~A(){} }; // { dg-error "" }
template A<>::~A(); // { dg-error "template|declaration" }
|
google | chromium | friend48 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/friend48.C | 121 | utf_8 | 5087337546b38ddcc68287f9759e1504 | // PR c++/29020
template<int> struct A
{
void foo();
};
struct B
{
template<int N> friend void A<N>::A::foo();
};
|
google | chromium | init-list | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/init-list.C | 295 | utf_8 | 9783cba5cd0e48e50ecc5c42ed1dd282 | // { dg-do compile }
template<typename T>
struct Base {
Base(int) { }
};
template<typename T>
struct Derived : Base<T> {
Derived();
};
template<typename T>
Derived<T>::Derived() : Base(4) { } // { dg-error "have any field" "" } |
google | chromium | type1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/type1.C | 221 | utf_8 | d7a01e97d99f1b74700f8e173b381e7e | // Test for helpful error messages on invalid nested-name-specifiers.
struct A {
template <class T> struct B { static int c; };
};
int A::B::c; // { dg-error "parameters" }
int A::C::d; // { dg-error "declared" }
|
google | chromium | op1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/op1.C | 216 | utf_8 | 585425c7c24e913a9ccd6656bd75e83e | template <class T> struct X {
typedef int type;
};
template <class T> struct O {
struct I {
operator typename X<T>::type ();
};
};
template <class T>
O<T>::I::operator typename X<T>::type () {}
|
google | chromium | access18 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/access18.C | 391 | utf_8 | 913e0afca93ad603d70132a5830f11c1 | // DR 401
class X {
typedef int a; // { dg-error "private" }
static const int b = 5; // { dg-error "private" }
template <typename>
struct c; // { dg-error "private" }
};
template <typename = X::a> // { dg-error "context" }
struct A;
template <int = X::b> // { dg-error "context" }
struct B;
template <templat... |
google | chromium | spec11 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/spec11.C | 380 | utf_8 | 641e90d3e3434fc264671bb60336331b | // { dg-do compile }
// PR c++/13635: ICE explicit specialization of member function template
template <class foo>
class bar {
public:
template <class baz>
int func(baz *x);
};
template <>
template <class baz>
int bar<double>::func(baz *x) { return 5;}
template <>
template <>
int bar<double>::func(int *... |
google | chromium | typedef2 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typedef2.C | 164 | utf_8 | 91560e6058fa7ce0edbd4239eb12b810 | // PR c++/18155
template<int> typedef struct A; // { dg-warning "'typedef' was ignored" }
// { dg-error "" "" { target *-*-* } 3 }
|
google | chromium | static7 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/static7.C | 207 | utf_8 | eb951aea121806ff5e87bd2848d57e98 | // PR c++/17530
// { dg-do link }
typedef void (*Func) ();
void f (Func) {}
struct B
{
static void staticfunc () {}
};
template <int>
void C(){ f (B::staticfunc); }
int main ()
{
C<0>();
return 0;
}
|
google | chromium | crash42 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash42.C | 150 | utf_8 | 7845da4d1b1384a76c0c0244fc45ef41 | // { dg-do compile }
// PR c++/22153
template<int> void foo();
template<int> struct A
{
template<> friend void foo<0>(); // { dg-error "" }
};
|
google | chromium | explicit4 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/explicit4.C | 448 | utf_8 | 3f7c086b1b4dd5261f5ced979a21b04b | // { dg-do compile }
// Failed to spot specialization using a template-id expr
template <typename n> class A {};
template <int m> class R {};
template <int n, int x> struct Trait { enum {m = n}; };
template <typename n, typename x> R<Trait<1,1>::m> f(A<x>);
template <> R<Trait<1,1>::m> f<int>(A<int>) {return R<1>();} |
google | chromium | overload6 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/overload6.C | 355 | utf_8 | f36e9e857e1106ca9429859cd4bb22f0 | template<typename T> void unique(T,T);
struct A
{
int begin();
};
template<int> void foo()
{
unique(A().begin); // { dg-error "no matching function" "" }
} |
google | chromium | typename8 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typename8.C | 125 | utf_8 | a991f3b843fb36ef428fd3261f7cd8d6 | // PR c++/18738
namespace foo {
typedef int my_type;
}
template<typename T>
struct A {
typename foo::my_type bar();
};
|
google | chromium | operator4 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/operator4.C | 135 | utf_8 | 7e567ad662951a97d90d67420df1d001 | // PR c++/17068
struct A
{
template<int> void operator()() {}
};
template<typename> void foo()
{
A().template operator()<0>();
}
|
google | chromium | error16 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/error16.C | 161 | utf_8 | 709638c9b094e580ab80981a248856e2 | // PR c++/18674
template <typename I>
static void g() {
enum I::t a; // { dg-error "" }
(void) a;
}
struct B {
typedef int t;
};
void h()
{
g<B>();
}
|
google | chromium | crash43 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/crash43.C | 212 | utf_8 | 445602937029d55446b2a4e962079812 | // PR c++/24687
extern "C" {
template<typename _Tp> // { dg-error "C" }
struct ___is_pod {
enum {
__value = (sizeof(__gnu_internal::__test_type<_Tp>(0)))}; // { dg-error "declared|expected" }
|
google | chromium | typedef5 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/typedef5.C | 442 | utf_8 | 85d16af61ffdff9bc8c9e3f2444db5de | // PR c++/27572
// { dg-do compile }
template<typedef,int> struct A1; // { dg-error "no type|typedef declaration|default argument" }
template<typedef x,int> struct A2; // { dg-error "no type|typedef declaration|default argument" }
template<typedef x[],int> struct A3; // { dg-error "no type|typedef decla... |
google | chromium | vla1 | .C | native_client/nacl-gcc/gcc/testsuite/g++.dg/template/vla1.C | 126 | utf_8 | 94a0a165b65e3caa1af30d5a45bc1934 | // PR c++/29226
// { dg-options "" }
template <bool>
static int label (int w)
{
sizeof(int[w]);
}
int a = label<false>(1);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.