Open llvmbot opened 8 years ago
This still does not compile with post 18 trunk(d9a9872ec4760762fdc467ef283cea302a3742e5) https://godbolt.org/z/e4doGnv87
It also fails to compile on gcc 13.2 and EDG 6.6 It compiles on msvc 19.38
code
struct NonTemplate
{
typedef void type();
type operator(); //Actually declares an member function.
};
template<typename T>
struct Template
{
typedef T type;
T operator();
};
clang error
<source>:13:7: error: 'operator()' cannot be the name of a variable or data member
13 | T operator();
| ^
1 error generated.
Compiler returned: 1
gcc error
<source>:13:7: error: declaration of 'operator()' as non-function
13 | T operator();
| ^~~~~~~~
Compiler returned: 1
EDG error
"<source>", line 13: error: an operator name must be declared as a function
T operator();
^
1 error detected in the compilation of "<source>".
Compiler returned: 2
@llvm/issue-subscribers-clang-frontend
Author: None (llvmbot)
Extended Description
Following class correctly compiles without any error in Clang 3.0:
However in case of the class template:
Followinge error is generated:
Despite the fact that
Template<void()>
is identical toNonTemplate
.