aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-10-30 22:53:37 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-10-30 22:53:37 +0100
commit97ccc60e0c8590e22488e909464fc591eb8b0534 (patch)
tree6d7895cc261bb7068a1a75e285b8cd06adf2cfdf /gcc/cp
parente0d91792eec490d1bddb4a095a3da2c5b4c270e2 (diff)
downloadgcc-97ccc60e0c8590e22488e909464fc591eb8b0534.zip
gcc-97ccc60e0c8590e22488e909464fc591eb8b0534.tar.gz
gcc-97ccc60e0c8590e22488e909464fc591eb8b0534.tar.bz2
typeck.c (decl_in_std_namespace_p): Return true also for decls in inline namespaces inside of std namespace.
* typeck.c (decl_in_std_namespace_p): Return true also for decls in inline namespaces inside of std namespace. * g++.dg/cpp0x/Wpessimizing-move6.C: New test. From-SVN: r277648
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/typeck.c15
2 files changed, 18 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 402d321..46b8fe0 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-30 Jakub Jelinek <jakub@redhat.com>
+
+ * typeck.c (decl_in_std_namespace_p): Return true also for decls
+ in inline namespaces inside of std namespace.
+
2019-10-30 Bernd Edlinger <bernd.edlinger@hotmail.de>
PR c++/92024
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 477c6a3..03c39b3 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -9395,8 +9395,19 @@ maybe_warn_about_returning_address_of_local (tree retval)
bool
decl_in_std_namespace_p (tree decl)
{
- return (decl != NULL_TREE
- && DECL_NAMESPACE_STD_P (decl_namespace_context (decl)));
+ while (decl)
+ {
+ decl = decl_namespace_context (decl);
+ if (DECL_NAMESPACE_STD_P (decl))
+ return true;
+ /* Allow inline namespaces inside of std namespace, e.g. with
+ --enable-symvers=gnu-versioned-namespace std::forward would be
+ actually std::_8::forward. */
+ if (!DECL_NAMESPACE_INLINE_P (decl))
+ return false;
+ decl = CP_DECL_CONTEXT (decl);
+ }
+ return false;
}
/* Returns true if FN, a CALL_EXPR, is a call to std::forward. */