[llvm-bugs] [Bug 44673] New: Rejects valid code with constructor accepting constrained auto parameter when the concept name is namespace qualified and has an explicit template argument

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jan 26 13:10:15 PST 2020


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

            Bug ID: 44673
           Summary: Rejects valid code with constructor accepting
                    constrained auto parameter when the concept name is
                    namespace qualified and has an explicit template
                    argument
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david at doublewise.net
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

The following well-formed code

```
namespace n {

template<typename, typename>
concept c = true;

}

struct s {
    s(n::c<int> auto);
};

auto x = s(0);
```

is rejected by clang with the message


```
<source>:9:17: error: expected ')'

    s(n::c<int> auto);

                ^

<source>:9:6: note: to match this '('

    s(n::c<int> auto);

     ^

<source>:9:10: error: non-friend class member 'c' cannot have a qualified name

    s(n::c<int> auto);

      ~~~^

<source>:9:10: error: field has incomplete type 's'

<source>:8:8: note: definition of 's' is not complete until the closing '}'

struct s {

       ^

<source>:12:10: error: no matching conversion for functional-style cast from
'int' to 's'

auto x = s(0);

         ^~~

<source>:8:8: note: candidate constructor (the implicit copy constructor) not
viable: no known conversion from 'int' to 'const s' for 1st argument

struct s {

       ^

<source>:8:8: note: candidate constructor (the implicit move constructor) not
viable: no known conversion from 'int' to 's' for 1st argument

struct s {

       ^

<source>:8:8: note: candidate constructor (the implicit default constructor)
not viable: requires 0 arguments, but 1 was provided

4 errors generated.

Compiler returned: 1
```

-- 
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/20200126/7ea9d519/attachment.html>


More information about the llvm-bugs mailing list