public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60611] New: friend function declaration rejected when the namespace in which it is declared is not explicitely specified in the declaration
@ 2014-03-21 14:05 nicolas.bertolotti at mathworks dot fr
2014-03-21 16:04 ` [Bug c++/60611] " redi at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: nicolas.bertolotti at mathworks dot fr @ 2014-03-21 14:05 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 5033 bytes --]
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60611
Bug ID: 60611
Summary: friend function declaration rejected when the
namespace in which it is declared is not explicitely
specified in the declaration
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nicolas.bertolotti at mathworks dot fr
Created attachment 32419
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32419&action=edit
Source file to reproduce the issue
If you compile the following piece of code using g++ (4.7.2):
"
class class1;
namespace ns1 {
class class2;
class class3;
}
ns1::class3 *func(ns1::class2 * cfg, const class1 * def);
namespace ns1 {
class class4 {
#ifdef WORKAROUND
friend ns1::class3 *(::func)(ns1::class2 * cfg, const class1 * def);
#else
friend class3 *(::func)(class2 * cfg, const class1 * def);
#endif
};
}
" (also attached)
you get the following:
$ g++ -c test.cpp
test.cpp:17:25: error: âfuncâ is neither function nor member function; cannot
be declared friend
test.cpp:17:23: error: expected â;â at end of member declaration
test.cpp:17:32: error: expected â)â before â*â token
Now, if you explicitely add the namespaces as they appear in the initial
declaration (add -DWORKAROUND), the compilation succeeds.
>From gcc-bugs-return-447100-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Mar 21 14:11:42 2014
Return-Path: <gcc-bugs-return-447100-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 15535 invoked by alias); 21 Mar 2014 14:11:42 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 15517 invoked by uid 48); 21 Mar 2014 14:11:39 -0000
From: "tasptz at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60612] New: Throwing exception, catching and rethrowing (std::exception_ptr) in destructor leads to segfault
Date: Fri, 21 Mar 2014 14:11:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: tasptz at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-60612-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-03/txt/msg01969.txt.bz2
Content-length: 1658
http://gcc.gnu.org/bugzilla/show_bug.cgi?id`612
Bug ID: 60612
Summary: Throwing exception, catching and rethrowing
(std::exception_ptr) in destructor leads to segfault
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tasptz at gmail dot com
Created attachment 32420
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id2420&actioníit
Test source file
See attached sample.
Compiled with gcc 4.7 (g++-4.7 (Ubuntu/Linaro 4.7.3-2ubuntu1~12.04) 4.7.3) the
program runs and exits normally. Compiled with gcc 4.8 a segfault occurs.
#0 0x0000000000000000 in ?? ()
#1 0x00007ffff7b34c76 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#2 0x00007ffff7b33d39 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007ffff7b348ea in __gxx_personality_v0 () from
/usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007ffff75d3803 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#5 0x00007ffff75d3b9b in _Unwind_RaiseException () from
/lib/x86_64-linux-gnu/libgcc_s.so.1
#6 0x00007ffff7b34c5a in
std::rethrow_exception(std::__exception_ptr::exception_ptr) () from
/usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7 0x0000000000400cb1 in A::~A() ()
#8 0x0000000000400bc4 in main ()
version:
g++ (GCC) 4.8.2
system:
Linux gpustation 3.5.0-21-generic #32~precise1-Ubuntu SMP Thu Dec 13 20:26:47
UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
gcc configure:
--enable-languages=c,c++
example compilation:
g++ -std=c++11 -o main main.cpp
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/60611] friend function declaration rejected when the namespace in which it is declared is not explicitely specified in the declaration
2014-03-21 14:05 [Bug c++/60611] New: friend function declaration rejected when the namespace in which it is declared is not explicitely specified in the declaration nicolas.bertolotti at mathworks dot fr
@ 2014-03-21 16:04 ` redi at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-21 16:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60611
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-03-21
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-03-21 16:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-21 14:05 [Bug c++/60611] New: friend function declaration rejected when the namespace in which it is declared is not explicitely specified in the declaration nicolas.bertolotti at mathworks dot fr
2014-03-21 16:04 ` [Bug c++/60611] " redi at gcc dot gnu.org
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).