[PATCH] D136554: Implement CWG2631

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 16 01:41:52 PST 2022


cor3ntin added a comment.

In D136554#4000363 <https://reviews.llvm.org/D136554#4000363>, @rupprecht wrote:

> I applied this version of the patch and the crash is now gone 🎉
>
> However, now I get this inexplicable error -- I'm not entirely sure it's related, maybe I'm holding it wrong:
>
>   In module '<foo>':
>   foo.h$line:$num: error: 'foo::FooClass' has different definitions in different modules; first difference is definition in module 'something.h' found data member 'kFooDelimiter' with an initializer
>     static constexpr char kFooDelimiter = '+';
>     ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
>   foo.h:$line:$num note: but in 'other.h' found data member 'kFooDelimiter' with a different initializer
>     static constexpr char kFooDelimiter = '+';
>     ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
>
> The definition seems straightforward:
>
>   class FooClass final {
>     ...
>     static constexpr char kFooDelimiter = '+';
>     ...
>   };

This is *very* surprising to me.
I could explain it if  the member was not static though, as it would be the kind of things the patch affects. But static data members are handled very differently.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136554



More information about the cfe-commits mailing list