Bug 79400 - [7 Regression] Confusing 'noexcept' suggestion on throw (X)
Summary: [7 Regression] Confusing 'noexcept' suggestion on throw (X)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 7.0.1
: P3 normal
Target Milestone: 7.0
Assignee: Jason Merrill
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2017-02-07 07:56 UTC by Richard Biener
Modified: 2017-02-20 07:02 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-02-07 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2017-02-07 07:56:11 UTC
struct Bar {};
struct Foo
{
  Foo(int) throw(Bar);
};

results in

> ./cc1plus  -quiet t.C
t.C:4:12: warning: dynamic exception specifications are deprecated in C++11; use 'noexcept' instead [-Wdeprecated]
   Foo(int) throw(Bar);
            ^~~~~

shouldn't it suggest to omit the deprecated exception specification instead?  Using 'noexcept' in this context would be clearly wrong.
Comment 1 Jakub Jelinek 2017-02-07 08:51:25 UTC
noexcept(false) ?
Comment 2 Richard Biener 2017-02-07 08:54:11 UTC
Maybe it should suggests

  Foo(int) noexcept(false);

but that's the same as omitting the exception specification?
Comment 3 Jonathan Wakely 2017-02-07 10:57:02 UTC
(In reply to Richard Biener from comment #2)
> but that's the same as omitting the exception specification?

In this context, yes.
Comment 4 Jason Merrill 2017-02-20 06:06:18 UTC
Author: jason
Date: Mon Feb 20 06:05:45 2017
New Revision: 245590

URL: https://gcc.gnu.org/viewcvs?rev=245590&root=gcc&view=rev
Log:
	PR c++/79400 - confusing suggestion of 'noexcept'

	* parser.c (cp_parser_exception_specification_opt): Remove
	suggestion for deprecated dynamic exception-specification.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
Comment 5 Jason Merrill 2017-02-20 07:02:57 UTC
Fixed.