]> granicus.if.org Git - clang/commit
[NFC] Change the evaluation context of a non-type default template argument from...
authorFaisal Vali <faisalv@yahoo.com>
Wed, 18 Nov 2015 04:29:22 +0000 (04:29 +0000)
committerFaisal Vali <faisalv@yahoo.com>
Wed, 18 Nov 2015 04:29:22 +0000 (04:29 +0000)
commitd1e455aa3150f6ab36378137c8164093697172ce
tree48aa890ed68d54a8a158c5e4c8ee149fe5f2d1b3
parent355e9ff21bd7dcc4294fb830657b6eaafb050739
[NFC] Change the evaluation context of a non-type default template argument from Unevaluated to ConstantEvaluated.

This patch emits a more appropriate (but still noisy) diagnostic stream when a lambda-expression is encountered within a non-type default argument.

For e.g. template<int N = ([] { return 5; }())> int f();

As opposed to complaining that a lambda expression is not allowed in an unevaluated operand, the patch complains about the lambda being forbidden in a constant expression context (which will be allowed in C++17 now that they have been accepted by EWG, unless of course CWG or national bodies (that have so far shown no signs of concern) rise in protest)

As I start submitting patches for constexpr lambdas (http://wg21.link/P0170R0) under C++1z (OK'd by Richard Smith at Kona), this will be one less change to make.

Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253431 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Parse/ParseTemplate.cpp
test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp