Bug 24817 - [3.4/4.0 Regression] g++ accepts multiple function template declarations even if exception-specification doesn't match.
Summary: [3.4/4.0 Regression] g++ accepts multiple function template declarations even...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 4.1.0
Assignee: Mark Mitchell
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2005-11-12 01:21 UTC by Stefan Seefeld
Modified: 2005-12-12 22:35 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 2.95.3
Known to fail: 3.0.4 3.4.0 3.2.3 3.3.3 4.0.0 4.1.0
Last reconfirmed: 2005-11-12 02:57:54


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Seefeld 2005-11-12 01:21:20 UTC
The following invalid code is accepted by g++:

struct exception {};

template <typename T> void foo() throw(exception);
template <typename T> void foo(); // Error: exception-specification mismatch

struct bar
{
  template <typename T> friend void foo(); // Error: exception-specification mismatch
};
Comment 1 Andrew Pinski 2005-11-12 02:57:54 UTC
Confirmed, related to PR 13699 and PR 12255.

The first part of the testcase is rejected in 2.95.3.  The second part is not really a regression.
Comment 2 Mark Mitchell 2005-11-14 05:45:52 UTC
Subject: Bug 24817

Author: mmitchel
Date: Mon Nov 14 05:45:45 2005
New Revision: 106884

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106884
Log:
	PR c++/24817
	* decl.c (check_redeclaration_exception_specification): New
	function.
	(duplicate_decls): Use it.
	* error.c (fndecl_to_string): Print the template parameter list.
	PR c++/24817
	* g++.dg/eh/spec8.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/eh/spec8.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/error.c
    trunk/gcc/testsuite/ChangeLog

Comment 3 Mark Mitchell 2005-11-14 05:49:34 UTC
Fixed in 4.1.

See http://gcc.gnu.org/ml/gcc-patches/2005-11/msg00945.html for rationale for not fixing this PR in earlier releases.
Comment 4 Volker Reichelt 2005-12-12 22:35:45 UTC
Lets close it as fixed then.