public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "davek at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/41020] [4.5 Regression] Can't declare an extern "C" friend.
Date: Mon, 10 Aug 2009 17:16:00 -0000 [thread overview]
Message-ID: <20090810171623.3684.qmail@sourceware.org> (raw)
In-Reply-To: <bug-41020-14373@http.gcc.gnu.org/bugzilla/>
------- Comment #5 from davek at gcc dot gnu dot org 2009-08-10 17:16 -------
(In reply to comment #4)
> It's irrelevant to this bug and is just me being more pedantic than -pedantic,
> however ... even with -pedantic GCC has always accepted stray semi-colons at
> namespace scope, but it's not valid.
>
> At function scope a lone ';' is a valid expression-statement, but
> expression-statements are not allowed at namespace scope, only declarations
> are, and ';' is not a valid declaration.
Well you learn something new every day! Never realised that was a gnu
extension, but it sure is, comeau online choked on my testcase:
"ComeauTest.c", line 5: error: extra ";" ignored,
In C: A function definition does not end with a semicolon
In C++: A non-member function definition, extern "C" block,
or namespace does not end with a semicolon
};
^
Anyway. Consider the testcase amended. :-)
$ cat friend.cxx
extern "C"
{
int fork (void);
}
class frok
{
int this_errno;
friend int fork (void);
};
extern "C" int
fork (void)
{
frok grouped;
return grouped.this_errno;
}
$ g++-4 -c friend.cxx -o friend.o
friend.cxx:10:24: error: new declaration 'int fork()'
friend.cxx:4:7: error: ambiguates old declaration 'int fork()'
friend.cxx: In function 'int fork()':
friend.cxx:9:7: error: 'int frok::this_errno' is private
friend.cxx:17:18: error: within this context
$
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41020
next prev parent reply other threads:[~2009-08-10 17:16 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-09 21:30 [Bug c++/41020] New: " davek at gcc dot gnu dot org
2009-08-09 21:32 ` [Bug c++/41020] " davek at gcc dot gnu dot org
2009-08-10 10:40 ` jwakely dot gcc at gmail dot com
2009-08-10 12:45 ` [Bug c++/41020] [4.5 Regression] " rguenth at gcc dot gnu dot org
2009-08-10 16:17 ` davek at gcc dot gnu dot org
2009-08-10 17:05 ` jwakely dot gcc at gmail dot com
2009-08-10 17:16 ` davek at gcc dot gnu dot org [this message]
2009-08-24 1:00 ` mmitchel at gcc dot gnu dot org
2009-09-18 3:56 ` pinskia at gcc dot gnu dot org
2009-10-04 19:14 ` [Bug c++/41020] [4.5 Regression] Can't declare an extern "C" friend of a builtin function pinskia at gcc dot gnu dot org
2009-10-23 18:19 ` Dodji Seketeli
2009-10-23 18:20 ` dodji at redhat dot com
2009-10-23 18:34 ` dodji at gcc dot gnu dot org
2009-10-23 19:32 ` dodji at redhat dot com
2009-10-26 14:40 ` dodji at gcc dot gnu dot org
2009-10-26 16:06 ` dodji at gcc dot gnu dot org
2009-10-27 10:29 ` jakub at gcc dot gnu dot org
2009-10-29 16:53 ` law at gcc dot gnu dot org
2009-10-30 16:07 ` hjl at gcc dot gnu dot org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090810171623.3684.qmail@sourceware.org \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).