[PATCH] D103395: PR45879: Keep evaluated expression in LValue object

Raul Tambre via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 29 04:23:43 PDT 2021


tambre added a comment.

This breaks the following code:

  struct sub
  {
  	char data;
  };
  
  struct main
  {
  	constexpr main()
  	{
  		member = {};
  	}
  
  	sub member;
  };
  
  constexpr main a{};

With:

  fmt.cpp:16:16: error: constexpr variable 'a' must be initialized by a constant expression
  constexpr main a{};
                 ^~~
  1 error generated.

Clang trunk and GCC (Debian 11.2.0-10) handle it fine.
Noticed in libfmt <https://github.com/fmtlib/fmt/issues/2571#issuecomment-953887675>.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103395



More information about the cfe-commits mailing list