[PATCH] D113118: [clang][AST] Check context of record in structural equivalence.

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 30 12:14:33 PST 2021


shafik added inline comments.


================
Comment at: clang/unittests/AST/StructuralEquivalenceTest.cpp:1037
+                     "void foo(struct Param { int a; } *p);", Lang_C89);
+  EXPECT_TRUE(testStructuralMatch(Decls));
+}
----------------
balazske wrote:
> shafik wrote:
> > I expect this to be `false` the outer `Param` is not the same type as the `Param` in the parameter.
> There is a test **ctu-main.c** that fails if this is `false`. In that code a similar construct as here (`structInProto`) is imported and the import fails because unsupported construct. If these are structurally not equivalent then the failure is a ODR like error (the `Param` inside the function prototype is different than the `Param` outside of it). I do not know which is the correct behavior, I think the intent in that test is that import of this construct should work (if it would be supported by ASTImporter) at least in the C case.
They are `compatible types`, so if that is the criteria then that looks reasonable. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113118



More information about the cfe-commits mailing list