re PR c++/82085 (ICE: Template variable reference used in nested template alias)
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 30 Oct 2017 19:16:29 +0000 (19:16 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 30 Oct 2017 19:16:29 +0000 (19:16 +0000)
/cp
2017-10-30  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/82085
* pt.c (tsubst_copy_and_build, [INDIRECT_REF]): For a REFERENCE_REF_P,
unconditionally call convert_from_reference.

/testsuite
2017-10-30  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/82085
* g++.dg/cpp1y/var-templ56.C: New.

From-SVN: r254239

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/var-templ56.C [new file with mode: 0644]

index 7630638..f1809f5 100644 (file)
@@ -1,3 +1,9 @@
+2017-10-30  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/82085
+       * pt.c (tsubst_copy_and_build, [INDIRECT_REF]): For a REFERENCE_REF_P,
+       unconditionally call convert_from_reference.
+
 2017-10-30  Nathan Sidwell  <nathan@acm.org>
 
        * call.c (build_op_call_1): Test for FUNCTION_DECL in same manner
index 9457aea..8b89ca9 100644 (file)
@@ -17079,8 +17079,7 @@ tsubst_copy_and_build (tree t,
            /* A type conversion to reference type will be enclosed in
               such an indirect ref, but the substitution of the cast
               will have also added such an indirect ref.  */
-           if (TREE_CODE (TREE_TYPE (r)) == REFERENCE_TYPE)
-             r = convert_from_reference (r);
+           r = convert_from_reference (r);
          }
        else
          r = build_x_indirect_ref (input_location, r, RO_UNARY_STAR,
index ad5d917..40ef87e 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-30  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/82085
+       * g++.dg/cpp1y/var-templ56.C: New.
+
 2017-10-30  Nathan Sidwell  <nathan@acm.org>
 
        * g++.dg/other/operator2.C: Adjust diagnostic.
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ56.C b/gcc/testsuite/g++.dg/cpp1y/var-templ56.C
new file mode 100644 (file)
index 0000000..d0f762b
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/82085
+// { dg-do compile { target c++14 } }
+
+template <const char& V>
+using char_sequence_t = int;
+
+template <typename T>
+constexpr char name_of_v = 'x';
+
+template <typename T>
+using type = char_sequence_t<name_of_v<T>>;