public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114903] New: constraint of CTAD alias deduction guide is evaluated on a wrong type
@ 2024-05-01  8:06 hokein.wu at gmail dot com
  2024-05-13 13:53 ` [Bug c++/114903] " cvs-commit at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hokein.wu at gmail dot com @ 2024-05-01  8:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114903
           Summary: constraint of CTAD alias deduction guide is evaluated
                    on a wrong type
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hokein.wu at gmail dot com
  Target Milestone: ---

See the following example of nested templates:  

```
#include <type_traits>
template <typename T>
struct Key {
  Key(int);
};

class Forward {};

template <typename T>
constexpr bool C =
    std::is_same<T, Forward>(); // changing `Forward` to `double` will make the
following static_assert passed.

template <typename Z>
struct Outer {
  template <typename U>
  struct Foo {
    Foo(U);
    U u;
  };

  template <typename V>
    requires(C<Z>)
  Foo(V) -> Foo<int>;
};

template <typename Y>
struct T {
  template <typename Y2>
  struct T2 {
    template <typename K>
    using AFoo = Outer<Y2>::template Foo<K>;
  };
};

T<Forward>::T2<Forward>::AFoo a{1.0};  // the explict deduction guide should be
choosen, Foo<int>
static_assert(std::is_same<decltype(a), Outer<Forward>::Foo<int>>()); // expect
to be true!
```

The constraint `C` in the alias deduction guide should be true, as it is
evaluated on type `Forward`, but gcc seems to evaluate it on `double`.

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

end of thread, other threads:[~2024-05-13 15:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-01  8:06 [Bug c++/114903] New: constraint of CTAD alias deduction guide is evaluated on a wrong type hokein.wu at gmail dot com
2024-05-13 13:53 ` [Bug c++/114903] " cvs-commit at gcc dot gnu.org
2024-05-13 15:39 ` cvs-commit at gcc dot gnu.org
2024-05-13 15:41 ` ppalka 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).