]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: require C++26 for -freflection [PR124447]
authorMarek Polacek <polacek@redhat.com>
Wed, 11 Mar 2026 20:10:12 +0000 (16:10 -0400)
committerMarek Polacek <polacek@redhat.com>
Thu, 12 Mar 2026 16:34:35 +0000 (12:34 -0400)
-freflection is unusable without C++26 so let's not allow it.

PR c++/124447

gcc/c-family/ChangeLog:

* c-opts.cc (c_common_post_options): Error if -freflection is used
without -std=c++26 or -std=gnu++26.

Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/c-family/c-opts.cc

index 1d14eeeb995fbf66732e572e6d4439a4ec68941f..9fad71a1eb1a3386419798ee60f0e97f7e421e91 100644 (file)
@@ -1265,6 +1265,10 @@ c_common_post_options (const char **pfilename)
   if (flag_immediate_escalation && cxx_dialect < cxx20)
     flag_immediate_escalation = 0;
 
+  if (flag_reflection && cxx_dialect < cxx26)
+    error ("%<-freflection%> only supported with %<-std=c++26%> or "
+          "%<-std=gnu++26%>");
+
   if (num_in_fnames > 1)
     error ("too many filenames given; type %<%s %s%> for usage",
           progname, "--help");