public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54196] New: gcc doesn't find incompatible exception specification for operator
@ 2012-08-07 18:52 mib.bugzilla at gmail dot com
  2012-08-07 18:57 ` [Bug c++/54196] " mib.bugzilla at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: mib.bugzilla at gmail dot com @ 2012-08-07 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 54196
           Summary: gcc doesn't find incompatible exception specification
                    for operator
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mib.bugzilla@gmail.com


It look like g++ emit error for regular functions but not for new.  Here is the
example: 
For following test case g++ emit error for foo but not for operator new. 


class bad_alloc 
{ 
  public: 
    bad_alloc() throw() { } 
}; 
struct nothrow_t { }; 
extern const nothrow_t nothrow; 
typedef unsigned long size_t; 
//void* operator new(size_t) noexcept; 
void* operator new(size_t, const nothrow_t&); 

void foo(); 
int main(int argc, char *argv[]) 
{ 
  void* (*pf)(size_t) throw (bad_alloc) = operator new; 
  void* (*pf1)() throw (bad_alloc) = foo; 
}


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

* [Bug c++/54196] gcc doesn't find incompatible exception specification for operator
  2012-08-07 18:52 [Bug c++/54196] New: gcc doesn't find incompatible exception specification for operator mib.bugzilla at gmail dot com
@ 2012-08-07 18:57 ` mib.bugzilla at gmail dot com
  2012-08-07 20:55 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mib.bugzilla at gmail dot com @ 2012-08-07 18:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from mib.bugzilla at gmail dot com 2012-08-07 18:57:28 UTC ---
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/site/spt/rdrive/ref/gcc/4.7.0/efi2/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/myuser/d/gcc_src/gcc-4.7.0/configure
--prefix=/rdrive/ref/gcc/4.7.0/efi2 --enable-languages=c,c++,objc,fortran
--disable-multilib --enable-bootstrap --target=x86_64-unknown-linux-gnu
--disable-bootstrap --enable-decimal-float
--with-gmp=/home/myuser/d/gcc_src/lib/efi2
--with-mpfr=/home/myuser/d/gcc_src/lib/efi2
--with-mpc=/home/myuser/d/gcc_src/lib/efi2
Thread model: posix
gcc version 4.7.0 (GCC)


g++ -c fubar.cpp
fubar.cpp: In function âint main(int, char**)â:
fubar.cpp:16:40: error: invalid conversion from âvoid (*)()â to âvoid* (*)()â
[-fpermissive]


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

* [Bug c++/54196] gcc doesn't find incompatible exception specification for operator
  2012-08-07 18:52 [Bug c++/54196] New: gcc doesn't find incompatible exception specification for operator mib.bugzilla at gmail dot com
  2012-08-07 18:57 ` [Bug c++/54196] " mib.bugzilla at gmail dot com
@ 2012-08-07 20:55 ` redi at gcc dot gnu.org
  2021-08-09 19:05 ` [Bug c++/54196] gcc doesn't find incompatible exception specification pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2012-08-07 20:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-08-07 20:55:36 UTC ---
N.B. there are various overloads of operator new that are implicitly declared
in every translation unit, including (in C++03)

void* operator new(std::size_t) throw(std::bad_alloc)

which would be ok except for the std:: qualification


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

* [Bug c++/54196] gcc doesn't find incompatible exception specification
  2012-08-07 18:52 [Bug c++/54196] New: gcc doesn't find incompatible exception specification for operator mib.bugzilla at gmail dot com
  2012-08-07 18:57 ` [Bug c++/54196] " mib.bugzilla at gmail dot com
  2012-08-07 20:55 ` redi at gcc dot gnu.org
@ 2021-08-09 19:05 ` pinskia at gcc dot gnu.org
  2021-08-09 19:06 ` pinskia at gcc dot gnu.org
  2021-08-09 19:08 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-09 19:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
            Summary|gcc doesn't find            |gcc doesn't find
                   |incompatible exception      |incompatible exception
                   |specification for operator  |specification

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is the testcase really, it has nothing to do with operators but the
problem is really we don't 


struct a{a()throw(){}};
struct b{b()throw(){}};
void *foo() throw(a); 
int main(int argc, char *argv[]) 
{
  void* (*pf1)() throw (b) = foo; 
}

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

* [Bug c++/54196] gcc doesn't find incompatible exception specification
  2012-08-07 18:52 [Bug c++/54196] New: gcc doesn't find incompatible exception specification for operator mib.bugzilla at gmail dot com
                   ` (2 preceding siblings ...)
  2021-08-09 19:05 ` [Bug c++/54196] gcc doesn't find incompatible exception specification pinskia at gcc dot gnu.org
@ 2021-08-09 19:06 ` pinskia at gcc dot gnu.org
  2021-08-09 19:08 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-09 19:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-08-09

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
It has nothing to do with operators but the problem is really we don't check
what is inside the exception specification.

Now do we care since exception specification is removed from C++20?

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

* [Bug c++/54196] gcc doesn't find incompatible exception specification
  2012-08-07 18:52 [Bug c++/54196] New: gcc doesn't find incompatible exception specification for operator mib.bugzilla at gmail dot com
                   ` (3 preceding siblings ...)
  2021-08-09 19:06 ` pinskia at gcc dot gnu.org
@ 2021-08-09 19:08 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-09 19:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Oh this is just PR 12255

*** This bug has been marked as a duplicate of bug 12255 ***

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

end of thread, other threads:[~2021-08-09 19:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-07 18:52 [Bug c++/54196] New: gcc doesn't find incompatible exception specification for operator mib.bugzilla at gmail dot com
2012-08-07 18:57 ` [Bug c++/54196] " mib.bugzilla at gmail dot com
2012-08-07 20:55 ` redi at gcc dot gnu.org
2021-08-09 19:05 ` [Bug c++/54196] gcc doesn't find incompatible exception specification pinskia at gcc dot gnu.org
2021-08-09 19:06 ` pinskia at gcc dot gnu.org
2021-08-09 19:08 ` 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).