Summary: | Different overloaded function being called depending on which compiler is used | ||
---|---|---|---|
Product: | gcc | Reporter: | Dominique Pelle <dominique.pelle> |
Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | normal | CC: | webrown.cpp |
Priority: | P3 | Keywords: | wrong-code |
Version: | unknown | ||
Target Milestone: | --- | ||
See Also: |
https://bugs.llvm.org/show_bug.cgi?id=40193 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77712 |
||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: |
Description
Dominique Pelle
2019-01-02 09:46:10 UTC
Using C++98 (on a LP64 target) and: typedef unsigned long uint64_t; typedef long int64_t; struct Foo { Foo(int64_t) { } }; void foo(const char*) { std::puts("In foo(const char*)"); } void foo(const Foo&) { std::puts("In foo(const Foo&)"); } int main() { foo((int)0); foo((unsigned)0); foo((short)0); foo((unsigned short)0); foo((int64_t)0); foo((uint64_t)0); foo(0); foo(NULL); } --- CUT --- In foo(const char*) In foo(const char*) In foo(const char*) In foo(const char*) In foo(const char*) In foo(const char*) In foo(const char*) In foo(const char*) As you can see that is the "old" behavior. With -std=c++11, I get: In foo(const Foo&) In foo(const char*) In foo(const char*) In foo(const char*) In foo(const char*) In foo(const char*) In foo(const char*) In foo(const char*) |