r224526 - Revert "Don't build invalid AST nodes during recovery"

Richard Smith richard at metafoo.co.uk
Thu Dec 18 20:14:04 PST 2014


On Thu, Dec 18, 2014 at 10:17 AM, Reid Kleckner <reid at kleckner.net> wrote:
>
> Author: rnk
> Date: Thu Dec 18 12:17:42 2014
> New Revision: 224526
>
> URL: http://llvm.org/viewvc/llvm-project?rev=224526&view=rev
> Log:
> Revert "Don't build invalid AST nodes during recovery"
>
> This reverts commit r224451. It caused us to reject some valid existing
> code.
>
> This code appears to run in non-error cases as well as error cases. If
> the scope of a DependentScopeDeclRefExpr is still incomplete it probably
> means we still have more instantiation to do.
>

Do you have a testcase for such an instance that could be added here?


> Modified:
>     cfe/trunk/lib/Sema/SemaTemplate.cpp
>     cfe/trunk/test/SemaTemplate/instantiate-dependent-nested-name.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=224526&r1=224525&r2=224526&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaTemplate.cpp Thu Dec 18 12:17:42 2014
> @@ -2874,7 +2874,7 @@ Sema::BuildQualifiedTemplateIdExpr(CXXSc
>    if (!(DC = computeDeclContext(SS, false)) ||
>        DC->isDependentContext() ||
>        RequireCompleteDeclContext(SS, DC))
> -    return ExprError();
> +    return BuildDependentDeclRefExpr(SS, TemplateKWLoc, NameInfo,
> TemplateArgs);
>
>    bool MemberOfUnknownSpecialization;
>    LookupResult R(*this, NameInfo, LookupOrdinaryName);
>
> Modified: cfe/trunk/test/SemaTemplate/instantiate-dependent-nested-name.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-dependent-nested-name.cpp?rev=224526&r1=224525&r2=224526&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/SemaTemplate/instantiate-dependent-nested-name.cpp
> (original)
> +++ cfe/trunk/test/SemaTemplate/instantiate-dependent-nested-name.cpp Thu
> Dec 18 12:17:42 2014
> @@ -1,19 +1,8 @@
>  // RUN: %clang_cc1 -fsyntax-only -verify %s
> -
> +// expected-no-diagnostics
>  // PR4382
>  template<typename T> struct X { static const T A = 1; };
>  template<typename T, bool = X<T>::A> struct Y { typedef T A; };
>  template<typename T> struct Z { typedef typename Y<T>::A A; };
>  extern int x;
>  extern Z<int>::A x;
> -
> -namespace pr21964 {
> -struct H;
> -template <class> struct T {
> -  struct A; // expected-note {{member is declared here}}
> -  static void B() {
> -    A::template N<H>; // expected-error {{implicit instantiation of
> undefined member 'pr21964::T<pr21964::H>::A'}}
> -  }
> -};
> -template struct T<H>; // expected-note {{requested here}}
> -}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141218/04a557db/attachment.html>


More information about the cfe-commits mailing list