Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?

-- >8 --
As discussed in the 124770 patch.  This makes decl_defined_p correct
for more cases.

gcc/cp/ChangeLog:

        * decl2.cc (decl_defined_p): Also return true if DECL_INITIAL
        and !DECL_IN_AGGR_P is true for a VAR_DECL.
---
 gcc/cp/decl2.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc
index a0bc57d4a06..d45d7de4f59 100644
--- a/gcc/cp/decl2.cc
+++ b/gcc/cp/decl2.cc
@@ -5324,7 +5324,9 @@ decl_defined_p (tree decl)
   else
     {
       gcc_assert (VAR_P (decl));
-      return !DECL_EXTERNAL (decl);
+      return (!DECL_EXTERNAL (decl)
+             /* extern constexpr inline T foo{}; is a definition.  */
+             || (DECL_INITIAL (decl) && !DECL_IN_AGGR_P (decl)));
     }
 }
 

base-commit: 6bae0c37c95565171657a15ab4dcfd13a6898769
-- 
2.54.0

Reply via email to