[PATCH] D154324: [C++20] [Modules] [ODRHash] Use CanonicalType for base classes

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 19 15:57:40 PDT 2023


alexfh added a comment.

Hi, we've started seeing compilation errors with our modularized build after this commit. The errors say `'SomeType' has different definitions in different modules`, but then point to the same definition that comes from the same textual header included into two modules.

The setup (which I couldn't completely isolate yet) is roughly similar to this (hopefully, I didn't miss any important parts):

Textual header p.h:

  #include <type_traits>
  
  #include "protobuf/generated_enum_util.h"
  ...
  
  template <typename T,
            typename =
                typename std::enable_if<proto2::is_proto_enum<T>::value>::type>
  class SomeType : E<S<T>> {
  ...
  };

Textual header a.h:

  #include <type_traits>
  
  #include "protobuf/generated_enum_util.h"
  
  namespace q {
  template <typename T,
            typename std::enable_if<::proto2::is_proto_enum<T>::value>::type>
  class X {};
  }
  
  #include "p.h"

Textual header b.h:

  // ...
  // something likely unrelated
  // ...
  #include "p.h"

Module C, c.h:

  #include "a.h"
  #include "b.h"


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154324



More information about the cfe-commits mailing list