[Bug c++/95808] Can mismatch non-array new/delete with array new/delete during constant evaluation

2021-08-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808

--- Comment #6 from Andrew Pinski  ---
*** Bug 95797 has been marked as a duplicate of this bug. ***

[Bug c++/95808] Can mismatch non-array new/delete with array new/delete during constant evaluation

2021-08-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808

Andrew Pinski  changed:

   What|Removed |Added

 CC||euloanty at live dot com

--- Comment #5 from Andrew Pinski  ---
*** Bug 93668 has been marked as a duplicate of this bug. ***

[Bug c++/95808] Can mismatch non-array new/delete with array new/delete during constant evaluation

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |11.0
 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #4 from Andrew Pinski  ---
Fixed so closing as such.

[Bug c++/95808] Can mismatch non-array new/delete with array new/delete during constant evaluation

2020-10-29 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808

--- Comment #3 from Jakub Jelinek  ---
Fixed on the trunk so far.

[Bug c++/95808] Can mismatch non-array new/delete with array new/delete during constant evaluation

2020-10-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808

--- Comment #2 from CVS Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:815baade9a07d361b1daa1dcfbbda2a79f3ebb52

commit r11-4538-g815baade9a07d361b1daa1dcfbbda2a79f3ebb52
Author: Jakub Jelinek 
Date:   Thu Oct 29 16:27:01 2020 +0100

c++: Diagnose constexpr delete [] new int; and delete new int[N]; [PR95808]

This patch diagnoses delete [] new int; and delete new int[1]; in constexpr
contexts by remembering
IDENTIFIER_OVL_OP_FLAGS (DECL_NAME (fun)) & OVL_OP_FLAG_VEC
from the operator new and checking it at operator delete time.

2020-10-29  Jakub Jelinek  

PR c++/95808
* cp-tree.h (enum cp_tree_index): Add
CPTI_HEAP_VEC_UNINIT_IDENTIFIER
and CPTI_HEAP_VEC_IDENTIFIER.
(heap_vec_uninit_identifier, heap_vec_identifier): Define.
* decl.c (initialize_predefined_identifiers): Initialize those
identifiers.
* constexpr.c (cxx_eval_call_expression): Reject array allocations
deallocated with non-array deallocation or non-array allocations
deallocated with array deallocation.
(non_const_var_error): Handle heap_vec_uninit_identifier and
heap_vec_identifier too.
(cxx_eval_constant_expression): Handle also
heap_vec_uninit_identifier
and in that case during initialization replace it with
heap_vec_identifier.
(find_heap_var_refs): Handle heap_vec_uninit_identifier and
heap_vec_identifier too.

* g++.dg/cpp2a/constexpr-new15.C: New test.

[Bug c++/95808] Can mismatch non-array new/delete with array new/delete during constant evaluation

2020-10-15 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek  ---
Created attachment 49381
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49381=edit
gcc11-pr95808.patch

Untested fix.

[Bug c++/95808] Can mismatch non-array new/delete with array new/delete during constant evaluation

2020-10-02 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95808

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords|wrong-code  |accepts-invalid
   Last reconfirmed||2020-10-02
 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW