public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107222] New: const qualifier appears in mangled NTTP value when the original object is so qualified
@ 2022-10-11 19:52 johelegp at gmail dot com
  2022-10-11 20:07 ` [Bug c++/107222] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: johelegp at gmail dot com @ 2022-10-11 19:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107222
           Summary: const qualifier appears in mangled NTTP value when the
                    original object is so qualified
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

See https://compiler-explorer.com/z/63f9sxnec.

```C++
struct A { int i; };
union Y { A a; };
constexpr Y make_y(const A a) { return {a}; }
template<auto> struct q { };
template<auto V> constexpr q<V> make_q() { return {}; }
template<auto> void print();
int main() {
  constexpr q x = make_q<make_y({1})>();
  print<x>();
  // +x;
}
```

```
main:
        sub     rsp, 8
        call    void print<q<Y{.a=A const{1}}>{}>()
        xor     eax, eax
        add     rsp, 8
        ret
```

Alternatively, when uncommenting `+x;`:
```
<source>: In function 'int main()':
<source>:10:3: error: no match for 'operator+' (operand type is 'const
q<Y{const A{1}}>')
   10 |   +x;
      |   ^~
```

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-11 20:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-11 19:52 [Bug c++/107222] New: const qualifier appears in mangled NTTP value when the original object is so qualified johelegp at gmail dot com
2022-10-11 20:07 ` [Bug c++/107222] " pinskia at gcc dot gnu.org

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