public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/20307] New: template resolution is wrong when accessed with namespace prefix
@ 2005-03-03 21:14 vasilche at ncbi dot nlm dot nih dot gov
2005-03-03 22:55 ` [Bug c++/20307] " pinskia at gcc dot gnu dot org
2005-03-04 4:00 ` smcpeak at cs dot berkeley dot edu
0 siblings, 2 replies; 3+ messages in thread
From: vasilche at ncbi dot nlm dot nih dot gov @ 2005-03-03 21:14 UTC (permalink / raw)
To: gcc-bugs
In the program:
--------------
extern "C" int puts(const char*);
template<typename A, typename B>
void foo(A a, B b)
{
puts("ERROR: foo<A, B>");
}
template<typename X>
void bar(X a)
{
#ifdef ERROR
::foo(a, a);
#else
foo(a, a);
#endif
}
template<typename A>
void foo(A a, A b)
{
puts("OK: foo<A>");
}
int main()
{
int a = 0;
bar(a);
}
---------------
When foo<> template is accessed without namespace qualifier from within bar<>
template, GCC selects correct second variant of template variant.
If I put namespace qualifier gcc chooses the first variant.
This bug appeared with gcc 3.4 and exists in 3.4.1-3.4.3.
I didn't check newer versions.
There was no this bug in gcc 2.95-3.3.3.
Intel, Sun, and MS compilers all choose correct second variant of foo<>.
--
Summary: template resolution is wrong when accessed with
namespace prefix
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: vasilche at ncbi dot nlm dot nih dot gov
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: 3.4.0-3.4.3
GCC host triplet: Linux widget1 2.4.23-P4-4G #8 SMP Tue Dec 16 16:34:15
EST 2003 i
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20307
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/20307] template resolution is wrong when accessed with namespace prefix
2005-03-03 21:14 [Bug c++/20307] New: template resolution is wrong when accessed with namespace prefix vasilche at ncbi dot nlm dot nih dot gov
@ 2005-03-03 22:55 ` pinskia at gcc dot gnu dot org
2005-03-04 4:00 ` smcpeak at cs dot berkeley dot edu
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-03 22:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-03-03 22:54 -------
Nope, qualified names bind right away, see PR 11828.
And from the standard:
>From [temp.dep.candidate]:
For a function call that depends on a template parameter, if the function name is an "unqualified-id"
but not a template-id, the candidate functions are found using the usual lookup rules (3.4.1, 3.4.2)
*** This bug has been marked as a duplicate of 11828 ***
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20307
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/20307] template resolution is wrong when accessed with namespace prefix
2005-03-03 21:14 [Bug c++/20307] New: template resolution is wrong when accessed with namespace prefix vasilche at ncbi dot nlm dot nih dot gov
2005-03-03 22:55 ` [Bug c++/20307] " pinskia at gcc dot gnu dot org
@ 2005-03-04 4:00 ` smcpeak at cs dot berkeley dot edu
1 sibling, 0 replies; 3+ messages in thread
From: smcpeak at cs dot berkeley dot edu @ 2005-03-04 4:00 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From smcpeak at cs dot berkeley dot edu 2005-03-04 03:59 -------
Andrew, I think you are misinterpreting [temp.dep.candidate]
(14.6.4.2). That section modifies the lookup rules for
unqualified-ids that are dependent, but does *not* say that only
unqualified-ids can be dependent.
I already posted a comment (#20) in PR 11282 that (among other
things) points this out, but no one has responded.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20307
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-03-04 4:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-03 21:14 [Bug c++/20307] New: template resolution is wrong when accessed with namespace prefix vasilche at ncbi dot nlm dot nih dot gov
2005-03-03 22:55 ` [Bug c++/20307] " pinskia at gcc dot gnu dot org
2005-03-04 4:00 ` smcpeak at cs dot berkeley dot edu
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).