42 lines
1.4 KiB
Diff
42 lines
1.4 KiB
Diff
Upstream-Status: Inappropriate [Backport]
|
|
From ec2d33835ee5855060878da89d4051fa06af9e97 Mon Sep 17 00:00:00 2001
|
|
From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
|
|
Date: Wed, 30 Mar 2011 02:16:37 +0000
|
|
Subject: [PATCH 042/200] PR c++/48265
|
|
* pt.c (value_dependent_expression_p) [VAR_DECL]: Make sure
|
|
the variable is constant before looking at its initializer.
|
|
|
|
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@171715 138bc75d-0d04-0410-961f-82ee72b054a4
|
|
|
|
index da9365f..e716ca6 100644
|
|
--- a/gcc/cp/pt.c
|
|
+++ b/gcc/cp/pt.c
|
|
@@ -18085,10 +18085,10 @@ value_dependent_expression_p (tree expression)
|
|
return value_dependent_expression_p (DECL_INITIAL (expression));
|
|
|
|
case VAR_DECL:
|
|
- /* A constant with integral or enumeration type and is initialized
|
|
+ /* A constant with literal type and is initialized
|
|
with an expression that is value-dependent. */
|
|
if (DECL_INITIAL (expression)
|
|
- && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (expression))
|
|
+ && decl_constant_var_p (expression)
|
|
&& value_dependent_expression_p (DECL_INITIAL (expression)))
|
|
return true;
|
|
return false;
|
|
new file mode 100644
|
|
index 0000000..112389d
|
|
--- /dev/null
|
|
+++ b/gcc/testsuite/g++.dg/cpp0x/regress/value-dep1.C
|
|
@@ -0,0 +1,7 @@
|
|
+// PR c++/48265
|
|
+// { dg-options -std=c++0x }
|
|
+
|
|
+template < int > struct S
|
|
+{
|
|
+ S () { const int i = i; i; };
|
|
+};
|
|
--
|
|
1.7.0.4
|
|
|