[PATCH] D16396: Warn if variable cannot be implicitly instantiated
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 15 15:15:39 PDT 2016
rsmith added a comment.
I have a lingering concern with this style of formatting, because it risks making our diagnostics (more) ambiguous. Consider this:
template<typename T> struct X {};
struct T {};
X<T> xt;
If we give a diagnostic talking about `X<T>`, it's ambiguous whether we're referring to the `X` template itself or the concrete type of `xt`. That said, the actual diagnostic changes here do look like improvements, particularly because the template parameter names we're using are typically in scope at the point where we issue the diagnostic (so there is no ambiguity). On the whole, I think the risk of ambiguity is less than the benefit here.
================
Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:3611
@@ +3610,3 @@
+ if (AtEndOfTU && !getDiagnostics().hasErrorOccurred()) {
+ Diag(PointOfInstantiation, diag::warn_func_template_missing)
+ << Function << PatternDecl;
----------------
I would still like this note to be added to the diagnostic.
================
Comment at: test/OpenMP/parallel_ast_print.cpp:135
@@ -134,3 +134,3 @@
// CHECK: static T TS;
-// CHECK-NEXT: #pragma omp threadprivate(S::TS)
+// CHECK-NEXT: #pragma omp threadprivate(S<T>::TS)
// CHECK: };
----------------
This looks like an undesirable change. Can you turn off `PrintTemplateArguments` by default and turn it on only for `%t` in diagnostics?
http://reviews.llvm.org/D16396
More information about the cfe-commits
mailing list