public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* ODR violation in ranges
@ 2020-03-11 10:08 Nathan Sidwell
  2020-03-11 10:26 ` Jonathan Wakely
  0 siblings, 1 reply; 8+ messages in thread
From: Nathan Sidwell @ 2020-03-11 10:08 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: GCC Patches

Jonathan,
the ranges header contains code like:
     inline constexpr __adaptor::_RangeAdaptorClosure all
       = [] <viewable_range _Range> (_Range&& __r)
       {
  if constexpr (view<decay_t<_Range>>)
    return std::forward<_Range>(__r);
  else if constexpr (requires { ref_view{std::forward<_Range>(__r)}; })
    return ref_view{std::forward<_Range>(__r)};
  else
    return subrange{std::forward<_Range>(__r)};
       };

(line 1236)

When you strip away all the templateyness, you have:


inline constexpr auto all = [] () {};


That's an ODR violation -- the initializers in different TUs are not the 
same!

As you can guess, I can't turn this into a header unit (well, I can, but 
merging duplicates complains at you)

nathan
-- 
Nathan Sidwell

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-03-11 15:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 10:08 ODR violation in ranges Nathan Sidwell
2020-03-11 10:26 ` Jonathan Wakely
2020-03-11 10:56   ` Tam S. B.
2020-03-11 12:47     ` Jonathan Wakely
2020-03-11 13:21     ` Patrick Palka
2020-03-11 15:05     ` Nathan Sidwell
2020-03-11 15:23       ` Jason Merrill
2020-03-11 15:39         ` Nathan Sidwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).