aaron.ballman added inline comments.

================
Comment at: clang/lib/Sema/SemaType.cpp:6970
+    if (Proto->hasExceptionSpec())
+      return true;
+
----------------
erichkeane wrote:
> aaron.ballman wrote:
> > I think we should diagnose that the `nothrow` is ignored in this case to 
> > let users know they've done something in conflict and what wins.
> I've been considering that over the weekend, and agree it is a good idea. I 
> am on the fence about the when however. For example, should we warn with 
> throw() or noexcept or noexcept(true)? In these cases, ignoring the attribute 
> is the same as enforcing it.
> 
> My concern is that noexcept (expression-evaluating-to-true) gets ignored with 
> a diagnostic, but has the same effect.
> 
> Did you have an opinion here?
I think the metric should be: if there are conflicting attributes where we need 
to ignore one of them, we should always diagnose when the attributes specify 
conflicting semantics, but we don't have to always diagnose when the attributes 
specify the same semantics. In this case, e.g.,
```
__declspec(nothrow) void foo1() noexcept; // Don't bother warning
__declspec(nothrow) void foo2() noexcept(true); // Don't bother warning
__declspec(nothrow) void foo3() noexcept(false); // Warn
__declspec(nothrow) void foo4() noexcept(foo1()); // Warning is debatable
__declspec(nothrow) void foo5() noexcept(foo3()); // Warn
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62435/new/

https://reviews.llvm.org/D62435



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to