public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/84403] Possible further extension of constexpr: allow to use them as template parameters
       [not found] <bug-84403-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-23  9:07 ` pinskia at gcc dot gnu.org
  2021-08-23 10:31 ` redi at gcc dot gnu.org
  2021-08-28 21:54 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-23  9:07 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

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

* [Bug c++/84403] Possible further extension of constexpr: allow to use them as template parameters
       [not found] <bug-84403-4@http.gcc.gnu.org/bugzilla/>
  2021-08-23  9:07 ` [Bug c++/84403] Possible further extension of constexpr: allow to use them as template parameters pinskia at gcc dot gnu.org
@ 2021-08-23 10:31 ` redi at gcc dot gnu.org
  2021-08-28 21:54 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-23 10:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Daniel Fruzynski from comment #0)
> Values in constexpr functions are known at compile time,

No, not necessarily. You can call a constexpr function with runtime values too:

#include <type_traits>

constexpr int test(int n)
{
    return std::integral_constant<int, n>::value;
}

int main(int argc, char**)
{
  return test(argc);
}

So this is impossible to do. Function parameters are never constant
expressions.

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

* [Bug c++/84403] Possible further extension of constexpr: allow to use them as template parameters
       [not found] <bug-84403-4@http.gcc.gnu.org/bugzilla/>
  2021-08-23  9:07 ` [Bug c++/84403] Possible further extension of constexpr: allow to use them as template parameters pinskia at gcc dot gnu.org
  2021-08-23 10:31 ` redi at gcc dot gnu.org
@ 2021-08-28 21:54 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-28 21:54 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 70124 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2021-08-28 21:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-84403-4@http.gcc.gnu.org/bugzilla/>
2021-08-23  9:07 ` [Bug c++/84403] Possible further extension of constexpr: allow to use them as template parameters pinskia at gcc dot gnu.org
2021-08-23 10:31 ` redi at gcc dot gnu.org
2021-08-28 21:54 ` pinskia 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).