summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/pr51385.C
blob: e76995467ca68402765853e1b49959c7100c9ce1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// PR c++/51385

template <__SIZE_TYPE__ N> struct NTmpl;
template <typename T, typename U, typename V = NTmpl<sizeof(T *)> >
struct PtrConvs {
   enum { bad = 1 };
};

template <typename Target, typename Source>
struct PtrConvs<Target, Source, NTmpl<sizeof (*(Target **)0 = (Source *)0)> >;

template<typename T> struct test { static const bool value = true; };
template<> struct test<short> { static const bool value = false; };

template <typename T>
struct FussyTemplate
{
  int sa[test<T>::value ? 1 : -1];
};

struct B { };

typedef char chk[1];
typedef char chk[PtrConvs<FussyTemplate<short>, B>::bad];