aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>2016-03-29 14:40:02 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-03-29 14:40:02 -0400
commite0bffbbb5936be8b6a35d868db4226ca1b2365fa (patch)
tree4b759a379b55a6ac060ab50cf266013f5d5b5c1d /gcc/cp
parent3336c6e09385fa50daaa6b7b1bb68908f9a4298f (diff)
downloadgcc-e0bffbbb5936be8b6a35d868db4226ca1b2365fa.zip
gcc-e0bffbbb5936be8b6a35d868db4226ca1b2365fa.tar.gz
gcc-e0bffbbb5936be8b6a35d868db4226ca1b2365fa.tar.bz2
re PR c++/70353 (ICE on __PRETTY_FUNCTION__ in a constexpr function)
PR c++/70353 gcc/ * tree-inline.c (remap_decls): Don't add_local_decl if cfun is null. gcc/cp/ * decl.c (make_rtl_for_nonlocal_decl): Don't defer local statics in constexpr functions. From-SVN: r234530
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2028f7e..91ad5ac 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2016-03-29 Jason Merrill <jason@redhat.com>
+
+ PR c++/70353
+ * decl.c (make_rtl_for_nonlocal_decl): Don't defer local statics
+ in constexpr functions.
+
2016-03-28 Jason Merrill <jason@redhat.com>
PR c++/70422
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index cd5db3f..cfae210 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6251,8 +6251,11 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
return;
/* We defer emission of local statics until the corresponding
- DECL_EXPR is expanded. */
- defer_p = DECL_FUNCTION_SCOPE_P (decl) || DECL_VIRTUAL_P (decl);
+ DECL_EXPR is expanded. But with constexpr its function might never
+ be expanded, so go ahead and tell cgraph about the variable now. */
+ defer_p = ((DECL_FUNCTION_SCOPE_P (decl)
+ && !DECL_DECLARED_CONSTEXPR_P (DECL_CONTEXT (decl)))
+ || DECL_VIRTUAL_P (decl));
/* Defer template instantiations. */
if (DECL_LANG_SPECIFIC (decl)