]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/60274 (String as template parameter - regression in 4.8.3)
authorJason Merrill <jason@redhat.com>
Fri, 21 Feb 2014 04:42:59 +0000 (23:42 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 21 Feb 2014 04:42:59 +0000 (23:42 -0500)
PR c++/60274
Revert:
PR c++/58606
* pt.c (template_parm_to_arg): Call convert_from_reference.
(tsubst_template_arg): Don't strip reference refs.

From-SVN: r207978

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/variadic146.C [deleted file]
gcc/testsuite/g++.dg/template/ref7.C [new file with mode: 0644]

index f5a7aeba0e77d06f2ae6b7de530975d97f840831..8f6b94a5ca6f96db90797e2ae346804f61e3ed2e 100644 (file)
@@ -1,3 +1,11 @@
+2014-02-20  Jason Merrill  <jason@redhat.com>
+
+       PR c++/60274
+       Revert:
+       PR c++/58606
+       * pt.c (template_parm_to_arg): Call convert_from_reference.
+       (tsubst_template_arg): Don't strip reference refs.
+
 2014-02-20  Kai Tietz  <ktietz@redhat.com>
 
        PR c++/58873
index 24abccbf807a829d7d0a7d99483f7f3ef339aa8c..23e8c1d345c6bb53d5b5fbabac0809016e1f686c 100644 (file)
@@ -3823,7 +3823,6 @@ template_parm_to_arg (tree t)
          SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT
            (vec, TREE_VEC_LENGTH (vec));
 #endif
-         t = convert_from_reference (t);
          TREE_VEC_ELT (vec, 0) = make_pack_expansion (t);
 
          t  = make_node (NONTYPE_ARGUMENT_PACK);
@@ -9113,6 +9112,10 @@ tsubst_template_arg (tree t, tree args, tsubst_flags_t complain, tree in_decl)
                       /*integral_constant_expression_p=*/true);
       if (!(complain & tf_warning))
        --c_inhibit_evaluation_warnings;
+      /* Preserve the raw-reference nature of T.  */
+      if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE
+         && REFERENCE_REF_P (r))
+       r = TREE_OPERAND (r, 0);
     }
   return r;
 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic146.C b/gcc/testsuite/g++.dg/cpp0x/variadic146.C
deleted file mode 100644 (file)
index 0c91db5..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// PR c++/58606
-// { dg-require-effective-target c++11 }
-
-template<int&...I> struct A
-{
-  template<typename> struct B;
-
-  template<typename T> struct B<T*> {};
-};
diff --git a/gcc/testsuite/g++.dg/template/ref7.C b/gcc/testsuite/g++.dg/template/ref7.C
new file mode 100644 (file)
index 0000000..4329292
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/60274
+
+typedef const char *const&  ProtocolIdType;
+
+template <ProtocolIdType protocolId>
+struct C {
+  typedef int ProtocolVersion;
+  struct D {
+    ProtocolVersion GetProtocolVersion();
+  };
+};
+template <ProtocolIdType protocolId>
+typename C<protocolId>::ProtocolVersion C<protocolId>::D::GetProtocolVersion()
+{
+    return 1;
+}