From 3f15893e8477480cf75d85ac23f8cbd610ab540f Mon Sep 17 00:00:00 2001 From: HungMingWu Date: Fri, 20 Sep 2024 17:01:45 +0800 Subject: [PATCH 1/2] Fix: using statement in antoher namespace that pointer to type alias --- source/to_cpp1.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/to_cpp1.h b/source/to_cpp1.h index da0a437dc..d72a420f5 100644 --- a/source/to_cpp1.h +++ b/source/to_cpp1.h @@ -5685,10 +5685,11 @@ class cppfront return; } - // In phase 0, only need to consider namespaces and types + // In phase 0, only need to consider alias, namespaces and types if ( printer.get_phase() == printer.phase0_type_decls + && !n.is_alias() && !n.is_namespace() && !n.is_type() ) @@ -5718,13 +5719,13 @@ class cppfront auto& a = std::get(n.type); assert(a); - // Namespace-scope aliases are emitted in phase 1, + // Namespace-scope aliases are emitted in phase 0, // type-scope object aliases in both phases 1 and 2, and // function-scope aliases in phase 2 if ( ( !n.parent_is_function() - && printer.get_phase() == printer.phase1_type_defs_func_decls + && printer.get_phase() == printer.phase0_type_decls ) || ( From b39738809e173f3c9b79a5ec039508e95a7dc43f Mon Sep 17 00:00:00 2001 From: HungMingWu Date: Wed, 25 Sep 2024 10:20:42 +0800 Subject: [PATCH 2/2] Bugfix --- source/to_cpp1.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/to_cpp1.h b/source/to_cpp1.h index d72a420f5..d48679166 100644 --- a/source/to_cpp1.h +++ b/source/to_cpp1.h @@ -6057,7 +6057,7 @@ class cppfront // Now, emit our own template parameters if ( - n.template_parameters + (n.template_parameters && !n.is_alias()) && ( printer.get_phase() < printer.phase2_func_defs || n.is_object()