[Bug c++/59328] New: Template cast operator ambiguity in a delete expression

2013-11-28 Thread maxime.van.noppen at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59328

Bug ID: 59328
   Summary: Template cast operator ambiguity in a delete
expression
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: maxime.van.noppen at gmail dot com

The following code fails to compile with gcc whereas it works on Clang, Visual
Studio and ICC.

The version of gcc I tested: 4.4.7, 4.5.3, 4.6.4, 4.7.3, 4.8.1, 4.9.0 20130909

Code snippet:

template
struct Ptr
{
  template
  operator U*() const;

  operator const T*() const;
};

void foo()
{
  Ptr ptr;
  delete ptr;
}

Errors:

error: default type conversion can't deduce template argument for
‘template Ptr::operator U*() const [with U = U; T = int]’
error: type ‘struct Ptr’ argument given to ‘delete’, expected pointer

My understanding is that the compiler shouldn't consider the templated cast
operator and that there shouldn't be an ambiguity here. This is what the other
compilers mentioned above do.

This is somewhat similar to the bug 58119 and I can confirm that the bug was
fixed on 4.9.0 20130909 but this code still fails on that version.

[Bug c++/59328] Template cast operator ambiguity in a delete expression

2014-04-24 Thread maxime.van.noppen at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59328

--- Comment #1 from Maxime van Noppen  ---
Just to confirm this still happens on the the released gcc 4.9.0.