-
Notifications
You must be signed in to change notification settings - Fork 13.4k
non-dependent name treated as if it were dependent, requiring use of template keyword #37647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
*** Bug #37644 has been marked as a duplicate of this bug. *** |
Reduced this a little further: struct foo { You can assign the result of f2() to a local, so long as the type is written as 'auto' and not 'foo' the behavior is still the same - the f1 call is considered dependent and needs the 'template' keyword when it seems like it shouldn't? Maybe this test case is less convincing than the original - the original, using a (non-templated/non-depnedent) base class to contain 'f2' maybe makes it clearer that 'f2' is not dependent, whereas I guess the call to f2 could be dependent in some sense? Not sure. |
FWIW, there's a FIXME in include/clang/AST/Redeclarable.h where we're working around this bug in Clang's own source code. |
I hit exactly this issue too. https://bugs.llvm.org//show_bug.cgi?id=17401 also exists, but it doesn't seem to be an exact duplicate as it does not use inheritance in the repro. *** This bug has been marked as a duplicate of bug #17775 *** |
Another maybe-interesting datapoint - CL.exe 19.14.26430 (ie Visual Studio 15.7 I think) with /permissive- rejected code with the incorrect template keyword. CL.exe 19.15.26726 (Visual Studio 15.8) with /permissive- accepts it and ignores the extra template keyword. Presumably customers added the keyword to fix their clang build, and when VC++ permissive mode rejected it, customers complained and the change was backed out. I hit this issue in FBX SDK headers. |
As noted in this bug report: llvm#37647 Due to this clang bug we added the template keyword in Redeclarable.h. The bug has been fixed since then, so removing it.
As noted in this bug report: #37647 Due to this clang bug we added the template keyword in Redeclarable.h. The bug has been fixed since then, so removing it.
As noted in this bug report: llvm/llvm-project#37647 Due to this clang bug we added the template keyword in Redeclarable.h. The bug has been fixed since then, so removing it.
Extended Description
This example fails to compile on the marked line, but nothing here is dependent.
struct X {
template
void foo();
};
struct Base {
X get();
};
template
struct Derived : Base
{
void foo() {
auto result = Base::get();
result.foo(); // (*)
}
};
template struct Derived;
The error message is:
error: use 'template' keyword to treat 'foo' as a dependent template name
result.foo(); // (*)
^
template
1 error generated.
BTW, g++ accepts the code.
The text was updated successfully, but these errors were encountered: