https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126017
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Unfortunately even
--- a/gcc/tree.h 2026-08-21 14:40:07.157109500 +0200
+++ b/gcc/tree.h 2026-09-15 09:45:54.490118674 +0200
@@ -6343,7 +6343,20 @@ more_call_expr_args_p (const call_expr_a
inline bool
is_lang_specific (const_tree t)
{
- return TREE_CODE (t) == LANG_TYPE || TREE_CODE (t) >= NUM_TREE_CODES;
+ if (TREE_CODE (t) >= NUM_TREE_CODES)
+ return true;
+ else if (TREE_CODE (t) == LANG_TYPE)
+ {
+ tree mv = TYPE_MAIN_VARIANT (t);
+ tree id = TYPE_IDENTIFIER (mv);
+ /* Return false for C++ std::meta::info type. */
+ if (id && id_equal (id, "decltype(^^int)"))
+ return false;
+ else
+ return true;
+ }
+ else
+ return false;
}
/* Valid builtin number. */
--- a/gcc/lto-streamer-out.cc 2026-07-20 09:57:50.693934604 +0200
+++ b/gcc/lto-streamer-out.cc 2026-09-14 21:45:18.077056366 +0200
@@ -564,7 +564,6 @@ lto_is_streamable (tree expr)
name version in lto_output_tree_ref (see output_ssa_names). */
return !is_lang_specific (expr)
&& code != SSA_NAME
- && code != LANG_TYPE
&& code != MODIFY_EXPR
&& code != INIT_EXPR
&& code != TARGET_EXPR
--- a/gcc/testsuite/g++.dg/lto/pr126017_0.C 2026-09-15 09:41:06.651285147
+0200
+++ b/gcc/testsuite/g++.dg/lto/pr126017_0.C 2026-09-15 09:41:06.651285147
+0200
@@ -0,0 +1,14 @@
+// PR c++/126017
+// { dg-lto-do run }
+// { dg-lto-options { { -std=c++26 -O2 -flto -freflection -g } } }
+
+using info = decltype (^^::);
+info a {};
+extern info foo (info);
+
+int
+main ()
+{
+ if (a != info{} || foo (a) != a)
+ __builtin_abort ();
+}
--- a/gcc/testsuite/g++.dg/lto/pr126017_1.C 2026-09-15 09:41:06.651164492
+0200
+++ b/gcc/testsuite/g++.dg/lto/pr126017_1.C 2026-09-15 09:41:06.651164492
+0200
@@ -0,0 +1,22 @@
+// PR c++/126017
+
+#include <meta>
+
+extern std::meta::info a;
+
+consteval std::meta::info
+bar ()
+{
+ struct S;
+ consteval { define_aggregate (^^S, { data_member_spec (^^int, { .name =
"abc" }) }); }
+ return ^^S;
+}
+
+struct T : [: bar () :] {};
+
+std::meta::info
+foo (std::meta::info x)
+{
+ T a;
+ return x;
+}
is not enough, this still ICEs, not during LTO streaming like before, but in
gimple_canonical_types_compatible_p.
default:
/* Consider all types with language specific trees in them mutually
compatible. This is executed only from verify_type and false
positives can be tolerated. */
gcc_assert (!in_lto_p);
return true;
So, we'd need to handle LANG_TYPE (or better just LANG_TYPE with the specific
name) in there too.
I'm also afraid that checking by name of the main variant is unsafe, for
certain attributes we can create a distinct type and that has a different
TYPE_MAIN_VARIANT, so if one applies some attributes to decltype (^^::) alias,
it wouldn't work again.
And allowing any LANG_TYPE with no strings attached is dangerous, Ada or Rust
use LANG_TYPE for something completely unrelated and probably don't want that
to leak till LTO and beyond.