diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-11-26 03:26:53 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-11-26 03:26:53 +0000 |
commit | 410cc893745ee511d51009b712bb987a8a980c24 (patch) | |
tree | 2f316b083c6b4ccf061e6c8fdb9c4d8f9a1cf566 /clang/lib/Sema/SemaExprCXX.cpp | |
parent | 1686e4e4b9d2a58dcc726f15b37013159a0e246d (diff) | |
download | bcm5719-llvm-410cc893745ee511d51009b712bb987a8a980c24.tar.gz bcm5719-llvm-410cc893745ee511d51009b712bb987a8a980c24.zip |
[c++1z] Most of N4268 (allow constant evaluation for non-type template arguments).
We don't yet support pointer-to-member template arguments that have undergone
pointer-to-member conversions, mostly because we don't have a mangling for them yet.
llvm-svn: 222807
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index c71a4e93bbd..0d11e42d55e 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -2780,10 +2780,29 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, // Perform the second implicit conversion switch (SCS.Second) { case ICK_Identity: - // If both sides are functions (or pointers/references to them), there could - // be incompatible exception declarations. - if (CheckExceptionSpecCompatibility(From, ToType)) - return ExprError(); + // C++ [except.spec]p5: + // [For] assignment to and initialization of pointers to functions, + // pointers to member functions, and references to functions: the + // target entity shall allow at least the exceptions allowed by the + // source value in the assignment or initialization. + switch (Action) { + case AA_Assigning: + case AA_Initializing: + // Note, function argument passing and returning are initialization. + case AA_Passing: + case AA_Returning: + case AA_Sending: + case AA_Passing_CFAudited: + if (CheckExceptionSpecCompatibility(From, ToType)) + return ExprError(); + break; + + case AA_Casting: + case AA_Converting: + // Casts and implicit conversions are not initialization, so are not + // checked for exception specification mismatches. + break; + } // Nothing else to do. break; |