https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120917

            Bug ID: 120917
           Summary: warning: use of 'auto' in template argument only
                    available with '-fconcepts-ts'
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: f.heckenb...@fh-soft.de
  Target Milestone: ---

% cat test.cpp
template <typename T> struct S;
void f (S <auto>);
% g++-12 --std=c++23 -c test.cpp -Wall -Wextra
% g++-14 --std=c++23 -c test.cpp -Wall -Wextra
test.cpp:2:12: warning: use of 'auto' in template argument only available with
'-fconcepts-ts'
    2 | void f (S <auto>);
      |            ^~~~

According to the manual:

  -fconcepts
    Enable support for the C++ Concepts feature for constraining template
arguments. With -std=c++20 and above, Concepts are part of the language
standard, so -fconcepts defaults to on.

    Some constructs that were allowed by the earlier C++ Extensions for
Concepts Technical Specification, ISO 19217 (2015), but didn't make it into the
standard, could additionally be enabled by -fconcepts-ts. The option
-fconcepts-ts was deprecated in GCC 14 and removed in GCC 15; users are
expected to convert their code to C++20 concepts.

At first sight, it looks like g++-14 suggests using a deprecated feature, but I
fear it's even worse. According to Godbolt, g++-15 gives an error, so I gather
this is one of these mentioned constructs that didn't make it into the standard
and were removed.

Is that correct? (The message could really have been much clearer about that.)

The problem is, I never asked for non-standard features. I ran g++-12 (and
previous versions) with "--std=c++23" (or respective versions) only, not with
any GNU extension flags (definitely never "-fconcepts" or "-fconcepts-ts"), to
avoid exactly these kinds of problems.

In the assumption that this a part of standard concepts, I've used it in many
places in my code, and now GCC tells me it's not and the feature is
disappearing, is that right?

So basically GCC lured me into a trap, and the trap is snapping now, is it?

Is there an alternative (apart from the manual boilerplate)? Even if it's an
evil macro, I don't care at this point.

Is there any chance the feature will be added to the standard sometime in the
future?

Even if not, could GCC please (re-)add this feature (of course, with an
explicit option this time), because of the special circumstances?

Reply via email to