public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26311] New: [4.1/4.2 Regression] ambiguous overload errors
@ 2006-02-16 0:27 mueller at gcc dot gnu dot org
2006-02-16 0:31 ` [Bug c++/26311] " mueller at gcc dot gnu dot org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: mueller at gcc dot gnu dot org @ 2006-02-16 0:27 UTC (permalink / raw)
To: gcc-bugs
the following testcase from KDE source can not be compiled with gcc 4.1 or
newer:
=== Cut ===
int qHash(char key);
int qHash(int key);
template <class Key> struct QHash
{
void findNode(const Key &key) { qHash(key); }
};
namespace khtml {
struct Font
{
struct ScalKey
{
};
};
}
int qHash (const khtml::Font::ScalKey& key);
static QHash<khtml::Font::ScalKey>* scalCache;
void isFontScalable()
{
khtml::Font::ScalKey key;
scalCache->findNode(key);
}
=== Cut ===
font-testcase.cpp: In member function ‘void QHash<Key>::findNode(const
Key&) [with Key = khtml::Font::ScalKey]’:
font-testcase.cpp:29: instantiated from here
font-testcase.cpp:6: error: no matching function for call to ‘qHash(const
khtml::Font::ScalKey&)’
font-testcase.cpp:1: note: candidates are: int qHash(char)
font-testcase.cpp:2: note: int qHash(int)
--
Summary: [4.1/4.2 Regression] ambiguous overload errors
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mueller at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26311
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/26311] [4.1/4.2 Regression] ambiguous overload errors
2006-02-16 0:27 [Bug c++/26311] New: [4.1/4.2 Regression] ambiguous overload errors mueller at gcc dot gnu dot org
@ 2006-02-16 0:31 ` mueller at gcc dot gnu dot org
2006-02-16 0:33 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: mueller at gcc dot gnu dot org @ 2006-02-16 0:31 UTC (permalink / raw)
To: gcc-bugs
--
mueller at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |critical
Keywords| |rejects-valid
Known to fail| |4.1.0 4.2.0
Known to work| |4.0.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26311
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/26311] [4.1/4.2 Regression] ambiguous overload errors
2006-02-16 0:27 [Bug c++/26311] New: [4.1/4.2 Regression] ambiguous overload errors mueller at gcc dot gnu dot org
2006-02-16 0:31 ` [Bug c++/26311] " mueller at gcc dot gnu dot org
@ 2006-02-16 0:33 ` pinskia at gcc dot gnu dot org
2006-02-16 0:45 ` mueller at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-16 0:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2006-02-16 00:33 -------
The issue here (in the source) is that the overloaded of
" qHash(key);" is only the qHash functions above that call so it
does not see the template below that call which is the function you would like
to call.
This is how standard C++ works (with the correction from DR 197).
This is a dup of bug 2922 which was fixed by rejecting invalid code and fixing
wrong code for 4.1.
The way to fix the code is to add a forward to the template function.
*** This bug has been marked as a duplicate of 2922 ***
*** This bug has been marked as a duplicate of 2922 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |normal
Status|UNCONFIRMED |RESOLVED
Keywords|rejects-valid |
Known to fail|4.1.0 4.2.0 |
Known to work|4.0.2 |
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26311
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/26311] [4.1/4.2 Regression] ambiguous overload errors
2006-02-16 0:27 [Bug c++/26311] New: [4.1/4.2 Regression] ambiguous overload errors mueller at gcc dot gnu dot org
2006-02-16 0:31 ` [Bug c++/26311] " mueller at gcc dot gnu dot org
2006-02-16 0:33 ` pinskia at gcc dot gnu dot org
@ 2006-02-16 0:45 ` mueller at gcc dot gnu dot org
2006-02-16 0:49 ` pinskia at gcc dot gnu dot org
2006-02-16 0:57 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: mueller at gcc dot gnu dot org @ 2006-02-16 0:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from mueller at gcc dot gnu dot org 2006-02-16 00:45 -------
how do you explain that the testcase compiles just fine if you remove the
namespace?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26311
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/26311] [4.1/4.2 Regression] ambiguous overload errors
2006-02-16 0:27 [Bug c++/26311] New: [4.1/4.2 Regression] ambiguous overload errors mueller at gcc dot gnu dot org
` (2 preceding siblings ...)
2006-02-16 0:45 ` mueller at gcc dot gnu dot org
@ 2006-02-16 0:49 ` pinskia at gcc dot gnu dot org
2006-02-16 0:57 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-16 0:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2006-02-16 00:49 -------
(In reply to comment #2)
> how do you explain that the testcase compiles just fine if you remove the
> namespace?
Because Agrument Dependent Lookup (koenig lookup) happens even though there is
an overloaded set. This is also referenced in that PR.
If you move qHash of khtml::Font::ScalKey into the khtml, it will work also
because ADL is happening.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26311
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/26311] [4.1/4.2 Regression] ambiguous overload errors
2006-02-16 0:27 [Bug c++/26311] New: [4.1/4.2 Regression] ambiguous overload errors mueller at gcc dot gnu dot org
` (3 preceding siblings ...)
2006-02-16 0:49 ` pinskia at gcc dot gnu dot org
@ 2006-02-16 0:57 ` pinskia at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-16 0:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from pinskia at gcc dot gnu dot org 2006-02-16 00:57 -------
Please read the Defect report which takes about this case:
http://www.open-std.org/jtc1/sc22/wg21/prot/14882fdis/cwg_defects.html#197
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26311
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-02-16 0:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-16 0:27 [Bug c++/26311] New: [4.1/4.2 Regression] ambiguous overload errors mueller at gcc dot gnu dot org
2006-02-16 0:31 ` [Bug c++/26311] " mueller at gcc dot gnu dot org
2006-02-16 0:33 ` pinskia at gcc dot gnu dot org
2006-02-16 0:45 ` mueller at gcc dot gnu dot org
2006-02-16 0:49 ` pinskia at gcc dot gnu dot org
2006-02-16 0:57 ` 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).