[PATCH] D68849: [Parse] Don't speculatively parse an identifier in the wrong context.

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 18:26:37 PDT 2019


efriedma created this revision.
efriedma added a reviewer: rsmith.
Herald added a project: clang.

When we see something like `i<i`, we try to check whether the second "i" refers to a type.  However, when we do this, we can end up creating an expression in the wrong context: the "<" has different parse priority if it's actually a relational operator.

To fix the issue, just remove the check.  This makes diagnostics slightly worse, but avoids the crash.  I'm not really happy with this, but I don't see another way to fix this without implementing a giant refactoring.

Fixes https://bugs.llvm.org/show_bug.cgi?id=43080 (but not the issues currently marked as "duplicate"; I haven't dug deeply into the causes of those issues).


Repository:
  rC Clang

https://reviews.llvm.org/D68849

Files:
  lib/Parse/ParseTemplate.cpp
  test/CXX/basic/basic.lookup/basic.lookup.unqual/p3.cpp
  test/CodeGenCXX/odr-use.cpp
  test/SemaCXX/cxx1y-variable-templates_top_level.cpp
  test/SemaTemplate/typo-template-name.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68849.224518.patch
Type: text/x-patch
Size: 7065 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191011/73710933/attachment.bin>


More information about the cfe-commits mailing list