public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/5104: template using std::set_terminate fails due to throw() qualifier in <exception>
@ 2002-04-03 17:36 jason
  0 siblings, 0 replies; 5+ messages in thread
From: jason @ 2002-04-03 17:36 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, harald, jason, pedwards

Synopsis: template using std::set_terminate fails due to throw() qualifier in <exception>

State-Changed-From-To: analyzed->closed
State-Changed-By: jason
State-Changed-When: Wed Apr  3 17:36:05 2002
State-Changed-Why:
    Actually, this is a bug.  Fixed for 3.1 by 
            * typeck.c (comptypes) [FUNCTION_TYPE]: Don't compare exception
            specifiers.
            [METHOD_TYPE]: Use same code as FUNCTION_TYPE.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5104


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

* Re: c++/5104: template using std::set_terminate fails due to throw() qualifier in <exception>
@ 2002-04-03 14:52 jason
  0 siblings, 0 replies; 5+ messages in thread
From: jason @ 2002-04-03 14:52 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, harald, jason, nobody, pedwards

Synopsis: template using std::set_terminate fails due to throw() qualifier in <exception>

Responsible-Changed-From-To: unassigned->jason
Responsible-Changed-By: jason
Responsible-Changed-When: Wed Apr  3 14:52:09 2002
Responsible-Changed-Why:
    mine

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5104


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

* Re: c++/5104: template using std::set_terminate fails due to throw() qualifier in <exception>
@ 2001-12-14 20:23 rodrigc
  0 siblings, 0 replies; 5+ messages in thread
From: rodrigc @ 2001-12-14 20:23 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, harald, nobody, pedwards

Synopsis: template using std::set_terminate fails due to throw() qualifier in <exception>

State-Changed-From-To: open->analyzed
State-Changed-By: rodrigc
State-Changed-When: Fri Dec 14 20:23:17 2001
State-Changed-Why:
    As Phil Edwards mentioned, set_terminate() in libstdc++-v3 has the correct
    function prototype according to the C++ standard, so we can't change that.
    
    This is kind of tricky.   What you would like to be able to do in your
    example is:
    
    typedef HandlerFunction (*SetHandlerFunction)(HandlerFunction) throw();
    
    However, you cannot do this, because section 15.4.1 of the C++ standard
    states: "An exception-specification shall not appear in a typedef
    declaration".
    
    gcc is doing the right thing, but I don't know how you can code
    your example to do what you want without changing it around.
    
    If I were you I would post a question on comp.lang.c++.moderated
    and ask what the legal C++ equivalent of your example is.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5104


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

* Re: c++/5104: template using std::set_terminate fails due to throw() qualifier in <exception>
@ 2001-12-13 12:06 Phil Edwards
  0 siblings, 0 replies; 5+ messages in thread
From: Phil Edwards @ 2001-12-13 12:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/5104; it has been noted by GNATS.

From: Phil Edwards <pedwards@disaster.jaj.com>
To: harald@tritan.tn.cornell.edu
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/5104: template using std::set_terminate fails due to throw() qualifier in <exception>
Date: Thu, 13 Dec 2001 15:00:13 -0500

 On Thu, Dec 13, 2001 at 05:17:07PM -0000, harald@tritan.tn.cornell.edu wrote:
 > >Fix:
 > Change line 74 of header file 'exception' from 
 > terminate_handler set_terminate(terminate_handler) throw();
 > to 
 > terminate_handler set_terminate(terminate_handler);
 
 The C++ standard requires that set_terminate() has the signature that it
 presently does.
 
 The right solution is to teach your code that SetHandlerFunction does not
 throw, but I don't recall how to do that offhand.
 


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

* c++/5104: template using std::set_terminate fails due to throw() qualifier in <exception>
@ 2001-12-13  9:26 harald
  0 siblings, 0 replies; 5+ messages in thread
From: harald @ 2001-12-13  9:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5104
>Category:       c++
>Synopsis:       template using std::set_terminate fails due to throw() qualifier in <exception>
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 13 09:26:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     harald@tritan.tn.cornell.edu
>Release:        gcc version 3.0.2 20010905 (Red Hat Linux 7.1 3.0.1-3)
>Organization:
>Environment:
Linux Laptop running redhat 7.2 
>Description:
A template using std:set_terminate does not compile with 
the error message:

bug.C:12: could not convert template argument `std::set_terminate' to `void 
   (*(*)(void (*)()))()'
bug.C:12: ISO C++ forbids declaration of `Terminate' with no type

After changing line 74 of the header file 'exception' from 
terminate_handler set_terminate(terminate_handler) throw();
to 
terminate_handler set_terminate(terminate_handler);

then the file bug.C compiles to an object file. 
>How-To-Repeat:
Compile the following source code with g++3 -c 

#include <exception>

typedef void (*HandlerFunction)();
typedef HandlerFunction (*SetHandlerFunction)(HandlerFunction);

template <SetHandlerFunction set_function>
class HandlerStack {
public:
  static void defaultHandler();
};

typedef HandlerStack<std::set_terminate> Terminate;

void Terminate::defaultHandler() {};
>Fix:
Change line 74 of header file 'exception' from 
terminate_handler set_terminate(terminate_handler) throw();
to 
terminate_handler set_terminate(terminate_handler);
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bug.ii"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bug.ii"

IyAxICJidWcuQyIKIyAxICIvdXNyL2luY2x1ZGUvZysrLXYzL2V4Y2VwdGlvbiIgMSAzCiMgMzkg
Ii91c3IvaW5jbHVkZS9nKystdjMvZXhjZXB0aW9uIiAzCmV4dGVybiAiQysrIiB7CgpuYW1lc3Bh
Y2Ugc3RkCnsKCgoKCgoKICBjbGFzcyBleGNlcHRpb24KICB7CiAgcHVibGljOgogICAgZXhjZXB0
aW9uKCkgdGhyb3coKSB7IH0KICAgIHZpcnR1YWwgfmV4Y2VwdGlvbigpIHRocm93KCk7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WMgdm9pZCBkZWZhdWx0SGFuZGxl
cigpOwp9OwoKdHlwZWRlZiBIYW5kbGVyU3RhY2s8c3RkOjpzZXRfdGVybWluYXRlPiBUZXJtaW5h
dGU7Cgp2b2lkIFRlcm1pbmF0ZTo6ZGVmYXVsdEhhbmRsZXIoKSB7fTsK


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

end of thread, other threads:[~2002-04-04  1:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-03 17:36 c++/5104: template using std::set_terminate fails due to throw() qualifier in <exception> jason
  -- strict thread matches above, loose matches on Subject: below --
2002-04-03 14:52 jason
2001-12-14 20:23 rodrigc
2001-12-13 12:06 Phil Edwards
2001-12-13  9:26 harald

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).