1*67e74705SXin Li // RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks %s 2*67e74705SXin Li // RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing %s 3*67e74705SXin Li // RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fms-extensions %s 4*67e74705SXin Li // RUN: %clang_cc1 -std=c++1z -verify -fsyntax-only -fblocks -fdelayed-template-parsing -fms-extensions %s 5*67e74705SXin Li 6*67e74705SXin Li namespace test_constexpr_checking { 7*67e74705SXin Li 8*67e74705SXin Li namespace ns1 { 9*67e74705SXin Li struct NonLit { ~NonLit(); }; //expected-note{{not literal}} __anon2d3cfe550102(NonLit NL) 10*67e74705SXin Li auto L = [](NonLit NL) constexpr { }; //expected-error{{not a literal type}} 11*67e74705SXin Li } // end ns1 12*67e74705SXin Li 13*67e74705SXin Li namespace ns2 { __anon2d3cfe550202(int I) 14*67e74705SXin Li auto L = [](int I) constexpr { asm("non-constexpr"); }; //expected-error{{not allowed in constexpr function}} 15*67e74705SXin Li } // end ns1 16*67e74705SXin Li 17*67e74705SXin Li } // end ns test_constexpr_checking 18*67e74705SXin Li 19*67e74705SXin Li namespace test_constexpr_call { 20*67e74705SXin Li 21*67e74705SXin Li namespace ns1 { __anon2d3cfe550302(int I) 22*67e74705SXin Li auto L = [](int I) { return I; }; 23*67e74705SXin Li static_assert(L(3) == 3); 24*67e74705SXin Li } // end ns1 25*67e74705SXin Li namespace ns2 { __anon2d3cfe550402(auto a) 26*67e74705SXin Li auto L = [](auto a) { return a; }; 27*67e74705SXin Li static_assert(L(3) == 3); 28*67e74705SXin Li static_assert(L(3.14) == 3.14); 29*67e74705SXin Li } 30*67e74705SXin Li namespace ns3 { __anon2d3cfe550502(auto a) 31*67e74705SXin Li auto L = [](auto a) { asm("non-constexpr"); return a; }; //expected-note{{declared here}} 32*67e74705SXin Li constexpr int I = //expected-error{{must be initialized by a constant expression}} 33*67e74705SXin Li L(3); //expected-note{{non-constexpr function}} 34*67e74705SXin Li } 35*67e74705SXin Li 36*67e74705SXin Li } // end ns test_constexpr_call