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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to