[PATCH] D95145: [clang] Fix a nullptr dereference bug on invalid code

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 25 05:55:32 PST 2021


hokein accepted this revision.
hokein added a comment.
This revision is now accepted and ready to land.

Thanks.



================
Comment at: clang/test/SemaCXX/subst-func-type-invalid-ret-type.cpp:2
+// RUN: %clang -fsyntax-only -std=c++17 %s -Xclang -verify
+#include <type_traits>
+
----------------
adamcz wrote:
> adamcz wrote:
> > hokein wrote:
> > > A common practice is to avoid depending on STL in tests. I think we need to pull out (even simplify?) std::result_of implementation if it is needed for reproducing the crash.
> > I've noticed that pattern, but can't tell why this is. Is it documented somewhere?
> > 
> Anyway, I updated the change to not require type_traits. Turned out to be simpler than expected ;-)
> I've noticed that pattern, but can't tell why this is. Is it documented somewhere?

I did try to find some documentation about this before making the previous comment, but didn't find any.

Depending on the clang builtin includes is legitimate, but depending on the stand library is more complicated, it would hurt hermeticity of the test -- you may not always get the exact behavior you intend to test (as it may depend on the stand library versions, host environment etc).



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95145/new/

https://reviews.llvm.org/D95145



More information about the cfe-commits mailing list