Skip to content

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

@llvmbot

Description

@llvmbot
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++11clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partydiverges-from:gccDoes the clang frontend diverge from gcc on this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions