diff options
author | Erich Keane <erich.keane@intel.com> | 2017-10-12 23:01:53 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2017-10-12 23:01:53 +0000 |
commit | c5c0712284d66ff134dcd7659e38efc3404ada6d (patch) | |
tree | 53ec11c9fe8a3a842a86ce8c66d324cce1fc1a19 /test/CXX | |
parent | 720ba14b8e3f5f4fc58b0e2c05c2ca989ea2bac5 (diff) |
[Sema][Crash] Correctly handle an non-dependent noexcept expr in function template
It seems that all of the other templated cases are handled correctly,
however the function template case was not correctly handled. This
patch recovers from this condition by setting the function to noexcept
after diagnosing. Previously it simply set NoexceptExpr to null,
which caused an Assert when this was evaluated during substitution.
Differential Revision:https://reviews.llvm.org/D38700
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315638 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r-- | test/CXX/except/except.spec/p1.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/CXX/except/except.spec/p1.cpp b/test/CXX/except/except.spec/p1.cpp index fa53c9f5d2..03d75326a6 100644 --- a/test/CXX/except/except.spec/p1.cpp +++ b/test/CXX/except/except.spec/p1.cpp @@ -86,3 +86,12 @@ namespace PR11084 { f<0>(); // expected-note{{in instantiation of function template specialization}} } } + +namespace FuncTmplNoexceptError { + int a = 0; + // expected-error@+1{{argument to noexcept specifier must be a constant expression}} + template <class T> T f() noexcept(a++){ return {};} + void g(){ + f<int>(); + } +}; |