variable. */
if (DECL_FUNCTION_SCOPE_P (decl)
&& TREE_STATIC (decl)
- && !DECL_ARTIFICIAL (decl)
- && !consteval_only_p (decl))
+ && !DECL_ARTIFICIAL (decl))
{
/* The variable holding an anonymous union will have had its
discriminator set in finish_anon_union, after which it's
walk_tree (&init, notice_forced_label_r, NULL, NULL);
add_local_decl (cfun, decl);
}
- /* And make sure it's in the symbol table for
- c_parse_final_cleanups to find. */
- varpool_node::get_create (decl);
+ if (!consteval_only_p (decl))
+ /* And make sure it's in the symbol table for
+ c_parse_final_cleanups to find. */
+ varpool_node::get_create (decl);
}
if (flag_openmp
--- /dev/null
+// PR c++/124824
+// { dg-do compile { target c++26 } }
+// { dg-additional-options "-freflection" }
+
+template<auto V> void f() { }
+
+int main() {
+ {
+ static constexpr auto M = ^^int;
+ f<&M>();
+ }
+ {
+ static constexpr auto M = ^^int;
+ f<&M>();
+ }
+}
+
+// { dg-final { scan-assembler "_Z1fITnDaXadL_ZZ4mainE1MEEEvv" } }
+// { dg-final { scan-assembler "_Z1fITnDaXadL_ZZ4mainE1M_0EEEvv" } }