This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29873] New: need to rework behaviour of 'typedef struct { ... } x;'
- From: "geoffk at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Nov 2006 22:07:35 -0000
- Subject: [Bug c++/29873] New: need to rework behaviour of 'typedef struct { ... } x;'
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
GCC rejects this code:
template <void (*p)()> struct pp
{
static void (*the_p)();
};
template <void (*p)()> void (* pp<p>::the_p )() = p;
typedef struct
{
static void f() { }
struct pp<f> mypp;
} f_struct;
void g()
{
pp<f_struct::f>::the_p = 0;
}
with
t9.cc:10: error: '<anonymous struct>::f' is not a valid template argument for
type 'void (*)()' because function 'static void<anonymous struct>::f()' has not
external linkage
t9.cc: In function 'void g()':
t9.cc:15: error: 'f_struct::f' is not a valid template argument for type 'void
(*)()' because function 'static void f_struct::f()' has not external linkage
t9.cc:15: error: invalid type in declaration before '=' token
I believe this is incorrect. f_struct has external linkage by [basic.link]
paragraph 4 item 3, and then f_struct::f has external linkage by paragraph 5.
There is a FIXME in decl.c that says:
/* FIXME remangle member functions; member functions of a
type with external linkage have external linkage. */
which is related but not quite the same thing; it's not just the mangling that
is a problem.
--
Summary: need to rework behaviour of 'typedef struct { ... } x;'
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: geoffk at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29873