public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58119] New: Invalid ambiguous default type conversion with only a single invalid conversion listed.
@ 2013-08-10 12:42 tilps at hotmail dot com
2013-08-10 17:39 ` [Bug c++/58119] [4.7/4.8/4.9 Regression] " paolo.carlini at oracle dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: tilps at hotmail dot com @ 2013-08-10 12:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58119
Bug ID: 58119
Summary: Invalid ambiguous default type conversion with only a
single invalid conversion listed.
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tilps at hotmail dot com
'Minimal' test case:
template <class type>
class Silly {
public:
Silly(type *value) {
data_ = value;
}
operator type*() const {
return data_;
}
template <class other>
operator Silly<other>() const {
return Silly<other>(data_);
}
private:
type *data_;
};
int main() {
Silly<int> a(nullptr);
delete a;
}
Fails giving:
test.cc:20:10: error: ambiguous default type conversion from 'Silly<int>'
delete a;
^
test.cc:20:10: error: candidate conversions include 'template<class other>
Silly<type>::operator Silly<other>() const [with other = other; type = int]'
test.cc:20:10: error: type 'class Silly<int>' argument given to 'delete',
expected pointer
I believe that this code should be considered valid, the only valid type
conversion is via the operator type *() which then converts to void* for the
delete operator. I don't see any way that Silly<anything> could be considered
convertible, except via operator type *() - and as far as I was aware, only a
single implicit cast operator is allowed to be considered in a type conversion
chain.
Interestingly, the valid type conversion is not mentioned as a candidate, and
the candidate mentioned does not specify which template parameter type it would
use for the 'other' template parameter.
Ultimately this is a bit of a strange example - I was trying to resurrect some
legacy code with a particularly dumb (but heavily used) 'smart pointer' type.
But this code did work, at least as recently as 4.6 - and probably back before
3.2.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/58119] [4.7/4.8/4.9 Regression] Invalid ambiguous default type conversion with only a single invalid conversion listed.
2013-08-10 12:42 [Bug c++/58119] New: Invalid ambiguous default type conversion with only a single invalid conversion listed tilps at hotmail dot com
@ 2013-08-10 17:39 ` paolo.carlini at oracle dot com
2013-08-16 13:49 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-10 17:39 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58119
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-08-10
CC| |jason at gcc dot gnu.org
Summary|Invalid ambiguous default |[4.7/4.8/4.9 Regression]
|type conversion with only a |Invalid ambiguous default
|single invalid conversion |type conversion with only a
|listed. |single invalid conversion
| |listed.
Ever confirmed|0 |1
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I'm marking this as Regression because 4.6.x accepted it (likewise current
clang and icc)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/58119] [4.7/4.8/4.9 Regression] Invalid ambiguous default type conversion with only a single invalid conversion listed.
2013-08-10 12:42 [Bug c++/58119] New: Invalid ambiguous default type conversion with only a single invalid conversion listed tilps at hotmail dot com
2013-08-10 17:39 ` [Bug c++/58119] [4.7/4.8/4.9 Regression] " paolo.carlini at oracle dot com
@ 2013-08-16 13:49 ` jakub at gcc dot gnu.org
2013-08-18 5:20 ` jason at gcc dot gnu.org
2013-08-20 13:00 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-08-16 13:49 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58119
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
Target Milestone|--- |4.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/58119] [4.7/4.8/4.9 Regression] Invalid ambiguous default type conversion with only a single invalid conversion listed.
2013-08-10 12:42 [Bug c++/58119] New: Invalid ambiguous default type conversion with only a single invalid conversion listed tilps at hotmail dot com
2013-08-10 17:39 ` [Bug c++/58119] [4.7/4.8/4.9 Regression] " paolo.carlini at oracle dot com
2013-08-16 13:49 ` jakub at gcc dot gnu.org
@ 2013-08-18 5:20 ` jason at gcc dot gnu.org
2013-08-20 13:00 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2013-08-18 5:20 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58119
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/58119] [4.7/4.8/4.9 Regression] Invalid ambiguous default type conversion with only a single invalid conversion listed.
2013-08-10 12:42 [Bug c++/58119] New: Invalid ambiguous default type conversion with only a single invalid conversion listed tilps at hotmail dot com
` (2 preceding siblings ...)
2013-08-18 5:20 ` jason at gcc dot gnu.org
@ 2013-08-20 13:00 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2013-08-20 13:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58119
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for trunk, 4.7, 4.8 in r201880, r201881, r201882.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-08-20 13:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-10 12:42 [Bug c++/58119] New: Invalid ambiguous default type conversion with only a single invalid conversion listed tilps at hotmail dot com
2013-08-10 17:39 ` [Bug c++/58119] [4.7/4.8/4.9 Regression] " paolo.carlini at oracle dot com
2013-08-16 13:49 ` jakub at gcc dot gnu.org
2013-08-18 5:20 ` jason at gcc dot gnu.org
2013-08-20 13:00 ` jason at gcc dot gnu.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).