c++/9809: [3.3/3.4 regression] when are builtins brought into view
bangerth@dealii.org
bangerth@dealii.org
Wed Mar 5 23:03:00 GMT 2003
Old Synopsis: 3.4 regression(?) - spurious ambiguity of overloaded function
New Synopsis: [3.3/3.4 regression] when are builtins brought into view
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Wed Mar 5 22:23:18 2003
State-Changed-Why:
This is actually a serious regression:
---------------------
namespace std {
class Base {};
}
struct Derived : public std::Base {
operator const char*() const;
operator bool(void) const;
};
void log(const char* str);
void nothing()
{
Derived temp;
log(temp);
}
----------------------
This doesn't compile with 3.3 and 3.4:
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c y.cc
y.cc: In function `void nothing()':
y.cc:15: error: call of overloaded `log(Derived&)' is ambiguous
y.cc:10: error: candidates are: void log(const char*)
<internal>:15: error: double std::log(double)
There's only one log() function in the file, so there
shouldn't be a problem.
Now, it _does_ compile if we rename the namespace away from
std, or name the function something else than log(), so
it looks like if the math functions are brought into
global namespace if namespace std is involved. That's wrong
here.
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9809
More information about the Gcc-bugs
mailing list