pt.c (type_dependent_expression_p): Handle expressions that refer to variable templates.
authorAndrew Sutton <andrew.n.sutton@gmail.com>
Thu, 2 Jul 2015 23:16:51 +0000 (23:16 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 2 Jul 2015 23:16:51 +0000 (19:16 -0400)
* pt.c (type_dependent_expression_p): Handle expressions
that refer to variable templates.

From-SVN: r225361

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

index dacc82876fe19c62aebe0046f3586ed2782d05e9..12640af60a1d45ebcb45674c3affd12bf87be304 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-02  Andrew Sutton  <andrew.n.sutton@gmail.com>
+
+       * pt.c (type_dependent_expression_p): Handle expressions
+       that refer to variable templates.
+
 2015-07-01  Jason Merrill  <jason@redhat.com>
 
        * lex.c (init_reswords): s/CXX0X/CXX11/.
index 38d2e3a24e3f45b238e93d89d4462ff604a94bd1..12feeee3f547babb801edf50b2e7c1657bb69eba 100644 (file)
@@ -21606,6 +21606,10 @@ type_dependent_expression_p (tree expression)
            return true;
          expression = TREE_OPERAND (expression, 0);
        }
+
+      if (variable_template_p (expression))
+        return dependent_type_p (TREE_TYPE (expression));
+
       gcc_assert (TREE_CODE (expression) == OVERLOAD
                  || TREE_CODE (expression) == FUNCTION_DECL);
 
diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ32.C b/gcc/testsuite/g++.dg/cpp1y/var-templ32.C
new file mode 100644 (file)
index 0000000..d9d2fff
--- /dev/null
@@ -0,0 +1,7 @@
+// { dg-do compile { target c++14 } }
+
+template<typename T>
+bool V1 = true;
+
+template<typename T>
+bool V1<int> = false; // { dg-error "primary template" }