[PATCH] Exception specification mismatch in explicit instantiation

Richard Smith richard at metafoo.co.uk
Fri Oct 24 13:05:16 PDT 2014


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:3654-3657
@@ -3653,1 +3653,6 @@
   " expected type %3">;
+def err_mismatched_exception_spec_explicit_instantiation : Error<
+  "exception specification in explicit instantiation does not match deduced one">;
+def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
+  "exception specification in explicit instantiation does not match deduced one">,
+  InGroup<Microsoft>;
----------------
"deduced" is not correct here; "instantiated" would be better.

================
Comment at: lib/Sema/SemaTemplate.cpp:7637-7639
@@ +7636,5 @@
+  // other declarations of that function.
+  if (D.isFunctionDeclarator() &&
+      D.getFunctionTypeInfo().getExceptionSpecType() != EST_None) {
+    auto TSI = GetTypeForDeclarator(D, S);
+    unsigned DiagID =
----------------
This is duplicating work the function has already done. (See variables `T` and `R` declared earlier.) Instead of checking whether the declarator has an exception specification, you can instead check whether `R` is a `FunctionProtoType` with an exception specification.

http://reviews.llvm.org/D5822






More information about the cfe-commits mailing list