public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15882] Check for return type of overloaded operator new too early
       [not found] <bug-15882-4@http.gcc.gnu.org/bugzilla/>
@ 2013-05-13 13:12 ` paolo.carlini at oracle dot com
  2013-05-13 14:03 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-05-13 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #11 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Any idea what happened with this issue? Does exist an actual ISO DR?


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

* [Bug c++/15882] Check for return type of overloaded operator new too early
       [not found] <bug-15882-4@http.gcc.gnu.org/bugzilla/>
  2013-05-13 13:12 ` [Bug c++/15882] Check for return type of overloaded operator new too early paolo.carlini at oracle dot com
@ 2013-05-13 14:03 ` redi at gcc dot gnu.org
  2013-05-13 19:06 ` jason at gcc dot gnu.org
  2021-12-05  1:07 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2013-05-13 14:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Jason sent the issue to the reflector as c++std-core-13788 but I don't see any
indication it made it onto the issues list.


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

* [Bug c++/15882] Check for return type of overloaded operator new too early
       [not found] <bug-15882-4@http.gcc.gnu.org/bugzilla/>
  2013-05-13 13:12 ` [Bug c++/15882] Check for return type of overloaded operator new too early paolo.carlini at oracle dot com
  2013-05-13 14:03 ` redi at gcc dot gnu.org
@ 2013-05-13 19:06 ` jason at gcc dot gnu.org
  2021-12-05  1:07 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu.org @ 2013-05-13 19:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #12)
> Jason sent the issue to the reflector as c++std-core-13788 but I don't see
> any indication it made it onto the issues list.

I'll poke Mike about it.


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

* [Bug c++/15882] Check for return type of overloaded operator new too early
       [not found] <bug-15882-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2013-05-13 19:06 ` jason at gcc dot gnu.org
@ 2021-12-05  1:07 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-05  1:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang gives:
<source>:15:1: error: 'operator new' cannot have a dependent return type; use
'void *' instead

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

* [Bug c++/15882] Check for return type of overloaded operator new too early
       [not found] <bug-15882-102@http.gcc.gnu.org/bugzilla/>
  2009-11-04 19:34 ` jason at gcc dot gnu dot org
@ 2009-11-04 19:37 ` jason at gcc dot gnu dot org
  1 sibling, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-04 19:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jason at gcc dot gnu dot org  2009-11-04 19:37 -------
Oops, wrong PR number on that checkin.


-- 


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


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

* [Bug c++/15882] Check for return type of overloaded operator new too early
       [not found] <bug-15882-102@http.gcc.gnu.org/bugzilla/>
@ 2009-11-04 19:34 ` jason at gcc dot gnu dot org
  2009-11-04 19:37 ` jason at gcc dot gnu dot org
  1 sibling, 0 replies; 15+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-04 19:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jason at gcc dot gnu dot org  2009-11-04 19:34 -------
Subject: Bug 15882

Author: jason
Date: Wed Nov  4 19:34:25 2009
New Revision: 153909

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=153909
Log:
        PR c++/15882
        * method.c (use_thunk): Check DECL_WEAK as well as
        DECL_ONE_ONLY.

Added:
    trunk/gcc/testsuite/g++.dg/abi/thunk5.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/method.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/15882] Check for return type of overloaded operator new too early
  2004-06-08 20:41 [Bug c++/15882] New: " bangerth at dealii dot org
                   ` (6 preceding siblings ...)
  2004-06-08 22:08 ` pinskia at gcc dot gnu dot org
@ 2004-06-10 18:22 ` bangerth at dealii dot org
  2004-06-10 18:22 ` bangerth at dealii dot org
  8 siblings, 0 replies; 15+ messages in thread
From: bangerth at dealii dot org @ 2004-06-10 18:22 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |SUSPENDED


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


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

* [Bug c++/15882] Check for return type of overloaded operator new too early
  2004-06-08 20:41 [Bug c++/15882] New: " bangerth at dealii dot org
                   ` (7 preceding siblings ...)
  2004-06-10 18:22 ` bangerth at dealii dot org
