[LLVMbugs] [Bug 19452] New: Invalid candidate function for unary operator on scoped enum

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Apr 16 14:12:22 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19452

            Bug ID: 19452
           Summary: Invalid candidate function for unary operator on
                    scoped enum
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zilla at kayari.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang accepts this, recent versions of G++ reject it:

struct D
{
  template <class T> D (T);
};
int operator~(const D &);

template <typename T> T &make ();

template <typename Rhs> struct H
{
  static const int value = sizeof ~make<Rhs>();
};

enum class E;

int main () { return H<E>::value; }


Both clang and G++ reject:

  static const int value = sizeof ~make<E>();

Whereas clang accepts (and G++ rejects) the same expression using a dependent
type:

template <typename Rhs> struct H
{
  static const int value = sizeof ~make<Rhs>();
};

Clang constructs a temporary of type D and applies operator~ to that temporary.

This was first reported to http://gcc.gnu.org/PR60852 but closed for the
reasons given at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60852#c13 i.e.
[over.match.oper]/3, so either we're wrong or clang is :)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140416/65ece70b/attachment.html>


More information about the llvm-bugs mailing list