public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58449] New: templated cast operator and failed template deduction on copy-construction via assign operator
@ 2013-09-17 18:39 forestshade at hotmail dot de
2013-09-17 23:03 ` [Bug c++/58449] templated cast operator and failed template deduction on copy initialization redi at gcc dot gnu.org
2020-11-03 6:27 ` gcc-im5revto at tobiasrenger dot name
0 siblings, 2 replies; 3+ messages in thread
From: forestshade at hotmail dot de @ 2013-09-17 18:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58449
Bug ID: 58449
Summary: templated cast operator and failed template deduction
on copy-construction via assign operator
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: forestshade at hotmail dot de
The following code produces a compiler error:
-------------------------
#include <iostream>
using namespace std;
struct S {
};
class A {
public:
A(void* ptr) : ptr(ptr) {}
void* ptr;
template<typename T>
operator const T&() const {
return *static_cast<T*>(ptr);
}
};
int main() {
S test;
A a(&test);
S s = a;
return 0;
}
-------------------------
while this one doesn't:
-------------------------
#include <iostream>
using namespace std;
struct S {
};
class A {
public:
A(void* ptr) : ptr(ptr) {}
void* ptr;
operator const S&() const {
return *static_cast<S*>(ptr);
}
};
int main() {
S test;
A a(&test);
S s = a;
return 0;
}
-------------------------
I'm not exactly sure if the standard allows the line "S s = a;" in this case
but the code above should either both succeed or both fail.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/58449] templated cast operator and failed template deduction on copy initialization
2013-09-17 18:39 [Bug c++/58449] New: templated cast operator and failed template deduction on copy-construction via assign operator forestshade at hotmail dot de
@ 2013-09-17 23:03 ` redi at gcc dot gnu.org
2020-11-03 6:27 ` gcc-im5revto at tobiasrenger dot name
1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2013-09-17 23:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58449
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-09-17
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think there's another bug similar to this but I can't find it now.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/58449] templated cast operator and failed template deduction on copy initialization
2013-09-17 18:39 [Bug c++/58449] New: templated cast operator and failed template deduction on copy-construction via assign operator forestshade at hotmail dot de
2013-09-17 23:03 ` [Bug c++/58449] templated cast operator and failed template deduction on copy initialization redi at gcc dot gnu.org
@ 2020-11-03 6:27 ` gcc-im5revto at tobiasrenger dot name
1 sibling, 0 replies; 3+ messages in thread
From: gcc-im5revto at tobiasrenger dot name @ 2020-11-03 6:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58449
Tobias Renger <gcc-im5revto at tobiasrenger dot name> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gcc-im5revto at tobiasrenger dot n
| |ame
--- Comment #2 from Tobias Renger <gcc-im5revto at tobiasrenger dot name> ---
> I'm not exactly sure if the standard allows the line "S s = a;" in this case
I know this says nothing about standard conformance but both code examples
compile fine with clang 11.0.0 so this could actually be a bug in GCC.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-03 6:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-17 18:39 [Bug c++/58449] New: templated cast operator and failed template deduction on copy-construction via assign operator forestshade at hotmail dot de
2013-09-17 23:03 ` [Bug c++/58449] templated cast operator and failed template deduction on copy initialization redi at gcc dot gnu.org
2020-11-03 6:27 ` gcc-im5revto at tobiasrenger dot name
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).