public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28044] New: Non-template class function return type taken as template when declared in a function template's return type
@ 2006-06-15 18:14 widman at gimpel dot com
2006-06-15 18:52 ` [Bug c++/28044] " pinskia at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: widman at gimpel dot com @ 2006-06-15 18:14 UTC (permalink / raw)
To: gcc-bugs
See below; G++ appears to correctly handle the use of 'struct B' to declare the
function template g(), but if there is no prior declaration of the class (as in
the declaration of f()), the class is erroneously taken as a class template.
extern "C" int printf( const char*, ... );
struct B{ int n; B(int n_) : n(n_){} };
template<class T> struct B g() // OK, g() returns B
{
return B(32);
}
template<class T> struct A f(); // OK, f() returns A
struct A { char c; A(char c_) : c(c_){}};
template<class T> struct A f()
{
return A('x');
}
int main( )
{
(void) printf( "%d, %c\n",
g<double>().n,
f<float>().c ); // prints "32, x\n".
return 0;
}
--
Summary: Non-template class function return type taken as
template when declared in a function template's return
type
Product: gcc
Version: 4.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: widman at gimpel dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28044
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/28044] Non-template class function return type taken as template when declared in a function template's return type
2006-06-15 18:14 [Bug c++/28044] New: Non-template class function return type taken as template when declared in a function template's return type widman at gimpel dot com
@ 2006-06-15 18:52 ` pinskia at gcc dot gnu dot org
2006-06-15 19:12 ` widman at gimpel dot com
2006-06-17 3:32 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-15 18:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-06-15 18:31 -------
This works correctly in 4.2.0.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28044
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/28044] Non-template class function return type taken as template when declared in a function template's return type
2006-06-15 18:14 [Bug c++/28044] New: Non-template class function return type taken as template when declared in a function template's return type widman at gimpel dot com
2006-06-15 18:52 ` [Bug c++/28044] " pinskia at gcc dot gnu dot org
@ 2006-06-15 19:12 ` widman at gimpel dot com
2006-06-17 3:32 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: widman at gimpel dot com @ 2006-06-15 19:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from widman at gimpel dot com 2006-06-15 18:51 -------
(In reply to comment #1)
> This works correctly in 4.2.0.
>
Ok; should the fix be back-ported to earlier versions? If not I guess this
should be a "WONTFIX".
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28044
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/28044] Non-template class function return type taken as template when declared in a function template's return type
2006-06-15 18:14 [Bug c++/28044] New: Non-template class function return type taken as template when declared in a function template's return type widman at gimpel dot com
2006-06-15 18:52 ` [Bug c++/28044] " pinskia at gcc dot gnu dot org
2006-06-15 19:12 ` widman at gimpel dot com
@ 2006-06-17 3:32 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-17 3:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-06-17 02:51 -------
Fixed in 4.1.0.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28044
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-06-17 2:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-15 18:14 [Bug c++/28044] New: Non-template class function return type taken as template when declared in a function template's return type widman at gimpel dot com
2006-06-15 18:52 ` [Bug c++/28044] " pinskia at gcc dot gnu dot org
2006-06-15 19:12 ` widman at gimpel dot com
2006-06-17 3:32 ` pinskia 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).