[llvm-bugs] [Bug 52434] New: A conversion function template shall not have a deduced return type

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Nov 6 13:31:29 PDT 2021


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

            Bug ID: 52434
           Summary: A conversion function template shall not have a
                    deduced return type
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: fchelnokov at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

This code is invalid:
```
struct S {
    template<class=void>
    operator auto() const { return 2; }
};

int main() {
    S s;
    [[maybe_unused]] int d = s;
}
```
because the standard explicitly prohibits conversion function template having a
deduced return type:
https://timsong-cpp.github.io/cppwp/n4861/class.conv.fct#6

But now Clang accepts the program:
https://gcc.godbolt.org/z/rMK4zboEd
which is a bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211106/512be26e/attachment.html>


More information about the llvm-bugs mailing list