[Bug c++/107278] fails to correctly parse template default function declarations.

ky4ct at arrl dot net gcc-bugzilla@gcc.gnu.org
Sun Oct 16 15:26:44 GMT 2022


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

--- Comment #3 from Jonathan <ky4ct at arrl dot net> ---
(In reply to Andrew Pinski from comment #1)
> Iirc there was a defect report against the c++ standard here and you should
> just foo instead of foo<T>


kd5eax@KY4CT CLANG64 ~
$ cat test.cpp
template<typename T>
class foo
{
        foo<T>(foo<T> const&) = delete;
        foo<T>(foo<T> const&&) = default;

};

int main()
{
        return 0;
};
kd5eax@KY4CT CLANG64 ~
$ clang++ -std=c++20 test.cpp

kd5eax@KY4CT CLANG64 ~
$

kd5eax@KY4CT UCRT64 ~
$ g++ -std=c++2b test.cpp
test.cpp:4:22: error: expected ')' before 'const'
    4 |         foo<T>(foo<T> const&) = delete;
      |               ~      ^~~~~~
      |                      )
test.cpp:5:22: error: expected ')' before 'const'
    5 |         foo<T>(foo<T> const&&) = default;
      |               ~      ^~~~~~
      |                      )

kd5eax@KY4CT UCRT64 ~
$ g++ test.cpp

kd5eax@KY4CT UCRT64 ~
$




(In reply to Andrew Pinski from comment #1)
> Iirc there was a defect report against the c++ standard here and you should
> just foo instead of foo<T>

If that is the case, can you please link the defect report against the
standard?


More information about the Gcc-bugs mailing list