From: yxj-github-437 <2457369...@qq.com> This patch attempts to fix an error when build module std. The reason for the error is __builrin_va_list (aka struct __va_list) is an internal linkage. so attempt to handle this builtin type by identifying whether DECL_SOURCE_LOCATION (entity) is BUILTINS_LOCATION.
/x/gcc-15.0.0/usr/bin/aarch64-linux-android-g++ -fmodules -std=c++23 -fPIC -O2 -fsearch-include-path bits/std.cc -c /x/gcc-15.0.0/usr/lib/gcc/aarch64-linux-android/15.0.0/include/c++/bits/std.cc:3642:14: error: exporting ‘typedef __gnuc_va_list va_list’ that does not have external linkage 3642 | using std::va_list; | ^~~~~~~ <built-in>: note: ‘struct __va_list’ declared here with internal linkage gcc: * cp/name-lookup.cc (check_can_export_using_decl): add identifying whether DECL_SOURCE_LOCATION (entity) is BUILTINS_LOCATION. --- gcc/cp/name-lookup.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc index 0e185d3ef42..73f3034adb4 100644 --- a/gcc/cp/name-lookup.cc +++ b/gcc/cp/name-lookup.cc @@ -5225,7 +5225,7 @@ check_can_export_using_decl (tree binding) if (TREE_CODE (entity) == TYPE_DECL) { entity = TYPE_MAIN_DECL (TREE_TYPE (entity)); - if (!entity) + if (!entity || DECL_SOURCE_LOCATION (entity) == BUILTINS_LOCATION) return true; } -- 2.43.0