https://bugs.llvm.org/show_bug.cgi?id=41381

            Bug ID: 41381
           Summary: Cannot find base's conversion operator to templatized
                    type when operator is explicitly called.
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected],
                    [email protected]

Consider:

template <typename>
struct foo {};

struct base {
    operator int() { return 0; }
    template <typename T>
    operator foo<T>() { return foo<T>(); }
};

struct derived : base {};

int main() {
    derived d;
    (void) d.operator foo<int>();     // Error
    (void) static_cast<foo<int> >(d); // OK
    (void) d.operator int();          // OK
    base b;
    (void) b.operator foo<int>();     // OK
}

The error is:
error: no member named 'operator foo' in 'derived'

    (void) d.operator foo<int>();     // Error
           ~ ^
Remarks:
1) fails for all versions of clang available at godbolt.org
2) fails on clang 8.0 for all -std=c++{98,11,14,17}
3) works with other compilers.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to