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

            Bug ID: 44005
           Summary: lambda expression in template argument fails
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

The below example is accepted with g++ -std=c++2a:
---
template <auto O>
struct B {
    static constexpr int off = O();
};

struct A {
    char a;
    B<[](){ return 0; }> b;
};
---

But with clang there is an error:
---
$ clang++ -std=c++2a -o offs1 offs1.cpp 
offs1.cpp:11:7: error: a lambda expression cannot appear in this context
    B<[](){ return 0; }> b;
      ^
offs1.cpp:11:7: error: a non-type template parameter cannot have type
'A::(lambda at offs1.cpp:11:7)'
offs1.cpp:4:16: note: template parameter is declared here
template <auto O>
               ^
2 errors generated.
---

-- 
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