@ 2004-06-10 18:22 ` bangerth at dealii dot org
  8 siblings, 0 replies; 15+ messages in thread
From: bangerth at dealii dot org @ 2004-06-10 18:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-06-10 18:21 -------
Here is the proposed text for the DR that I have asked Jason to forward for me. Let's 
suspend this PR until we hear back about its fate. 
 
W. 
 
---------------------------- 
Synposis: Wording about templated operator new/delete overly restrictive 
 
Section 3.7.3.1/1 reads: 
  "[...]The return type shall be void*.  The first parameter shall have type  
  size_t[...] An allocation function can be a function template.  Such a  
  template  shall  declare its  return  type  and  first  parameter  as 
  specified above (that is, template parameter types shall not be used  in  
  the  return  type  and first  parameter  type)." 
 
There are several issues here: 
1./ In the parentheses it should probably read "template parameters", since one could also use 
template value parameters, not only types. 
 
2./ The wording is overly restrictive. In particular, it disallows the use of the Substitution 
Failure is not an Error (SFINAE) pattern to remove certain function templates from the overload 
set. It is therefore not possible to write code like this: 
  template <bool C, typename T> struct SFINAE; 
  template <typename T>         struct SFINAE<true,T> { typedef T type; }; 
 
  template <typename T> struct ObjectSize {}; 
 
  template <typename T> 
  typename SFINAE< (sizeof(T)<=16), void*> 
  operator new (std::size_t, ObjectSize<T>) { 
    // call some small object allocator 
  } 
 
  template <typename T> 
  typename SFINAE< (sizeof(T)>16), void*> 
  operator new (std::size_t, ObjectSize<T>) { 
    // call some large object allocator 
  } 
 
Note that when having a call like in 
  SomeObject *p = new(ObjectSize<SomeObject>()) SomeObject; 
template argument substitution can only be successful for one of the declarations of operator 
new, and that in this case the return type evaluates to void* as requested.  
 
3./ The third cited sentence should read "...can be _an instance_ of a function template". This 
is also how section 3.7.3.2/2 about operator delete phrases it, which also has issue 1/ correct. 
 
 
 
Section 3.7.3.2/2 about operator delete shares the same problem 2/ as above section about 
operator new. It has this text: 
 "A deallocation function can be an instance  of  a  function  template. 
  Neither  the  first  parameter  nor  the return type shall depend on a 
  template parameter.  [Note: that is, a deallocation function  template 
  shall  have  a first parameter of type void* and a return type of void 
  (as specified above).  ]" 
This text disallows the same mechanism as above for removing signatures from the overload 
set. 
 
 
 
Proposed resolution: 
Replace 3.7.3.1/1 by the following text (changed parts marked): 
 "An allocation function shall be a class member function  or  a  global 
  function;  a  program  is  ill-formed  if  an  allocation  function is 
  declared in a namespace scope other  than  global  scope  or  declared 
  static  in  global  scope.  The return type shall be void*.  The first 
  parameter shall have type  size_t  (_lib.support.types_).   The  first 
  parameter    shall   not   have   an   associated   default   argument 
  (_dcl.fct.default_).  The  value  of  the  first  parameter  shall  be 
  interpreted  as  the  requested size of the allocation.   
  __An allocation function can be an instance of a  function template.  
  If template parameter substitution succeeds, the return type shall 
  evaluate to void*, and the first argument shall evaluate to size_t.__ 
  Template allocation functions shall have two or more parameters." 
 
Replace 3.7.3.2/2 by the following text: 
 "Each  deallocation  function shall return void and its first parameter 
  shall be void*.  A  deallocation  function  can  have  more  than  one 
  parameter.   If  a  class  T  has a member deallocation function named 
  operator delete with exactly one parameter, then that  function  is  a 
  usual  (non-placement)  deallocation  function.   If  class T does not 
  declare such an operator delete but does declare a member deallocation 
  function named operator delete with exactly two parameters, the second 
  of  which  has  type  std::size_t  (_lib.support.types_),  then   this 
  function  is  a  usual deallocation function.  Similarly, if a class T 
  has a  member  deallocation  function  named  operator  delete[]  with 
  exactly  one  parameter, then that function is a usual (non-placement) 
  deallocation function.  If class T does not declare such  an  operator 
  delete[]  but  does  declare  a  member  deallocation  function  named 
  operator delete[] with exactly two parameters, the second of which has 
  type std::size_t, then this function is a usual deallocation function. 
  A deallocation function can be an instance  of  a  function  template. 
  __If template parameter substitution succeeds, the return type shall 
  evaluate to void, and the first parameter shall evaluate to void*.__ 
  A deallocation function template  shall  have 
  two or more function parameters.  A template instance is never a usual 
  deallocation function, regardless of its signature." 
  

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-06-10 18:22:09
               date|                            |


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


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

* [Bug c++/15882] Check for return type of overloaded operator new too early
  2004-06-08 20:41 [Bug c++/15882] New: " bangerth at dealii dot org
                   ` (5 preceding siblings ...)
  2004-06-08 22:00 ` jason at redhat dot com
@ 2004-06-08 22:08 ` pinskia at gcc dot gnu dot org
  2004-06-10 18:22 ` bangerth at dealii dot org
  2004-06-10 18:22 ` bangerth at dealii dot org
  8 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-08 22:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-08 22:08 -------
Reopening for now.

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


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


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

* [Bug c++/15882] Check for return type of overloaded operator new too early
  2004-06-08 20:41 [Bug c++/15882] New: " bangerth at dealii dot org
                   ` (4 preceding siblings ...)
  2004-06-08 21:55 ` bangerth at dealii dot org
