[clang] Do not crash on "requires" after a fatal error occurred.
authorAdam Czachorowski <adamcz@google.com>
Mon, 11 Jul 2022 15:29:12 +0000 (17:29 +0200)
committerAdam Czachorowski <adamcz@google.com>
Thu, 14 Jul 2022 13:45:32 +0000 (15:45 +0200)
commitcab3cfd013cf92c441c3acbfcc1844b267ab8659
treec7aba94303187827f7f2828e32829d5da522be2a
parent355c7916336fb4922946a8cfc174dbdb514dddb5
[clang] Do not crash on "requires" after a fatal error occurred.

The code would assume that SubstExpr() cannot fail on concept
specialization. This is incorret - we give up on some things after fatal
error occurred, since there's no value in doing futher work that the
user will not see anyway. In this case, this lead to crash.

The fatal error is simulated in tests with -ferror-limit=1, but this
could happen in other cases too.

Fixes https://github.com/llvm/llvm-project/issues/55401

Differential Revision: https://reviews.llvm.org/D129499
clang/lib/Sema/SemaExprCXX.cpp
clang/test/SemaCXX/concept-fatal-error.cpp [new file with mode: 0644]