public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/106067] New: Error on implicit conversion to std::function: 'static constexpr bool std::_Function_handler<...>...' used before its definition
@ 2022-06-23 19:19 e.tadeu at gmail dot com
  2022-06-23 22:40 ` [Bug libstdc++/106067] " redi at gcc dot gnu.org
  2023-06-23 13:24 ` [Bug libstdc++/106067] [11/12/13/14 Regression] " redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: e.tadeu at gmail dot com @ 2022-06-23 19:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106067

            Bug ID: 106067
           Summary: Error on implicit conversion to std::function: 'static
                    constexpr bool std::_Function_handler<...>...' used
                    before its definition
           Product: gcc
           Version: 11.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: e.tadeu at gmail dot com
  Target Milestone: ---

The following code started failing on GCC 11.3 (also fails on GCC 12):

    #include <functional>

    double fn();

    template <double (*T)(std::function<double()>)>
    void caller()
    {
        auto f = T(fn);
        // auto f = T(std::function<double()>(fn));  // workaround (this works)
    }


The snippet is also here: https://godbolt.org/z/zh7nr7vKc

The full error is:

        In file included from
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/move.h:57,
                                         from
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/stl_function.h:60,
                                         from
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/functional:49,
                                         from <source>:1:
        /opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/type_traits: In
instantiation of 'struct std::is_trivially_copyable<double (*)()>':
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/std_function.h:69:12:
  required from 'struct std::__is_location_invariant<double (*)()>'
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/std_function.h:125:38:
  required from 'const bool std::_Function_base::_Base_manager<double
(*)()>::__stored_locally'
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/std_function.h:130:8:
  required from 'class std::_Function_base::_Base_manager<double (*)()>'
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/std_function.h:260:11:
  required from 'class std::_Function_handler<double(), double (*)()>'
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/std_function.h:436:65:
  required from 'std::function<_Res(_ArgTypes ...)>::function(_Functor&&) [with
_Functor = double (*)(); _Constraints = void; _Res = double; _ArgTypes = {}]'
        <source>:8:15:   required from here
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/type_traits:713:52: error:
non-constant condition for static assertion
          713 |      
static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                  |                    
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/type_traits:713:52: error:
'constexpr std::true_type
std::__is_complete_or_unbounded(std::__type_identity<_Tp>) [with _Tp = double
(*)(); long unsigned int <anonymous> = 8; std::true_type =
std::integral_constant<bool, true>]' used before its definition
        In file included from
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/functional:59,
                                         from <source>:1:
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/std_function.h: In
instantiation of 'std::function<_Res(_ArgTypes ...)>::function(_Functor&&)
[with _Functor = double (*)(); _Constraints = void; _Res = double; _ArgTypes =
{}]':
        <source>:8:15:   required from here
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/std_function.h:436:72:
error: 'static constexpr bool std::_Function_handler<_Res(_ArgTypes ...),
_Functor>::_S_nothrow_init() [with _Fn = double (*)(); _Res = double; _Functor
= double (*)(); _ArgTypes = {}]' used before its definition
          436 |         noexcept(_Handler<_Functor>::template
_S_nothrow_init<_Functor>())
                  |                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
        ASM generation compiler returned: 1
        In file included from
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/move.h:57,
                                         from
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/stl_function.h:60,
                                         from
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/functional:49,
                                         from <source>:1:
        /opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/type_traits: In
instantiation of 'struct std::is_trivially_copyable<double (*)()>':
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/std_function.h:69:12:
  required from 'struct std::__is_location_invariant<double (*)()>'
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/std_function.h:125:38:
  required from 'const bool std::_Function_base::_Base_manager<double
(*)()>::__stored_locally'
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/std_function.h:130:8:
  required from 'class std::_Function_base::_Base_manager<double (*)()>'
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/std_function.h:260:11:
  required from 'class std::_Function_handler<double(), double (*)()>'
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/std_function.h:436:65:
  required from 'std::function<_Res(_ArgTypes ...)>::function(_Functor&&) [with
_Functor = double (*)(); _Constraints = void; _Res = double; _ArgTypes = {}]'
        <source>:8:15:   required from here
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/type_traits:713:52: error:
non-constant condition for static assertion
          713 |      
static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
                  |                    
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/type_traits:713:52: error:
'constexpr std::true_type
std::__is_complete_or_unbounded(std::__type_identity<_Tp>) [with _Tp = double
(*)(); long unsigned int <anonymous> = 8; std::true_type =
std::integral_constant<bool, true>]' used before its definition
        In file included from
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/functional:59,
                                         from <source>:1:
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/std_function.h: In
instantiation of 'std::function<_Res(_ArgTypes ...)>::function(_Functor&&)
[with _Functor = double (*)(); _Constraints = void; _Res = double; _ArgTypes =
{}]':
        <source>:8:15:   required from here
       
/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/bits/std_function.h:436:72:
error: 'static constexpr bool std::_Function_handler<_Res(_ArgTypes ...),
_Functor>::_S_nothrow_init() [with _Fn = double (*)(); _Res = double; _Functor
= double (*)(); _ArgTypes = {}]' used before its definition
          436 |         noexcept(_Handler<_Functor>::template
_S_nothrow_init<_Functor>())
                  |                 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
        Execution build compiler returned: 1

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

* [Bug libstdc++/106067] Error on implicit conversion to std::function: 'static constexpr bool std::_Function_handler<...>...' used before its definition
  2022-06-23 19:19 [Bug libstdc++/106067] New: Error on implicit conversion to std::function: 'static constexpr bool std::_Function_handler<...>...' used before its definition e.tadeu at gmail dot com
@ 2022-06-23 22:40 ` redi at gcc dot gnu.org
  2023-06-23 13:24 ` [Bug libstdc++/106067] [11/12/13/14 Regression] " redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2022-06-23 22:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106067

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Probably due to r12-3174 (backported as r11-9289)

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

* [Bug libstdc++/106067] [11/12/13/14 Regression] Error on implicit conversion to std::function: 'static constexpr bool std::_Function_handler<...>...' used before its definition
  2022-06-23 19:19 [Bug libstdc++/106067] New: Error on implicit conversion to std::function: 'static constexpr bool std::_Function_handler<...>...' used before its definition e.tadeu at gmail dot com
  2022-06-23 22:40 ` [Bug libstdc++/106067] " redi at gcc dot gnu.org
@ 2023-06-23 13:24 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2023-06-23 13:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106067

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
     Ever confirmed|0                           |1
            Summary|Error on implicit           |[11/12/13/14 Regression]
                   |conversion to               |Error on implicit
                   |std::function: 'static      |conversion to
                   |constexpr bool              |std::function: 'static
                   |std::_Function_handler<...> |constexpr bool
                   |...' used before its        |std::_Function_handler<...>
                   |definition                  |...' used before its
                   |                            |definition
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
   Last reconfirmed|                            |2023-06-23
   Target Milestone|---                         |11.5
      Known to fail|                            |11.3.0, 12.1.0, 13.1.0,
                   |                            |14.0
             Status|UNCONFIRMED                 |ASSIGNED
           Priority|P3                          |P2
      Known to work|                            |11.2.0

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

end of thread, other threads:[~2023-06-23 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23 19:19 [Bug libstdc++/106067] New: Error on implicit conversion to std::function: 'static constexpr bool std::_Function_handler<...>...' used before its definition e.tadeu at gmail dot com
2022-06-23 22:40 ` [Bug libstdc++/106067] " redi at gcc dot gnu.org
2023-06-23 13:24 ` [Bug libstdc++/106067] [11/12/13/14 Regression] " redi at gcc dot gnu.org

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).