This fixes https://github.com/llvm/llvm-project/issues/55962
i.e. instead of the output being
./test.cpp:5:9: error: 'x' is not a class, namespace, or enumeration
int y = x::a;
^
./test.cpp:2:8: note: 'x' declared here
struct x;
^
1 error generated.it is now:
./test.cpp:5:9: error: use of class template 'x' requires template arguments
int y = x::a;
^
./test.cpp:2:8: note: template is declared here
struct x;
^
1 error generated.Note that the call to isTemplateName() is basically copied from DiagnoseUnknownTypeName() in SemaDecl.cpp. However, just calling that from SemaCXXScopeSpec.cpp as well makes the SemaObjCXX/property-dot-error.mm test fail, because it now outputs
clang/test/SemaObjCXX/propert-dot-error.mm Line 67: unknown type name 'D'; did you mean 'D'? clang/test/SemaObjCXX/propert-dot-error.mm Line 68: unknown type name 'D'; did you mean 'D'?
and I don't know enough about objc to fix this, but if anyone has some pointers I'd be happy to avoid the code duplication.