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

           Summary: Suboptimal diagnostic produced when ADL would find a
                    constructor
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


Older versions of g++ erroneously allow argument-dependent lookup to find
constructors. If code which relies on this is run through clang, the error
message does not make it obvious why the code is rejected. For instance:

namespace N {
  enum E { e };
  struct C {
    C(E = e) {}
  };
}

int main() {
  (void)C(N::e);
}

Modern version of g++ (4.2 and later) produce this error:

adl.cpp: In function ‘int main()’:
adl.cpp:3: error: argument dependent lookup finds ‘struct N::C’
adl.cpp:9: error:   in call to ‘C’

clang produces this error:

adl.cpp:9:9: error: use of undeclared identifier 'C'
  (void)C(N::e);
        ^
1 error generated.

It'd be nice if clang could go the extra mile and say something like:

adl.cpp:9:9: error: constructors cannot be called via argument-dependent lookup
  (void)C(N::e);
        ^
        N::

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- 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