public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/37256] New: extern template / explicit instantiation broken in 4.4.0-pre
@ 2008-08-27 14:45 ciaran dot mccreesh at googlemail dot com
2008-08-27 16:35 ` [Bug c++/37256] " paolo dot carlini at oracle dot com
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: ciaran dot mccreesh at googlemail dot com @ 2008-08-27 14:45 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1478 bytes --]
The following C++ code compiles (but doesn't link) with g++ 4.3.1:
template <typename T_>
struct B
{
T_ f();
};
extern template class B<int>;
void f()
{
B<int> t;
t.f();
}
With 'gcc () 4.4.0-pre9999 built 20080827 (Gentoo SVN ebuild) rev. 139623', the
following error occurs:
$ g++ -O1 a.cc
a.cc: In instantiation of T_ B<T_>::f() [with T_ = int]:
a.cc:12: instantiated from here
a.cc:12: error: explicit instantiation of T_ B<T_>::f() [with T_ = int] but
no definition available
If no -O is specified, the error does not occur. Using -std=c++0x does not
alter the outcome.
I'm looking at n2723 14.7.2 for what the behaviour should be. My understanding
is as follows: By paragraph 7, the explicit instantiation declaration for
B<int> is also an explicit instantiation declaration for int B<int>::f(). Thus,
by paragraph 3, a definition of B<int> must be available when declaring int
B<int>::f(), which it is. But I don't see a requirement for a definition of
B<int>::f().
--
Summary: extern template / explicit instantiation broken in
4.4.0-pre
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ciaran dot mccreesh at googlemail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37256
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/37256] extern template / explicit instantiation broken in 4.4.0-pre
2008-08-27 14:45 [Bug c++/37256] New: extern template / explicit instantiation broken in 4.4.0-pre ciaran dot mccreesh at googlemail dot com
@ 2008-08-27 16:35 ` paolo dot carlini at oracle dot com
2008-08-27 16:50 ` sebor at roguewave dot com
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-27 16:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from paolo dot carlini at oracle dot com 2008-08-27 16:33 -------
Just a clarification about the "broken this, broken that" way of putting
things: G++ started providing the extern template syntax *many*, and I mean it,
*many* years ago, well before the standardization in C++0x. AFAICS, this
testcase never linked. Thus, if anything, it's just that now, with C++0x, we
have a divergence between the behavior of extern template as a G++ extension
and its behavior as mandated by n2723. Nothing can be broken.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37256
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/37256] extern template / explicit instantiation broken in 4.4.0-pre
2008-08-27 14:45 [Bug c++/37256] New: extern template / explicit instantiation broken in 4.4.0-pre ciaran dot mccreesh at googlemail dot com
2008-08-27 16:35 ` [Bug c++/37256] " paolo dot carlini at oracle dot com
@ 2008-08-27 16:50 ` sebor at roguewave dot com
2008-08-27 16:54 ` paolo dot carlini at oracle dot com
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: sebor at roguewave dot com @ 2008-08-27 16:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from sebor at roguewave dot com 2008-08-27 16:48 -------
Is this by any chance related to bug 24511?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37256
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/37256] extern template / explicit instantiation broken in 4.4.0-pre
2008-08-27 14:45 [Bug c++/37256] New: extern template / explicit instantiation broken in 4.4.0-pre ciaran dot mccreesh at googlemail dot com
2008-08-27 16:35 ` [Bug c++/37256] " paolo dot carlini at oracle dot com
2008-08-27 16:50 ` sebor at roguewave dot com
@ 2008-08-27 16:54 ` paolo dot carlini at oracle dot com
2008-08-27 17:09 ` ciaran dot mccreesh at googlemail dot com
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-27 16:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from paolo dot carlini at oracle dot com 2008-08-27 16:53 -------
Maybe you right Martin, I don't have at hand anything older than 4.0.4 ;)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37256
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/37256] extern template / explicit instantiation broken in 4.4.0-pre
2008-08-27 14:45 [Bug c++/37256] New: extern template / explicit instantiation broken in 4.4.0-pre ciaran dot mccreesh at googlemail dot com
` (2 preceding siblings ...)
2008-08-27 16:54 ` paolo dot carlini at oracle dot com
@ 2008-08-27 17:09 ` ciaran dot mccreesh at googlemail dot com
2008-08-27 17:18 ` paolo dot carlini at oracle dot com
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: ciaran dot mccreesh at googlemail dot com @ 2008-08-27 17:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from ciaran dot mccreesh at googlemail dot com 2008-08-27 17:07 -------
I don't expect it to link. I do expect it to compile. In real code I would of
course have struct B in a header and template class B<int>; in a different
source file.
So far as I can see this is a change in behaviour in 4.4 that goes against both
the draft standard and how the GCC extension used to work, and which makes
'extern template' effectively useless.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37256
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/37256] extern template / explicit instantiation broken in 4.4.0-pre
2008-08-27 14:45 [Bug c++/37256] New: extern template / explicit instantiation broken in 4.4.0-pre ciaran dot mccreesh at googlemail dot com
` (3 preceding siblings ...)
2008-08-27 17:09 ` ciaran dot mccreesh at googlemail dot com
@ 2008-08-27 17:18 ` paolo dot carlini at oracle dot com
2008-08-27 19:37 ` [Bug c++/37256] [4.4 Regression] " paolo dot carlini at oracle dot com
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-27 17:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from paolo dot carlini at oracle dot com 2008-08-27 17:17 -------
Ok, *your* issue is about current mainline only, and only -O and above. Let's
CC Jason...
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37256
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/37256] [4.4 Regression] extern template / explicit instantiation broken in 4.4.0-pre
2008-08-27 14:45 [Bug c++/37256] New: extern template / explicit instantiation broken in 4.4.0-pre ciaran dot mccreesh at googlemail dot com
` (4 preceding siblings ...)
2008-08-27 17:18 ` paolo dot carlini at oracle dot com
@ 2008-08-27 19:37 ` paolo dot carlini at oracle dot com
2008-08-27 19:39 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-27 19:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from paolo dot carlini at oracle dot com 2008-08-27 19:36 -------
And to be safe, let's mark it as Regression. Sorry for not having noticed the
issue about -O earlier.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-08-27 19:36:05
date| |
Summary|extern template / explicit |[4.4 Regression] extern
|instantiation broken in |template / explicit
|4.4.0-pre |instantiation broken in
| |4.4.0-pre
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37256
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/37256] [4.4 Regression] extern template / explicit instantiation broken in 4.4.0-pre
2008-08-27 14:45 [Bug c++/37256] New: extern template / explicit instantiation broken in 4.4.0-pre ciaran dot mccreesh at googlemail dot com
` (5 preceding siblings ...)
2008-08-27 19:37 ` [Bug c++/37256] [4.4 Regression] " paolo dot carlini at oracle dot com
@ 2008-08-27 19:39 ` pinskia at gcc dot gnu dot org
2008-09-09 20:26 ` jsm28 at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-08-27 19:39 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from pinskia at gcc dot gnu dot org 2008-08-27 19:38 -------
I want to say this is caused by one of the unit at a time changes ...
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Keywords| |rejects-valid
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37256
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/37256] [4.4 Regression] extern template / explicit instantiation broken in 4.4.0-pre
2008-08-27 14:45 [Bug c++/37256] New: extern template / explicit instantiation broken in 4.4.0-pre ciaran dot mccreesh at googlemail dot com
` (6 preceding siblings ...)
2008-08-27 19:39 ` pinskia at gcc dot gnu dot org
@ 2008-09-09 20:26 ` jsm28 at gcc dot gnu dot org
2008-11-19 0:11 ` jason at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-09-09 20:26 UTC (permalink / raw)
To: gcc-bugs
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37256
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/37256] [4.4 Regression] extern template / explicit instantiation broken in 4.4.0-pre
2008-08-27 14:45 [Bug c++/37256] New: extern template / explicit instantiation broken in 4.4.0-pre ciaran dot mccreesh at googlemail dot com
` (7 preceding siblings ...)
2008-09-09 20:26 ` jsm28 at gcc dot gnu dot org
@ 2008-11-19 0:11 ` jason at gcc dot gnu dot org
2008-11-19 19:30 ` jason at gcc dot gnu dot org
2008-11-19 19:42 ` jason at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-11-19 0:11 UTC (permalink / raw)
To: gcc-bugs
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jason at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2008-08-27 19:36:05 |2008-11-19 00:10:15
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37256
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/37256] [4.4 Regression] extern template / explicit instantiation broken in 4.4.0-pre
2008-08-27 14:45 [Bug c++/37256] New: extern template / explicit instantiation broken in 4.4.0-pre ciaran dot mccreesh at googlemail dot com
` (8 preceding siblings ...)
2008-11-19 0:11 ` jason at gcc dot gnu dot org
@ 2008-11-19 19:30 ` jason at gcc dot gnu dot org
2008-11-19 19:42 ` jason at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-11-19 19:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jason at gcc dot gnu dot org 2008-11-19 19:29 -------
Subject: Bug 37256
Author: jason
Date: Wed Nov 19 19:27:29 2008
New Revision: 142014
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142014
Log:
PR c++/37256
* pt.c (instantiate_decl): Don't require a definition of
a template that is explicitly instantiated 'extern'.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/extern_template-3.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37256
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/37256] [4.4 Regression] extern template / explicit instantiation broken in 4.4.0-pre
2008-08-27 14:45 [Bug c++/37256] New: extern template / explicit instantiation broken in 4.4.0-pre ciaran dot mccreesh at googlemail dot com
` (9 preceding siblings ...)
2008-11-19 19:30 ` jason at gcc dot gnu dot org
@ 2008-11-19 19:42 ` jason at gcc dot gnu dot org
10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-11-19 19:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jason at gcc dot gnu dot org 2008-11-19 19:41 -------
Fixed.
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37256
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-11-19 19:42 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-27 14:45 [Bug c++/37256] New: extern template / explicit instantiation broken in 4.4.0-pre ciaran dot mccreesh at googlemail dot com
2008-08-27 16:35 ` [Bug c++/37256] " paolo dot carlini at oracle dot com
2008-08-27 16:50 ` sebor at roguewave dot com
2008-08-27 16:54 ` paolo dot carlini at oracle dot com
2008-08-27 17:09 ` ciaran dot mccreesh at googlemail dot com
2008-08-27 17:18 ` paolo dot carlini at oracle dot com
2008-08-27 19:37 ` [Bug c++/37256] [4.4 Regression] " paolo dot carlini at oracle dot com
2008-08-27 19:39 ` pinskia at gcc dot gnu dot org
2008-09-09 20:26 ` jsm28 at gcc dot gnu dot org
2008-11-19 0:11 ` jason at gcc dot gnu dot org
2008-11-19 19:30 ` jason at gcc dot gnu dot org
2008-11-19 19:42 ` jason at gcc dot gnu dot 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).