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

            Bug ID: 121651
           Summary: Proper error needed for improper use of musttail
           Product: gcc
           Version: 15.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: diagnostics
          Assignee: dmalcolm at redhat dot com
          Reporter: lukas.gra...@tu-darmstadt.de
  Target Milestone: ---

It seems that people have the wrong idea on how to use the musttail attribute.
I have seen the following usage suggestions in PR 121159 and PR 10837:


[[noreturn]] [[gnu::musttail]] void bar();

void temp()
{
    bar();
}


Correct version:


[[noreturn]] void bar();

void temp()
{
    [[gnu::musttail]] return bar();
}


Both compile, even with -Wall -Wextra. I think we need a proper error when
musttail is used in a function signature. Currently, there is only a warning
"'musttail' attribute ignored [-Wattributes]".

Reply via email to