summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-4.6.0/gcc-4_6-branch-backports/0042-PR-c-48265.patch
blob: c9f747cf0bced13814def415d00f043415bc9670 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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

OpenPOWER on IntegriCloud