[llvm-bugs] [Bug 48384] New: [Concepts] void f(Constrained decltype(auto)) should be rejected

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 3 22:15:10 PST 2020


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

            Bug ID: 48384
           Summary: [Concepts] void f(Constrained decltype(auto)) should
                    be rejected
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arthur.j.odwyer 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

// https://godbolt.org/z/deh8oT
template<class> concept C = true;
void f(C decltype(auto));

Should be ill-formed, according to http://eel.is/c++draft/dcl.fct#18.sentence-6
, but Clang accepts it.

Clang does know that
    void f(decltype(auto));
is ill-formed, but Clang doesn't know that
    void f(C decltype(auto));
should also be ill-formed.

----
Incidentally, I'm confused about
    template<decltype(auto)> void g();
    template<C decltype(auto)> void h();
Clang, GCC, and MSVC all agree that both of those are well-formed, but I don't
know the rationale for accepting _template_ parameters of decltype(auto) type,
given that _function_ parameters of decltype(auto) type are forbidden.
GCC also accepts decltype(auto)& here:
    template<decltype(auto)&> void i();

-- 
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/20201204/c260099c/attachment.html>


More information about the llvm-bugs mailing list