public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mateusz.pusz at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/97014] New: Class NTTPs not demangled in the compilation error
Date: Thu, 10 Sep 2020 22:18:14 +0000	[thread overview]
Message-ID: <bug-97014-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97014

            Bug ID: 97014
           Summary: Class NTTPs not demangled in the compilation error
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mateusz.pusz at gmail dot com
  Target Milestone: ---

The following code:

```
struct ratio {
  int num;
  int den;
};

template<ratio R>
struct X {
  static constexpr auto ratio = R;
};

template<ratio R>
concept positive = R.num > 0 && R.den > 0;

template<typename T>
concept ratio_positive = positive<T::ratio>;

void foo(ratio_positive auto x) {}

void boo()
{
  foo(X<ratio(-1, 2)>());
}
```

produces the following error with `::_ZTAXtl5ratioLin1ELi2EEE` not demangled to
`ratio{-1, 2}` in many places:

```
<source>: In function 'void boo()':
<source>:21:24: error: no matching function for call to 'foo(X<ratio{-1, 2}>)'
   21 |   foo(X<ratio(-1, 2)>());
      |                        ^
<source>:17:6: note: candidate: 'template<class auto:1>  requires 
ratio_positive<auto:1> void foo(auto:1)'
   17 | void foo(ratio_positive auto x) {}
      |      ^~~
<source>:17:6: note:   template argument deduction/substitution failed:
<source>:17:6: note: constraints not satisfied
<source>: In substitution of 'template<class auto:1>  requires 
ratio_positive<auto:1> void foo(auto:1) [with auto:1 = X<ratio{-1, 2}>]':
<source>:21:24:   required from here
<source>:12:9:   required for the satisfaction of 'positive<T::ratio>' [with T
= X<::_ZTAXtl5ratioLin1ELi2EEE>]
<source>:15:9:   required for the satisfaction of 'ratio_positive<auto:1>'
[with auto:1 = X<::_ZTAXtl5ratioLin1ELi2EEE>]
<source>:12:26: note: the expression '((const ratio)R).num > 0 [with R =
X<::_ZTAXtl5ratioLin1ELi2EEE>::ratio]' evaluated to 'false'
   12 | concept positive = R.num > 0 && R.den > 0;
      |                    ~~~~~~^~~
Compiler returned: 1
```

             reply	other threads:[~2020-09-10 22:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 22:18 mateusz.pusz at gmail dot com [this message]
2020-10-01 17:14 ` [Bug c++/97014] " mpolacek at gcc dot gnu.org
2020-10-01 20:32 ` mpolacek at gcc dot gnu.org
2020-10-02 22:52 ` mpolacek at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-97014-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).