vsapsai added a comment.

Found another case that doesn't emit an error

  #if defined(FIRST)
  struct Indirect {
    int x;
  };
  struct Direct {
    struct Indirect i;
  };
  #elif defined(SECOND)
  struct Indirect {
    double a;
  };
  struct Direct {
    struct Indirect i;
  };
  #else
  struct Direct d;
  #endif

According to my debugging there is no error because `Direct` fields aren't 
deserialized in -fsyntax-only mode and therefore `Indirect` definitions aren't 
compared. But during IRGen there is diagnostic and that's because calculating 
record layout triggers full deserialization. Also there is diagnostic in C++ 
because we are dealing with default initialization and 
`DeclareImplicitDefaultConstructor` iterates through all the fields 
deserializing them.

I believe the best user experience is consistent diagnostic, so we should emit 
the error even with -fsyntax-only. If anybody has any objections, please let me 
know, it would save time.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71734

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D71734: [Modules]... Volodymyr Sapsai via Phabricator via cfe-commits

Reply via email to