]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/51385 (Unnecessary instantiation converting to pointer to template class...
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 29 Sep 2014 09:06:31 +0000 (09:06 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 29 Sep 2014 09:06:31 +0000 (09:06 +0000)
2014-09-29  Paolo Carlini  <paolo.carlini@oracle.com>

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

From-SVN: r215680

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/pr51385.C [new file with mode: 0644]

index 870ca0e3952fa44edecae023020c6d14cb922f1a..925adf802056db56b62b364df3bd42e5359d1cb3 100644 (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.
diff --git a/gcc/testsuite/g++.dg/template/pr51385.C b/gcc/testsuite/g++.dg/template/pr51385.C
new file mode 100644 (file)
index 0000000..e769954
--- /dev/null
@@ -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];
This page took 0.084257 seconds and 5 git commands to generate.