public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27560] New: template function not recognized when invoked with enum defined in function
@ 2006-05-11 15:43 ian at airs dot com
2006-05-11 15:58 ` [Bug c++/27560] " pinskia at gcc dot gnu dot org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: ian at airs dot com @ 2006-05-11 15:43 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]
Compiling this file, with mainline, gcc 4.0, or 4.1
template<typename t> void f(t a) { }
void g() { enum e { v }; f(v); }
gives this error message:
foo.cc: In function void g():
foo.cc:2: error: no matching function for call to f(g()::e)
If the enum definition is moved out of the function, this works. With gcc 3.2,
this works. I didn't try 3.4.
My C++ fu is weak, and I do not know for sure that this is valid C++, although
I don't see anything wrong with it. But either 1) it is valid and gcc should
accept it, or 2) gcc should provide a list of candidates which did not match,
since there is manifestly a function named 'f'.
--
Summary: template function not recognized when invoked with enum
defined in function
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ian at airs dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27560
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/27560] template function not recognized when invoked with enum defined in function
2006-05-11 15:43 [Bug c++/27560] New: template function not recognized when invoked with enum defined in function ian at airs dot com
@ 2006-05-11 15:58 ` pinskia at gcc dot gnu dot org
2006-05-11 16:07 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-11 15:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-05-11 15:58 -------
This is not valid, the type is a local type which causes it be rejected for
templates. The same happens with local classes.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27560
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/27560] template function not recognized when invoked with enum defined in function
2006-05-11 15:43 [Bug c++/27560] New: template function not recognized when invoked with enum defined in function ian at airs dot com
2006-05-11 15:58 ` [Bug c++/27560] " pinskia at gcc dot gnu dot org
@ 2006-05-11 16:07 ` pinskia at gcc dot gnu dot org
2006-05-11 16:24 ` gdr at integrable-solutions dot net
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-11 16:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2006-05-11 16:07 -------
14.3.1/2
A local type, a type with no linkage, an unnamed type or a type compounded from
any of these types shall
not be used as atemplate-argument for a template type-parameter.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27560
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/27560] template function not recognized when invoked with enum defined in function
2006-05-11 15:43 [Bug c++/27560] New: template function not recognized when invoked with enum defined in function ian at airs dot com
2006-05-11 15:58 ` [Bug c++/27560] " pinskia at gcc dot gnu dot org
2006-05-11 16:07 ` pinskia at gcc dot gnu dot org
@ 2006-05-11 16:24 ` gdr at integrable-solutions dot net
2006-05-11 16:33 ` gdr at gcc dot gnu dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: gdr at integrable-solutions dot net @ 2006-05-11 16:24 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 873 bytes --]
------- Comment #3 from gdr at integrable-solutions dot net 2006-05-11 16:24 -------
Subject: Re: New: template function not recognized when invoked with enum
defined in function
"ian at airs dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| Compiling this file, with mainline, gcc 4.0, or 4.1
|
| template<typename t> void f(t a) { }
| void g() { enum e { v }; f(v); }
|
| gives this error message:
|
| foo.cc: In function Âvoid g()Â:
| foo.cc:2: error: no matching function for call to Âf(g()::e)Â
|
| If the enum definition is moved out of the function, this works. With gcc
3.2,
| this works. I didn't try 3.4.
There is a core issue for this. We discussed it again at the last
meeting in Berlin. There are proposals to make it "just work", but
that is still in the open state.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27560
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/27560] template function not recognized when invoked with enum defined in function
2006-05-11 15:43 [Bug c++/27560] New: template function not recognized when invoked with enum defined in function ian at airs dot com
` (2 preceding siblings ...)
2006-05-11 16:24 ` gdr at integrable-solutions dot net
@ 2006-05-11 16:33 ` gdr at gcc dot gnu dot org
2006-05-11 16:38 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: gdr at gcc dot gnu dot org @ 2006-05-11 16:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from gdr at gcc dot gnu dot org 2006-05-11 16:33 -------
See
http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_active.html#488
http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2006/n1945.pdf
The later paper is under active consideration.
The PR should be suspended, instead of being hastly closed.
--
gdr at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gdr at gcc dot gnu dot org
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27560
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/27560] template function not recognized when invoked with enum defined in function
2006-05-11 15:43 [Bug c++/27560] New: template function not recognized when invoked with enum defined in function ian at airs dot com
` (3 preceding siblings ...)
2006-05-11 16:33 ` gdr at gcc dot gnu dot org
@ 2006-05-11 16:38 ` pinskia at gcc dot gnu dot org
2006-05-11 16:48 ` gdr at integrable-solutions dot net
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-11 16:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from pinskia at gcc dot gnu dot org 2006-05-11 16:38 -------
(In reply to comment #4)
> The PR should be suspended, instead of being hastly closed.
It was not hastly closed, the current standard says this is invalid.
Anyways there is already a PR open about DR 488.
*** This bug has been marked as a duplicate of 20589 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27560
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/27560] template function not recognized when invoked with enum defined in function
2006-05-11 15:43 [Bug c++/27560] New: template function not recognized when invoked with enum defined in function ian at airs dot com
` (4 preceding siblings ...)
2006-05-11 16:38 ` pinskia at gcc dot gnu dot org
@ 2006-05-11 16:48 ` gdr at integrable-solutions dot net
2006-05-11 22:56 ` ian at airs dot com
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: gdr at integrable-solutions dot net @ 2006-05-11 16:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from gdr at integrable-solutions dot net 2006-05-11 16:47 -------
Subject: Re: template function not recognized when invoked with enum defined
in function
"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| It was not hastly closed, the current standard says this is invalid.
and the current standard is known to be defective in that aspect,
which is why we had the core issue in the first place.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27560
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/27560] template function not recognized when invoked with enum defined in function
2006-05-11 15:43 [Bug c++/27560] New: template function not recognized when invoked with enum defined in function ian at airs dot com
` (5 preceding siblings ...)
2006-05-11 16:48 ` gdr at integrable-solutions dot net
@ 2006-05-11 22:56 ` ian at airs dot com
2006-05-11 23:03 ` pinskia at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: ian at airs dot com @ 2006-05-11 22:56 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from ian at airs dot com 2006-05-11 22:55 -------
PR 20589 seems to be about an unnamed enum.
This enum in this test case is not unnamed. It is local to a function, but has
a name.
This may be related to 20589, but I don't think it is the same issue.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27560
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/27560] template function not recognized when invoked with enum defined in function
2006-05-11 15:43 [Bug c++/27560] New: template function not recognized when invoked with enum defined in function ian at airs dot com
` (6 preceding siblings ...)
2006-05-11 22:56 ` ian at airs dot com
@ 2006-05-11 23:03 ` pinskia at gcc dot gnu dot org
2006-05-11 23:20 ` gdr at integrable-solutions dot net
2009-11-04 20:16 ` jason at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-05-11 23:03 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from pinskia at gcc dot gnu dot org 2006-05-11 23:03 -------
(In reply to comment #7)
> This may be related to 20589, but I don't think it is the same issue.
It is the same issue because there is only one Defect report for the C++
standard.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27560
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/27560] template function not recognized when invoked with enum defined in function
2006-05-11 15:43 [Bug c++/27560] New: template function not recognized when invoked with enum defined in function ian at airs dot com
` (7 preceding siblings ...)
2006-05-11 23:03 ` pinskia at gcc dot gnu dot org
@ 2006-05-11 23:20 ` gdr at integrable-solutions dot net
2009-11-04 20:16 ` jason at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: gdr at integrable-solutions dot net @ 2006-05-11 23:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from gdr at integrable-solutions dot net 2006-05-11 23:20 -------
Subject: Re: template function not recognized when invoked with enum defined
in function
"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| (In reply to comment #7)
| > This may be related to 20589, but I don't think it is the same issue.
| It is the same issue because there is only one Defect report for the C++
| standard.
They are not the same thing.
However, somehow, both issues have been conglomerated in the same
_topic_
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27560
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/27560] template function not recognized when invoked with enum defined in function
2006-05-11 15:43 [Bug c++/27560] New: template function not recognized when invoked with enum defined in function ian at airs dot com
` (8 preceding siblings ...)
2006-05-11 23:20 ` gdr at integrable-solutions dot net
@ 2009-11-04 20:16 ` jason at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-04 20:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from jason at gcc dot gnu dot org 2009-11-04 20:16 -------
In 4.5 this will compile with -std=c++0x.
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27560
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2009-11-04 20:16 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-11 15:43 [Bug c++/27560] New: template function not recognized when invoked with enum defined in function ian at airs dot com
2006-05-11 15:58 ` [Bug c++/27560] " pinskia at gcc dot gnu dot org
2006-05-11 16:07 ` pinskia at gcc dot gnu dot org
2006-05-11 16:24 ` gdr at integrable-solutions dot net
2006-05-11 16:33 ` gdr at gcc dot gnu dot org
2006-05-11 16:38 ` pinskia at gcc dot gnu dot org
2006-05-11 16:48 ` gdr at integrable-solutions dot net
2006-05-11 22:56 ` ian at airs dot com
2006-05-11 23:03 ` pinskia at gcc dot gnu dot org
2006-05-11 23:20 ` gdr at integrable-solutions dot net
2009-11-04 20:16 ` 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).