diff options
| author | Faisal Vali <faisalv@yahoo.com> | 2016-07-23 04:05:19 +0000 |
|---|---|---|
| committer | Faisal Vali <faisalv@yahoo.com> | 2016-07-23 04:05:19 +0000 |
| commit | c6b9be29f270e6adc0922cb6e9be000f7102b663 (patch) | |
| tree | 58e796c5e76f0eeac88440340b1072aea8874257 /clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp | |
| parent | a653927e8b98d9877254bebfab0d008c9670dbb0 (diff) | |
| download | bcm5719-llvm-c6b9be29f270e6adc0922cb6e9be000f7102b663.tar.gz bcm5719-llvm-c6b9be29f270e6adc0922cb6e9be000f7102b663.zip | |
[cxx1z-constexpr-lambda] Make a lambda's closure type eligible as a literal-type in C++1z
Additionally, for pre-C++1z, instead of forbidding a lambda's closure type from being a literal type through circumlocutorily setting HasNonLiteralTypeFieldsOrBases falsely to true -- handle lambda's more directly in CXXRecordDecl::isLiteral().
One additional small step towards implementing constexpr-lambdas.
Thanks to Richard Smith for his review!
https://reviews.llvm.org/D22662
llvm-svn: 276514
Diffstat (limited to 'clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp')
| -rw-r--r-- | clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp b/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp index 8e7657fb6e8..610d8144437 100644 --- a/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp +++ b/clang/test/SemaCXX/cxx1z-constexpr-lambdas.cpp @@ -1,8 +1,8 @@ // RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks %s // RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing %s -// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fms-extensions %s -// RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing -fms-extensions %s +// RUN: %clang_cc1 -std=c++14 -verify -fsyntax-only -fblocks %s -DCPP14_AND_EARLIER +#ifndef CPP14_AND_EARLIER namespace test_constexpr_checking { namespace ns1 { @@ -33,4 +33,16 @@ namespace ns3 { L(3); //expected-note{{non-constexpr function}} } -} // end ns test_constexpr_call
\ No newline at end of file +} // end ns test_constexpr_call + +#endif + +namespace test_lambda_is_literal { +#ifdef CPP14_AND_EARLIER +//expected-error@+4{{not a literal type}} +//expected-note@+2{{not an aggregate and has no constexpr constructors}} +#endif +auto L = [] { }; +constexpr int foo(decltype(L) l) { return 0; } + +}
\ No newline at end of file |

