[Bug libstdc++/116549] std::disable_sized_sentinel_for is missing specialisation for std::move_iterator

2024-08-31 Thread daniel.kruegler at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116549

Daniel Krügler  changed:

   What|Removed |Added

 CC||daniel.kruegler@googlemail.
   ||com

--- Comment #2 from Daniel Krügler  ---
(In reply to Zhao Dai from comment #1)
> Just found a report in 2022: https://cplusplus.github.io/LWG/issue3736
> 
> Unfortunately, it's not resolved yet despite it seems an easy fix.

Why do you think it is not resolved? The issue says that it was accepted in
Kona 2022 into the working paper and affects C++23.

[Bug libstdc++/113470] Should std::tuple_size be a complete type?

2024-01-18 Thread daniel.kruegler at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113470

--- Comment #1 from Daniel Krügler  ---
I think the essence is how [tuple.helper] p4 is specified. Combining with
[tuple.syn],

template struct tuple_size; // not defined
template struct tuple_size;

I tend to read that a definition is required for tuple_size. I would
understand if that interpretation is not universally accepted.

[Bug libstdc++/108760] ranges::iota is not included in

2024-01-10 Thread daniel.kruegler at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108760

--- Comment #3 from Daniel Krügler  ---
(In reply to Michael Levine from comment #2)
> (In reply to Daniel Krügler from comment #1)
> > (In reply to 康桓瑋 from comment #0)
> > > It seems wrong that libstdc++ needs to include  for 
> > > ranges::iota.
> > 
> > I agree, this looks like a defect, both std::iota and std::ranges:iota are
> > specified to be part of header 
> 
> Should it not require including  even though it seems to be a use
> of a constrained algorithm through C++20 that is in the namespace
> std::ranges?  https://en.cppreference.com/w/cpp/algorithm

Following https://cplusplus.github.io/LWG/lwg-defects.html#1178 we have
according to [res.on.headers] p1

"A C++ header shall provide the declarations and definitions that appear in its
synopsis."

and I'm interpreting this that an implementation needs to make it work without
requiring the user to include .

But we have https://cplusplus.github.io/LWG/issue3679 which raises a similar
question for a different issue. If the libstdc++ maintainers think that the
current wording does require a conforming program to include , I
think that an LWG issue would be required.

[Bug c++/112099] GCC doesn't recognize matching friend operator!= to resolve ambiguity in operator==

2023-10-26 Thread daniel.kruegler at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112099

Daniel Krügler  changed:

   What|Removed |Added

 CC||daniel.kruegler@googlemail.
   ||com

--- Comment #1 from Daniel Krügler  ---
This could be related to https://cplusplus.github.io/CWG/issues/2804.html

[Bug libstdc++/108760] ranges::iota is not included in

2023-08-06 Thread daniel.kruegler at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108760

Daniel Krügler  changed:

   What|Removed |Added

 CC||daniel.kruegler@googlemail.
   ||com

--- Comment #1 from Daniel Krügler  ---
(In reply to 康桓瑋 from comment #0)
> It seems wrong that libstdc++ needs to include  for ranges::iota.

I agree, this looks like a defect, both std::iota and std::ranges:iota are
specified to be part of header 

[Bug c++/110853] New: [c++-concepts] Bad interaction between deduction guide with decay and constraints

2023-07-30 Thread daniel.kruegler at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110853

Bug ID: 110853
   Summary: [c++-concepts] Bad interaction between deduction guide
with decay and constraints
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: daniel.kruegler at googlemail dot com
  Target Milestone: ---

The following simplified code snippet demonstrates a breakage our company code
when updating gcc from C++17 to C++20. I'm starting first with the original
example, because it provides a bit more context information:


#include 

void value_twice(int& result)
{
  result = 2 * result;
}

auto key_value_gen()
{
  return std::pair("key", value_twice);
}

int main()
{
}


Using gcc HEAD 14.0.0 20230728 and compiled with the previous settings
-Wall -Wextra -pedantic -std=c++17
the code is accepted, but switching to
-Wall -Wextra -pedantic -std=c++20
it becomes rejected with the following diagnostics:


In file included from /opt/wandbox/gcc-head/include/c++/14.0.0/utility:69,
 from prog.cc:1:
/opt/wandbox/gcc-head/include/c++/14.0.0/bits/stl_pair.h: In instantiation of
'struct std::pair':
/opt/wandbox/gcc-head/include/c++/14.0.0/bits/stl_pair.h:307:57:   required by
substitution of 'template pair(const _T1&, const _T2&)->
std::pair<_T1, _T2> requires (std::pair<_T1, _T2>::_S_constructible)() [with _T1 = char [4]; _T2 = void(int&)]'
prog.cc:10:38:   required from here
/opt/wandbox/gcc-head/include/c++/14.0.0/bits/stl_pair.h:194:11: error: data
member 'std::pair::second' invalidly declared function
type
  194 |   _T2 second;///< The second member
  |   ^~

Note that std::pair has a "decaying" deduction guide

template
pair(T1, T2) -> pair;

but the error message reveals that attempts the produce a std::pair of the
undecayed types.

Additional information:
a) Current MSVC accepts the code but clang also rejects it but for different
reasons than gcc (see below).
b) I'm aware that a simple workaround exists by returning std::pair("key",
&value_twice) instead, and this is what we did to fix this. Nonetheless I think
that not everyone is able to fix such a problem in similar code when it was
provided by thirdparty libraries.

Basically the same error occurs when we use std::tuple(value_twice) instead.

The C++20 std::pair implementation uses noexcept, conditional explicit, and
trailing requires-clause based on static member functions as predicates, but
for gcc the problem can be reduced to the trailing requires-clause alone:

--
#define WITH_FUNC 1

template
constexpr bool is_copy_constructible_v = true;

template
struct p
{
  T1 first;

  static constexpr bool do_is_copy_constructible()
  {
return true;
  }

  p(const T1& t1) 
 requires (
#if WITH_FUNC
  do_is_copy_constructible()  // Line 19
#else
  is_copy_constructible_v
#endif
 )
  : first(t1) 
{}
};

template
p(T1) -> p;

void value_twice(int& result)
{
  result = 2 * result;
}

auto value_gen()
{
  return p(value_twice); // line 38
}

int main() {}
--

If we define WITH_FUNC to 0, the code is accepted, otherwise (as shown above),
the code is rejected with:

--
prog.cc: In instantiation of 'struct p':
prog.cc:19:31:   required by substitution of 'template p(const T1&)->
p requires (p::do_is_copy_constructible)() [with T1 = void(int&)]'
prog.cc:38:23:   required from here
prog.cc:9:6: error: data member 'p::first' invalidly declared
function type
9 |   T1 first;
  |  ^
--

Note that clang does accept the reduced case, even though it rejects the
original example as well due to slightly different reasons, which I will report
separately to them.

The reduced case uses the same implementation strategy as libstdc++ by means of
a static member function. What's special here is that the body of such a
function is a complete-class context of p, which I guess causes the error here
because the trailing requires-clause is not a complete-class context of p, so
one could say that this is actually a libstdc++ defect to use this
implementation strategy, it seems odd to me that the compiler attempts to
instantiate p with the undecayed function here and would like to open this
initially as compiler defect since the corresponding function does not actually
depend on p being complete. Feel free to correct me, but in case of a
correction of my understanding I would like to change this to a libstdc++ issue
instead of closing it because that would mean that libstdc++ cannot use there
static member function predicate approach (A f

[Bug tree-optimization/95825] [10/11/12/13 Regression] boost::optional -Wuninitialized with -fsanitize=address

2023-04-17 Thread daniel.kruegler at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95825

--- Comment #8 from Daniel Krügler  ---
(In reply to daniel.klauer from comment #7)
> Reduced test case:
> 
> 
> template
> struct tc_optional_base
> {
>   // default ctor leaves m_storage uninitialized
>   tc_optional_base() : m_initialized(false) {}
>   bool m_initialized;
>   T m_storage;
> };

This example seems unrelated to the issue, because you have here a struct, not
a union.

[Bug libstdc++/71899] An internal BooleanTestable trait should be provided

2020-12-10 Thread daniel.kruegler at googlemail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71899

--- Comment #6 from Daniel Krügler  ---
(In reply to Jonathan Wakely from comment #5)
> LWG 2743 seems to be the wrong issue, I think https://wg21.link/lwg2114 is
> the right one.

Ah yes, this was an unintended mislinking on my side. Feel free to close this
issue, the resolution approach is now different already and it is likely the
libraries will already implement something like boolean-testable-impl anyway
(https://wg21.link/p1964r2).