temp_arg_nontype.cpp [plain text]
template<int N> struct A;
A<0> *a0;
A<int()> *a1;
A<int> *a2;
A<1 >> 2> *a3;
A<A> *a4;
enum E { Enumerator = 17 };
A<E> *a5; template<E Value> struct A1; A1<Enumerator> *a6; A1<17> *a7;
const long LongValue = 12345678;
A<LongValue> *a8;
const short ShortValue = 17;
A<ShortValue> *a9;
int f(int);
A<f(17)> *a10;
class X {
public:
X();
X(int, int);
operator int() const;
};
A<X(17, 42)> *a11;
float f(float);
float g(float); double g(double);
int h(int);
float h2(float);
template<int fp(int)> struct A3; A3<h> *a14_1;
A3<&h> *a14_2;
A3<f> *a14_3;
A3<&f> *a14_4;
A3<h2> *a14_6; A3<g> *a14_7;
struct Y { } y;
volatile X * X_volatile_ptr;
template<X const &AnX> struct A4; X an_X;
A4<an_X> *a15_1; A4<*X_volatile_ptr> *a15_2; A4<y> *15_3;
template<int (&fr)(int)> struct A5; A5<h> *a16_1;
A5<f> *a16_3;
A5<h2> *a16_6; A5<g> *a14_7;
struct Z {
int foo(int);
float bar(float);
int bar(int);
double baz(double);
int int_member;
float float_member;
};
template<int (Z::*pmf)(int)> struct A6; A6<&Z::foo> *a17_1;
A6<&Z::bar> *a17_2;
A6<&Z::baz> *a17_3;
template<int Z::*pm> struct A7; template<int Z::*pm> struct A7c;
A7<&Z::int_member> *a18_1;
A7c<&Z::int_member> *a18_2;
A7<&Z::float_member> *a18_3; A7c<(&Z::int_member)> *a18_4;
template<unsigned char C> struct Overflow;
Overflow<5> *overflow1; Overflow<255> *overflow2; Overflow<256> *overflow3;
template<unsigned> struct Signedness; Signedness<10> *signedness1; Signedness<-10> *signedness2;
template<signed char C> struct SignedOverflow; SignedOverflow<1> *signedoverflow1;
SignedOverflow<-1> *signedoverflow2;
SignedOverflow<-128> *signedoverflow3;
SignedOverflow<-129> *signedoverflow4; SignedOverflow<127> *signedoverflow5;
SignedOverflow<128> *signedoverflow6; SignedOverflow<(unsigned char)128> *signedoverflow7;
template<int (*)(int, int)> struct FuncPtr0;
int func0(int, int);
extern FuncPtr0<&func0> *fp0;
template<int (*)(int, int)> struct FuncPtr0;
extern FuncPtr0<&func0> *fp0;
int func0(int, int);
extern FuncPtr0<&func0> *fp0;
namespace ns {
template <typename T>
struct Foo {
static const bool value = true;
};
template <bool b>
struct Bar {};
const bool value = false;
Bar<bool(ns::Foo<int>::value)> x;
}
namespace ns {
enum E { k };
template <E e>
struct Baz {};
Baz<k> f1; Baz<E(0)> f2; Baz<static_cast<E>(0)> f3;
Baz<ns::E(0)> b1; Baz<static_cast<ns::E>(0)> b2; }
template<int (*)(float)> struct X0 { };
struct X1 {
static int pfunc(float);
};
void test_X0_X1() {
X0<X1::pfunc> x01;
}
namespace pr6249 {
template<typename T, T (*func)()> T f() {
return func();
}
int h();
template int f<int, h>();
}
namespace PR6723 {
template<unsigned char C> void f(int (&a)[C]); void g() {
int arr512[512];
f(arr512); f<512>(arr512); }
}
namespace EntityReferenced {
template<typename T, void (*)(T)> struct X { };
template<typename T>
struct Y {
static void f(T x) {
x = 1; }
};
void g() {
typedef X<int*, Y<int*>::f> x; }
}
namespace PR6964 {
template <typename ,int, int = 9223372036854775807L > struct as_nview { };
template <typename Sequence, int I0>
struct as_nview<Sequence, I0> { };
}
namespace test8 {
template <int* ip> struct A {
int* p;
A() : p(ip) {}
};
void test0() {
extern int i00;
A<&i00> a00;
}
extern int i01;
void test1() {
A<&i01> a01;
}
struct C {
int x;
char y;
double z;
};
template <C* cp> struct B {
C* p;
B() : p(cp) {}
};
void test2() {
extern C c02;
B<&c02> b02;
}
extern C c03;
void test3() {
B<&c03> b03;
}
}
namespace PR8372 {
template <int I> void foo() { } void bar() { foo <0x80000000> (); } }
namespace PR9227 {
template <bool B> struct enable_if_bool { };
template <> struct enable_if_bool<true> { typedef int type; };
void test_bool() { enable_if_bool<false>::type i; }
template <char C> struct enable_if_char { };
template <> struct enable_if_char<'a'> { typedef int type; };
void test_char_0() { enable_if_char<0>::type i; } void test_char_b() { enable_if_char<'b'>::type i; } void test_char_possibly_negative() { enable_if_char<'\x02'>::type i; } void test_char_single_quote() { enable_if_char<'\''>::type i; } void test_char_backslash() { enable_if_char<'\\'>::type i; } }
namespace PR10579 {
namespace fcppt
{
namespace container
{
namespace bitfield
{
template<
typename Enum,
Enum Size
>
class basic;
template<
typename Enum,
Enum Size
>
class basic
{
public:
basic()
{
}
};
}
}
}
namespace
{
namespace testenum
{
enum type
{
foo,
bar,
size
};
}
}
int main()
{
typedef fcppt::container::bitfield::basic<
testenum::type,
testenum::size
> bitfield_foo;
bitfield_foo obj;
}
}
template <int& I> struct PR10766 { static int *ip; };
template <int& I> int* PR10766<I>::ip = &I;