re PR c++/51385 (Unnecessary instantiation converting to pointer to template class instance)

2014-09-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51385
	* g++.dg/template/pr51385.C: New.

From-SVN: r215680
This commit is contained in:
Paolo Carlini 2014-09-29 09:06:31 +00:00 committed by Paolo Carlini
parent 0fe81a0f05
commit f1d6f49466
2 changed files with 29 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2014-09-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51385
* g++.dg/template/pr51385.C: New.
2014-09-28 Robert Suchanek <robert.suchanek@imgtec.com>
* gcc.target/mips/20140928.c: New test.

View File

@ -0,0 +1,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];