<div dir="ltr">Should be fixed in r332425. Apologies for the delay addressing this.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 15 May 2018 at 18:10, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Sorry for the delay, looking now.</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 15 May 2018 at 02:24, Maxim Kuvyrkov <span dir="ltr"><<a href="mailto:maxim.kuvyrkov@linaro.org" target="_blank">maxim.kuvyrkov@linaro.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Richard,<br>
<br>
The for-range-examples.cpp test fails on 32-bit arm buildbots, e.g.: <a href="http://lab.llvm.org:8011/builders/clang-cmake-armv7-full/builds/840" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/build<wbr>ers/clang-cmake-armv7-full/<wbr>builds/840</a> .  Would you please investigate?<br>
<br>
You didn't get a notification because your commit was around the same time as a fix for an unrelated testcase issue that caused same bots to be red.<br>
<br>
--<br>
Maxim Kuvyrkov<br>
<a href="http://www.linaro.org" rel="noreferrer" target="_blank">www.linaro.org</a><br>
<div class="m_-7945031434966541942HOEnZb"><div class="m_-7945031434966541942h5"><br>
<br>
<br>
> On May 14, 2018, at 11:15 PM, Richard Smith via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br>
> <br>
> Author: rsmith<br>
> Date: Mon May 14 13:15:04 2018<br>
> New Revision: 332286<br>
> <br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=332286&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=332286&view=rev</a><br>
> Log:<br>
> PR37450: Fix bug that disabled some type checks for variables with deduced types.<br>
> <br>
> Also improve diagnostic for the case where a type is non-literal because it's a lambda.<br>
> <br>
> Modified:<br>
>    cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td<br>
>    cfe/trunk/lib/Sema/SemaDecl.cp<wbr>p<br>
>    cfe/trunk/lib/Sema/SemaType.cp<wbr>p<br>
>    cfe/trunk/test/CXX/expr/expr.p<wbr>rim/expr.prim.lambda/p3.cpp<br>
>    cfe/trunk/test/SemaCXX/cxx1z-c<wbr>onstexpr-lambdas.cpp<br>
>    cfe/trunk/test/SemaCXX/for-ran<wbr>ge-examples.cpp<br>
> <br>
> Modified: cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=332286&r1=332285&r2=332286&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/include/clang/<wbr>Basic/DiagnosticSemaKinds.td?<wbr>rev=332286&r1=332285&r2=<wbr>332286&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td (original)<br>
> +++ cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td Mon May 14 13:15:04 2018<br>
> @@ -2381,6 +2381,8 @@ def note_non_literal_user_provided<wbr>_dtor<br>
>   "%0 is not literal because it has a user-provided destructor">;<br>
> def note_non_literal_nontrivial_dt<wbr>or : Note<<br>
>   "%0 is not literal because it has a non-trivial destructor">;<br>
> +def note_non_literal_lambda : Note<<br>
> +  "lambda closure types are non-literal types before C++17">;<br>
> def warn_private_extern : Warning<<br>
>   "use of __private_extern__ on a declaration may not produce external symbol "<br>
>   "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;<br>
> <br>
> Modified: cfe/trunk/lib/Sema/SemaDecl.cp<wbr>p<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=332286&r1=332285&r2=332286&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/Sema/SemaD<wbr>ecl.cpp?rev=332286&r1=332285&<wbr>r2=332286&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/lib/Sema/SemaDecl.cp<wbr>p (original)<br>
> +++ cfe/trunk/lib/Sema/SemaDecl.cp<wbr>p Mon May 14 13:15:04 2018<br>
> @@ -7293,8 +7293,7 @@ void Sema::CheckVariableDeclaration<wbr>Type(<br>
>   if (NewVD->isInvalidDecl())<br>
>     return;<br>
> <br>
> -  TypeSourceInfo *TInfo = NewVD->getTypeSourceInfo();<br>
> -  QualType T = TInfo->getType();<br>
> +  QualType T = NewVD->getType();<br>
> <br>
>   // Defer checking an 'auto' type until its initializer is attached.<br>
>   if (T->isUndeducedType())<br>
> @@ -7438,10 +7437,18 @@ void Sema::CheckVariableDeclaration<wbr>Type(<br>
>       (T->isVariableArrayType() && NewVD->hasGlobalStorage())) {<br>
>     bool SizeIsNegative;<br>
>     llvm::APSInt Oversized;<br>
> -    TypeSourceInfo *FixedTInfo =<br>
> -      TryToFixInvalidVariablyModifie<wbr>dTypeSourceInfo(TInfo, Context,<br>
> -                                                    SizeIsNegative, Oversized);<br>
> -    if (!FixedTInfo && T->isVariableArrayType()) {<br>
> +    TypeSourceInfo *FixedTInfo = TryToFixInvalidVariablyModifie<wbr>dTypeSourceInfo(<br>
> +        NewVD->getTypeSourceInfo(), Context, SizeIsNegative, Oversized);<br>
> +    QualType FixedT;<br>
> +    if (FixedTInfo &&  T == NewVD->getTypeSourceInfo()->ge<wbr>tType())<br>
> +      FixedT = FixedTInfo->getType();<br>
> +    else if (FixedTInfo) {<br>
> +      // Type and type-as-written are canonically different. We need to fix up<br>
> +      // both types separately.<br>
> +      FixedT = TryToFixInvalidVariablyModifie<wbr>dType(T, Context, SizeIsNegative,<br>
> +                                                   Oversized);<br>
> +    }<br>
> +    if ((!FixedTInfo || FixedT.isNull()) && T->isVariableArrayType()) {<br>
>       const VariableArrayType *VAT = Context.getAsVariableArrayType<wbr>(T);<br>
>       // FIXME: This won't give the correct result for<br>
>       // int a[10][n];<br>
> @@ -7470,7 +7477,7 @@ void Sema::CheckVariableDeclaration<wbr>Type(<br>
>     }<br>
> <br>
>     Diag(NewVD->getLocation(), diag::warn_illegal_constant_ar<wbr>ray_size);<br>
> -    NewVD->setType(FixedTInfo->get<wbr>Type());<br>
> +    NewVD->setType(FixedT);<br>
>     NewVD->setTypeSourceInfo(Fixe<wbr>dTInfo);<br>
>   }<br>
> <br>
> <br>
> Modified: cfe/trunk/lib/Sema/SemaType.cp<wbr>p<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=332286&r1=332285&r2=332286&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/Sema/SemaT<wbr>ype.cpp?rev=332286&r1=332285&<wbr>r2=332286&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/lib/Sema/SemaType.cp<wbr>p (original)<br>
> +++ cfe/trunk/lib/Sema/SemaType.cp<wbr>p Mon May 14 13:15:04 2018<br>
> @@ -7809,6 +7809,13 @@ bool Sema::RequireLiteralType(Sourc<wbr>eLoca<br>
>   if (RequireCompleteType(Loc, ElemType, diag::note_non_literal_incompl<wbr>ete, T))<br>
>     return true;<br>
> <br>
> +  // [expr.prim.lambda]p3:<br>
> +  //   This class type is [not] a literal type.<br>
> +  if (RD->isLambda() && !getLangOpts().CPlusPlus17) {<br>
> +    Diag(RD->getLocation(), diag::note_non_literal_lambda)<wbr>;<br>
> +    return true;<br>
> +  }<br>
> +<br>
>   // If the class has virtual base classes, then it's not an aggregate, and<br>
>   // cannot have any constexpr constructors or a trivial default constructor,<br>
>   // so is non-literal. This is better to diagnose than the resulting absence<br>
> <br>
> Modified: cfe/trunk/test/CXX/expr/expr.p<wbr>rim/expr.prim.lambda/p3.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp?rev=332286&r1=332285&r2=332286&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/test/CXX/expr/<wbr>expr.prim/expr.prim.lambda/p3.<wbr>cpp?rev=332286&r1=332285&r2=<wbr>332286&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/test/CXX/expr/expr.p<wbr>rim/expr.prim.lambda/p3.cpp (original)<br>
> +++ cfe/trunk/test/CXX/expr/expr.p<wbr>rim/expr.prim.lambda/p3.cpp Mon May 14 13:15:04 2018<br>
> @@ -1,11 +1,19 @@<br>
> // RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify<br>
> +// RUN: %clang_cc1 -fsyntax-only -std=c++14 %s -verify<br>
> +// RUN: %clang_cc1 -fsyntax-only -std=c++17 %s -verify<br>
> <br>
> void test_nonaggregate(int i) {<br>
>   auto lambda = [i]() -> void {}; // expected-note 2{{candidate constructor}}<br>
>   decltype(lambda) foo = { 1 }; // expected-error{{no matching constructor}}<br>
> -  static_assert(!__is_literal(de<wbr>cltype(lambda)), "");<br>
> +  static_assert(__is_literal(dec<wbr>ltype(lambda)) == (__cplusplus >= 201703L), "");<br>
> <br>
>   auto lambda2 = []{}; // expected-note 2{{candidate constructor}}<br>
>   decltype(lambda2) bar = {}; // expected-error{{no matching constructor}}<br>
> -  static_assert(!__is_literal(de<wbr>cltype(lambda2)), "");<br>
> +  static_assert(__is_literal(dec<wbr>ltype(lambda2)) == (__cplusplus >= 201703L), "");<br>
> }<br>
> +<br>
> +constexpr auto literal = []{};<br>
> +#if __cplusplus < 201703L<br>
> +// expected-error@-2 {{constexpr variable cannot have non-literal type}}<br>
> +// expected-note@-3 {{lambda closure types are non-literal types before C++17}}<br>
> +#endif<br>
> <br>
> Modified: cfe/trunk/test/SemaCXX/cxx1z-c<wbr>onstexpr-lambdas.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1z-constexpr-lambdas.cpp?rev=332286&r1=332285&r2=332286&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/test/SemaCXX/<wbr>cxx1z-constexpr-lambdas.cpp?<wbr>rev=332286&r1=332285&r2=<wbr>332286&view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/test/SemaCXX/cxx1z-c<wbr>onstexpr-lambdas.cpp (original)<br>
> +++ cfe/trunk/test/SemaCXX/cxx1z-c<wbr>onstexpr-lambdas.cpp Mon May 14 13:15:04 2018<br>
> @@ -6,7 +6,7 @@<br>
> namespace test_lambda_is_literal {<br>
> #ifdef CPP14_AND_EARLIER<br>
> //expected-error@+4{{not a literal type}}<br>
> -//expected-note@+2{{not an aggregate and has no constexpr constructors}}<br>
> +//expected-note@+2{{lambda closure types are non-literal types before C++17}}<br>
> #endif<br>
> auto L = [] { };<br>
> constexpr int foo(decltype(L) l) { return 0; }<br>
> <br>
> Modified: cfe/trunk/test/SemaCXX/for-ran<wbr>ge-examples.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/for-range-examples.cpp?rev=332286&r1=332285&r2=332286&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/test/SemaCXX/<wbr>for-range-examples.cpp?rev=<wbr>332286&r1=332285&r2=332286&<wbr>view=diff</a><br>
> ==============================<wbr>==============================<wbr>==================<br>
> --- cfe/trunk/test/SemaCXX/for-ran<wbr>ge-examples.cpp (original)<br>
> +++ cfe/trunk/test/SemaCXX/for-ran<wbr>ge-examples.cpp Mon May 14 13:15:04 2018<br>
> @@ -221,11 +221,7 @@ namespace test7 {<br>
>     for (c alignas(8) : arr) { // expected-error {{requires type for loop variable}}<br>
>       static_assert(alignof(c) == 8, ""); // expected-warning {{extension}}<br>
>     }<br>
> -    // FIXME: The fix-it hint here is not sufficient to fix the error.<br>
> -    // We fail to diagnose that d is underaligned for its type, because<br>
> -    // we check the alignment attribute before we perform the auto<br>
> -    // deduction.<br>
> -    for (d alignas(1) : arr) {} // expected-error {{requires type for loop variable}}<br>
> +    for (d alignas(1) : arr) {} // expected-error {{requested alignment is less than minimum alignment of 8 for type 'int &'}} expected-error {{requires type for loop variable}}<br>
>     for (e [[deprecated]] : arr) { e = 0; } // expected-warning {{deprecated}} expected-note {{here}} expected-error {{requires type for loop variable}}<br>
>   }<br>
> }<br>
> @@ -274,4 +270,4 @@ int foo(int b) {<br>
>   }();<br>
>   return b;<br>
> }<br>
> -}<br>
> \ No newline at end of file<br>
> +}<br>
> <br>
> <br>
> ______________________________<wbr>_________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>