aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.cc
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2025-09-02 15:58:26 -0700
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2025-09-02 15:58:26 -0700
commit071b4126c613881f4cb25b4e5c39032964827f88 (patch)
tree7ed805786566918630d1d617b1ed8f7310f5fd8e /gcc/cp/decl2.cc
parent845d23f3ea08ba873197c275a8857eee7edad996 (diff)
parentcaa1c2f42691d68af4d894a5c3e700ecd2dba080 (diff)
downloadgcc-devel/gfortran-test.zip
gcc-devel/gfortran-test.tar.gz
gcc-devel/gfortran-test.tar.bz2
Merge branch 'master' into gfortran-testdevel/gfortran-test
Diffstat (limited to 'gcc/cp/decl2.cc')
-rw-r--r--gcc/cp/decl2.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc
index 2bbc618..6499be1 100644
--- a/gcc/cp/decl2.cc
+++ b/gcc/cp/decl2.cc
@@ -52,6 +52,7 @@ along with GCC; see the file COPYING3. If not see
#include "omp-general.h"
#include "tree-inline.h"
#include "escaped_string.h"
+#include "contracts.h"
/* Id for dumping the raw trees. */
int raw_dump_id;
@@ -6229,6 +6230,7 @@ cp_warn_deprecated_use_scopes (tree scope)
bool
decl_dependent_p (tree decl)
{
+ tree orig_decl = decl;
if (DECL_FUNCTION_SCOPE_P (decl)
|| TREE_CODE (decl) == CONST_DECL
|| TREE_CODE (decl) == USING_DECL
@@ -6240,6 +6242,13 @@ decl_dependent_p (tree decl)
if (LAMBDA_FUNCTION_P (decl)
&& dependent_type_p (DECL_CONTEXT (decl)))
return true;
+ /* for-range-declaration of expansion statement as well as variable
+ declarations in the expansion statement body when the expansion statement
+ is not inside a template still need to be treated as dependent during
+ parsing. When the body is instantiated, in_expansion_stmt will be already
+ false. */
+ if (VAR_P (orig_decl) && in_expansion_stmt && decl == current_function_decl)
+ return true;
return false;
}