[LLVMbugs] [Bug 8529] New: Suboptimal diagnostic produced when ADL would find a constructor

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 2 04:29:46 PDT 2010


           Summary: Suboptimal diagnostic produced when ADL would find a
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

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() {

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'
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

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.

More information about the llvm-bugs mailing list