llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.83k stars 11.46k forks source link

name lookup on conversion function doesn't include object scope #28181

Open llvmbot opened 8 years ago

llvmbot commented 8 years ago
Bugzilla Link 27807
Version 3.8
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @CaseyCarter,@DougGregor

Extended Description

Clang fails to compile this example (http://stackoverflow.com/q/37310866/2069064):

struct S {
    using T = int;
    operator T() { return 42; }
};

int main() {
    S{}.operator T();
}

with:

prog.cc:7:18: error: unknown type name 'T'; did you mean 'S::T'?
    S{}.operator T();
                 ^
                 S::T
prog.cc:2:11: note: 'S::T' declared here
    using T = int;
          ^

But according to [basic.lookup.classref]/7 (updated from CWG 1111), the scope of S should be considered. gcc compiles the example.

llvmbot commented 8 years ago

This bug may be breaking the build of ACE/TAO 6.3.3, which introduced usage similar to this bug between 6.3.3 and 6.3.1, and now no longer compiles under clang (but still compiles under gcc).