This is the mail archive of the
mailing list for the GCC project.
Re: [C++ Patch] Fix for PR c++/19076 and PR c++/6628
- From: Douglas Gregor <doug dot gregor at gmail dot com>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: gcc-patches at gcc dot gnu dot org,jason at redhat dot com,mark at codesourcery dot com
- Date: Mon, 21 Feb 2005 21:51:17 -0500
- Subject: Re: [C++ Patch] Fix for PR c++/19076 and PR c++/6628
- References: <firstname.lastname@example.org> <email@example.com>
On Feb 21, 2005, at 7:08 PM, Gabriel Dos Reis wrote:
Douglas Gregor <firstname.lastname@example.org> writes:
| However, one cannot add qualifiers to a function type. For instance,
| the second line of the following code does not add qualifiers to
| typedef int foo(float) const;
| typedef volatile foo foo_v; // #2
GCC has an extension whereby
volatile foo F;
is legal and means that "F" cannot return. How does your patch
interact with that extension?
Does this extension work in G++? I tried this little program:
typedef void voidfn();
volatile voidfn fatal;
I expected that this would result in a warning saying that "fatal" was
marked noreturn but has a return statement. However:
On GCC & G++ 3.3.5, I get the error '`volatile' qualifiers cannot be
applied to `void ()()'.
On G++ mainline (before the patch), I get nothing. The function doesn't
seem to be marked noreturn by this code.
On G++ mainline (after my patch), I get nothing. However, if I add
"-pedantic", I get an error saying that volatile qualifiers can't be
On GCC mainline (before and after), I get nothing.
Now, if I use the noreturn attribute, then I always get the "function
declared noreturn has a return statement" warning, regardless of the
So AFAICT, this functionality was broken in 3.3.5 and is broken in
mainline CVS. This patch ends up introducing an error message on
"-pedantic". Perhaps everyone has already migrated to noreturn, so
nobody noticed that this extension no longer works?