public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61105] New: [constexpr] accepts-invalid with new-expression in constant expression
@ 2014-05-07 22:04 richard-gccbugzilla at metafoo dot co.uk
  2014-09-16 16:35 ` [Bug c++/61105] " paolo.carlini at oracle dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: richard-gccbugzilla at metafoo dot co.uk @ 2014-05-07 22:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61105

            Bug ID: 61105
           Summary: [constexpr] accepts-invalid with new-expression in
                    constant expression
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richard-gccbugzilla at metafoo dot co.uk

G++ accepts this ill-formed code:

using size_t = decltype(sizeof(0));
constexpr void *operator new(size_t, int*) noexcept { return nullptr; }
constexpr int *p = new (nullptr) int;

This is invalid because a constant expression cannot contain an (evaluated)
new-expression.


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

* [Bug c++/61105] [constexpr] accepts-invalid with new-expression in constant expression
  2014-05-07 22:04 [Bug c++/61105] New: [constexpr] accepts-invalid with new-expression in constant expression richard-gccbugzilla at metafoo dot co.uk
@ 2014-09-16 16:35 ` paolo.carlini at oracle dot com
  2015-04-22 12:01 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-09-16 16:35 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-09-16
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
   Target Milestone|---                         |5.0
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Mine.


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

* [Bug c++/61105] [constexpr] accepts-invalid with new-expression in constant expression
  2014-05-07 22:04 [Bug c++/61105] New: [constexpr] accepts-invalid with new-expression in constant expression richard-gccbugzilla at metafoo dot co.uk
  2014-09-16 16:35 ` [Bug c++/61105] " paolo.carlini at oracle dot com
@ 2015-04-22 12:01 ` jakub at gcc dot gnu.org
  2015-07-16  9:18 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-04-22 12:01 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.0                         |5.2

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 5.1 has been released.


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

* [Bug c++/61105] [constexpr] accepts-invalid with new-expression in constant expression
  2014-05-07 22:04 [Bug c++/61105] New: [constexpr] accepts-invalid with new-expression in constant expression richard-gccbugzilla at metafoo dot co.uk
  2014-09-16 16:35 ` [Bug c++/61105] " paolo.carlini at oracle dot com
  2015-04-22 12:01 ` jakub at gcc dot gnu.org
@ 2015-07-16  9:18 ` rguenth at gcc dot gnu.org
  2021-08-19 21:55 ` pinskia at gcc dot gnu.org
  2021-08-20  9:07 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2015-07-16  9:18 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|5.2                         |5.3

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 5.2 is being released, adjusting target milestone to 5.3.


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

* [Bug c++/61105] [constexpr] accepts-invalid with new-expression in constant expression
  2014-05-07 22:04 [Bug c++/61105] New: [constexpr] accepts-invalid with new-expression in constant expression richard-gccbugzilla at metafoo dot co.uk
                   ` (2 preceding siblings ...)
  2015-07-16  9:18 ` rguenth at gcc dot gnu.org
@ 2021-08-19 21:55 ` pinskia at gcc dot gnu.org
  2021-08-20  9:07 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-19 21:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #6) 
> $ cat xx.cpp && /build/gcc-60760/gcc/xgcc -B /build/gcc-60760/gcc -S -Wall
> -Wextra -Wpedantic -o/dev/null xx.cpp
> constexpr void *operator new (__SIZE_TYPE__, void *p) noexcept { return p; }
> 
> constexpr int f ()
> {
>   int i = 0;
>   int *p = new (&i) int (1);
>   return *p;
> }
> 
> constexpr int i = f ();
> $

The trunk rejects this with:
<source>:11:21:   in 'constexpr' expansion of 'f()'
<source>:11:22: error: cast from 'void*' is not allowed
   11 | constexpr int i = f ();
      |                      ^

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

* [Bug c++/61105] [constexpr] accepts-invalid with new-expression in constant expression
  2014-05-07 22:04 [Bug c++/61105] New: [constexpr] accepts-invalid with new-expression in constant expression richard-gccbugzilla at metafoo dot co.uk
                   ` (3 preceding siblings ...)
  2021-08-19 21:55 ` pinskia at gcc dot gnu.org
@ 2021-08-20  9:07 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-20  9:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Richard's comment 0 testcase gives an error since r238909 (as Martin noted).

Martin's comment 6 testcase gives an error since r12-388:

    c++: Remove GCC12 FIXME for DR1312

    This patch removes a FIXME I left for myself for GCC 12, along with
    adjusting the relevant test.

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

end of thread, other threads:[~2021-08-20  9:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-07 22:04 [Bug c++/61105] New: [constexpr] accepts-invalid with new-expression in constant expression richard-gccbugzilla at metafoo dot co.uk
2014-09-16 16:35 ` [Bug c++/61105] " paolo.carlini at oracle dot com
2015-04-22 12:01 ` jakub at gcc dot gnu.org
2015-07-16  9:18 ` rguenth at gcc dot gnu.org
2021-08-19 21:55 ` pinskia at gcc dot gnu.org
2021-08-20  9:07 ` 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).