aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/module.cc
diff options
context:
space:
mode:
authorMatthias Kretz <m.kretz@gsi.de>2021-12-15 09:45:06 +0100
committerMatthias Kretz <m.kretz@gsi.de>2021-12-19 21:07:23 +0100
commit6bcb6ed5a44b6f271891246ef7ae568bfdc14e9c (patch)
tree525a5ac903a33c59ed940ff9077179f820cbbd68 /gcc/cp/module.cc
parent89cf57ea35d1e0a0b818997c737ac70b7310d9d9 (diff)
downloadgcc-6bcb6ed5a44b6f271891246ef7ae568bfdc14e9c.zip
gcc-6bcb6ed5a44b6f271891246ef7ae568bfdc14e9c.tar.gz
gcc-6bcb6ed5a44b6f271891246ef7ae568bfdc14e9c.tar.bz2
c++: don't ICE on NAMESPACE_DECL inside FUNCTION_DECL
Code like void swap() { namespace __variant = __detail::__variant; ... } create a NAMESPACE_DECL where the CP_DECL_CONTEXT is a FUNCTION_DECL. DECL_TEMPLATE_INFO fails on NAMESPACE_DECL and therefore must be handled first in the assertion. Signed-off-by: Matthias Kretz <m.kretz@gsi.de> gcc/cp/ChangeLog: * module.cc (trees_out::get_merge_kind): NAMESPACE_DECLs also cannot have a DECL_TEMPLATE_INFO.
Diffstat (limited to 'gcc/cp/module.cc')
-rw-r--r--gcc/cp/module.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index f3e7af2..8451e3d 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -10067,9 +10067,10 @@ trees_out::get_merge_kind (tree decl, depset *dep)
tree ctx = CP_DECL_CONTEXT (decl);
if (TREE_CODE (ctx) == FUNCTION_DECL)
{
- /* USING_DECLs cannot have DECL_TEMPLATE_INFO -- this isn't
- permitting them to have one. */
+ /* USING_DECLs and NAMESPACE_DECLs cannot have DECL_TEMPLATE_INFO --
+ this isn't permitting them to have one. */
gcc_checking_assert (TREE_CODE (decl) == USING_DECL
+ || TREE_CODE (decl) == NAMESPACE_DECL
|| !DECL_LANG_SPECIFIC (decl)
|| !DECL_TEMPLATE_INFO (decl));