[Sema] Warn on attribute nothrow conflicting with language specifiers
authorErich Keane <erich.keane@intel.com>
Thu, 28 Sep 2017 20:36:53 +0000 (20:36 +0000)
committerErich Keane <erich.keane@intel.com>
Thu, 28 Sep 2017 20:36:53 +0000 (20:36 +0000)
commitc372e15c4e4a448e43924ad3405e81ed771c928c
tree16f4cc37d737c210ddb72f643ac893d675be7134
parent8eec6dde6a7df7ba8d5916da512bcc28384ee3ef
[Sema] Warn on attribute nothrow conflicting with language specifiers

I discovered it was possible to create a 'nothrow' noexcept(false)
function, which is both non-sensical as well as seemingly breaking.

This patch warns if attribute nothrow is used with anything besides "noexcept".

"noexcept(true)" isn't possible, because the noexcept decl isn't parsed until
later.

Differential Revision: https://reviews.llvm.org/D38205

llvm-svn: 314461
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/SemaCXX/warn-conflicting-nothrow-attr-exception-spec.cpp [new file with mode: 0644]