@ 2004-06-08 22:00 ` jason at redhat dot com
  2004-06-08 22:08 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: jason at redhat dot com @ 2004-06-08 22:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jason at redhat dot com  2004-06-08 22:00 -------
Subject: Re:  Check for return type of overloaded operator
 new too early

On 8 Jun 2004 21:55:29 -0000, "bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> wrote:

> Actually, I have no clue how to do that. If I wrote a text and forwarded 
> it to you, would you help me in doing this? 

I believe the usual way is to post to comp.std.c++, though I could also
forward a message to the committee reflector.

Jason


-- 


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


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

* [Bug c++/15882] Check for return type of overloaded operator new too early
  2004-06-08 20:41 [Bug c++/15882] New: " bangerth at dealii dot org
                   ` (3 preceding siblings ...)
  2004-06-08 21:52 ` jason at redhat dot com
@ 2004-06-08 21:55 ` bangerth at dealii dot org
  2004-06-08 22:00 ` jason at redhat dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: bangerth at dealii dot org @ 2004-06-08 21:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-06-08 21:55 -------
Actually, I have no clue how to do that. If I wrote a text and forwarded 
it to you, would you help me in doing this? 
 
Thanks 
  Wolfgang 

-- 


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


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

* [Bug c++/15882] Check for return type of overloaded operator new too early
  2004-06-08 20:41 [Bug c++/15882] New: " bangerth at dealii dot org
                   ` (2 preceding siblings ...)
  2004-06-08 21:22 ` bangerth at dealii dot org
@ 2004-06-08 21:52 ` jason at redhat dot com
  2004-06-08 21:55 ` bangerth at dealii dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: jason at redhat dot com @ 2004-06-08 21:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jason at redhat dot com  2004-06-08 21:52 -------
Subject: Re:  Check for return type of overloaded operator
 new too early

I would support a change along the lines you suggest; feel free to raise it
as a core language issue.

Jason


-- 


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


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

* [Bug c++/15882] Check for return type of overloaded operator new too early
  2004-06-08 20:41 [Bug c++/15882] New: " bangerth at dealii dot org
  2004-06-08 21:12 ` [Bug c++/15882] " pinskia at gcc dot gnu dot org
  2004-06-08 21:15 ` pinskia at gcc dot gnu dot org
@ 2004-06-08 21:22 ` bangerth at dealii dot org
  2004-06-08 21:52 ` jason at redhat dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: bangerth at dealii dot org @ 2004-06-08 21:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-06-08 21:22 -------
Hm, I see. The sentence in the standard sounds like an oversight, though: even if the 
return type and first argument are 'as specified above', I can still do so while using 
template arguments, as shown in the example program, and I believe that this would 
be a useful thing. Besides, the standard talks about 'template parameter types' when  
it could also be 'template parameter values'.  
 
Would something like this justify a DR? Gaby, Jason, you are more experience in 
these matters than I am. Would you mind commenting? 
 
Thanks 
  Wolfgang 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gdr at gcc dot gnu dot org,
                   |                            |jason at gcc dot gnu dot org


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


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

* [Bug c++/15882] Check for return type of overloaded operator new too early
  2004-06-08 20:41 [Bug c++/15882] New: " bangerth at dealii dot org
  2004-06-08 21:12 ` [Bug c++/15882] " pinskia at gcc dot gnu dot org
@ 2004-06-08 21:15 ` pinskia at gcc dot gnu dot org
  2004-06-08 21:22 ` bangerth at dealii dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-08 21:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-08 21:15 -------
Not a bug in reading 3.7.3.1:
Such a template shall declare its return type and first parameter as specified above (that is, template 
parameter types shall not be used in the return type and first parameter type). 

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


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


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

* [Bug c++/15882] Check for return type of overloaded operator new too early
  2004-06-08 20:41 [Bug c++/15882] New: " bangerth at dealii dot org
@ 2004-06-08 21:12 ` pinskia at gcc dot gnu dot org
  2004-06-08 21:15 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-08 21:12 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-08 21:12 -------
Hmm, ICC 6.0 also rejects this code with the same error message.

-- 


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


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

end of thread, other threads:[~2021-12-05  1:07 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-15882-4@http.gcc.gnu.org/bugzilla/>
2013-05-13 13:12 ` [Bug c++/15882] Check for return type of overloaded operator new too early paolo.carlini at oracle dot com
2013-05-13 14:03 ` redi at gcc dot gnu.org
2013-05-13 19:06 ` jason at gcc dot gnu.org
2021-12-05  1:07 ` pinskia at gcc dot gnu.org
     [not found] <bug-15882-102@http.gcc.gnu.org/bugzilla/>
2009-11-04 19:34 ` jason at gcc dot gnu dot org
2009-11-04 19:37 ` jason at gcc dot gnu dot org
2004-06-08 20:41 [Bug c++/15882] New: " bangerth at dealii dot org
2004-06-08 21:12 ` [Bug c++/15882] " pinskia at gcc dot gnu dot org
2004-06-08 21:15 ` pinskia at gcc dot gnu dot org
2004-06-08 21:22 ` bangerth at dealii dot org
2004-06-08 21:52 ` jason at redhat dot com
2004-06-08 21:55 ` bangerth at dealii dot org
2004-06-08 22:00 ` jason at redhat dot com
2004-06-08 22:08 ` pinskia at gcc dot gnu dot org
2004-06-10 18:22 ` bangerth at dealii dot org
2004-06-10 18:22 ` bangerth at dealii dot 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).