From ee00eaeacae53d2b93fecbb7629d166a57fd1834 Mon Sep 17 00:00:00 2001 From: Andrew Sutton Date: Thu, 2 Jul 2015 23:16:51 +0000 Subject: [PATCH] pt.c (type_dependent_expression_p): Handle expressions that refer to variable templates. * pt.c (type_dependent_expression_p): Handle expressions that refer to variable templates. From-SVN: r225361 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 4 ++++ gcc/testsuite/g++.dg/cpp1y/var-templ32.C | 7 +++++++ 3 files changed, 16 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/var-templ32.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dacc82876fe..12640af60a1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-07-02 Andrew Sutton + + * pt.c (type_dependent_expression_p): Handle expressions + that refer to variable templates. + 2015-07-01 Jason Merrill * lex.c (init_reswords): s/CXX0X/CXX11/. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 38d2e3a24e3..12feeee3f54 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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 index 00000000000..d9d2fff37f8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ32.C @@ -0,0 +1,7 @@ +// { dg-do compile { target c++14 } } + +template +bool V1 = true; + +template +bool V1 = false; // { dg-error "primary template" } -- 2.30.2