public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57243] New: Using auto in range based for with templated container in templated function requires extraneous template qualifier
@ 2013-05-10 17:37 w.shane.grant at gmail dot com
2013-05-12 8:50 ` [Bug c++/57243] " paolo.carlini at oracle dot com
2013-05-14 20:56 ` jason at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: w.shane.grant at gmail dot com @ 2013-05-10 17:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57243
Bug ID: 57243
Summary: Using auto in range based for with templated container
in templated function requires extraneous template
qualifier
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: w.shane.grant at gmail dot com
Using the auto keyword in a range based for loop under three conditions related
to templating requires an unnecessary use of the template qualifier for
compilation to happen successfully:
1. The container being iterated is templated
2. The range based for loop is inside of a template function
3. The iterated item has a template function
Here is a minimal example:
struct snarf
{
template <class T>
void get() {}
};
template <class T>
struct container
{
snarf * begin() { return nullptr; }
snarf * end() { return nullptr; }
};
template <class T>
void foo()
{
container<int> arr;
for( auto i : arr )
i.get<int>();
}
int main()
{
return 0;
}
The issue goes away if any of the following happen:
- foo is made a non template function
- arr is made a non template container
- auto is replaced with the actual type (snarf in this example)
- the function called on the range declaration (i) is not templated
- the template keyword is used to disambiguate the call to get
- the range based for loop is replaced with a standard for loop over the
iterators (auto works fine here)
Issue seems to happen with both versions of g++ I have installed (4.7.3 and g++
4.8.1 20130401) but not under clang (version 3.3 (trunk 178896)).
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/57243] Using auto in range based for with templated container in templated function requires extraneous template qualifier
2013-05-10 17:37 [Bug c++/57243] New: Using auto in range based for with templated container in templated function requires extraneous template qualifier w.shane.grant at gmail dot com
@ 2013-05-12 8:50 ` paolo.carlini at oracle dot com
2013-05-14 20:56 ` jason at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-05-12 8:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57243
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-05-12
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/57243] Using auto in range based for with templated container in templated function requires extraneous template qualifier
2013-05-10 17:37 [Bug c++/57243] New: Using auto in range based for with templated container in templated function requires extraneous template qualifier w.shane.grant at gmail dot com
2013-05-12 8:50 ` [Bug c++/57243] " paolo.carlini at oracle dot com
@ 2013-05-14 20:56 ` jason at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: jason at gcc dot gnu.org @ 2013-05-14 20:56 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57243
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |jason at gcc dot gnu.org
Resolution|--- |FIXED
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
Target Milestone|--- |4.8.1
--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 4.8.1.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-14 20:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-10 17:37 [Bug c++/57243] New: Using auto in range based for with templated container in templated function requires extraneous template qualifier w.shane.grant at gmail dot com
2013-05-12 8:50 ` [Bug c++/57243] " paolo.carlini at oracle dot com
2013-05-14 20:56 ` jason 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).