-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Closed
Labels
accepts-invalidc++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"good first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute
Description
Consider this example:
#include <iostream>
struct A
{
void foo() {std::cout << "1\n";}
template <typename T = int>
void foo() {std::cout << "2\n";}
};
int main()
{
A x;
x.template foo();
}
Clang prints 2
. But the code shouldn't be accepted at all, since [temp.names]/5
says that the name after .template
/->template
must be a template-id, aka must have explicitly specified template arguments. Here's a stackoverflow thread.
Note: this doesn't apply to foo::template MyClassTemplate
, which is legal, but seems to be made optional (and deprecated at the same time) in C++2b.
Metadata
Metadata
Assignees
Labels
accepts-invalidc++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"good first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contribute