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

            Bug ID: 112632
           Summary: [14 Regression]  Non-type template parameter created
                    with converting constructor sometimes has original
                    type
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: needs-bisection, rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
    template<typename T>
    inline constexpr bool C = true;

    struct n {
        constexpr n(int a) : i(a) {}
        int i;
    };

    template<n N>
    using get_n_i_type = decltype(N.i);

    template<int X>
    int f() {
        using iii = get_n_i_type<X>;
    #if 1  // Change to 0 and this compiles
        static_assert(C<iii>);
    #endif
        return iii{};
    }

    template int f<3>();
```

This is rejected on the trunk with:
```
<source>: In instantiation of 'int f() [with int X = 3]':
<source>:22:23:   required from here
   22 |     template int f<3>();
      |                       ^
<source>:11:37: error: request for member 'i' in '3', which is of non-class
type 'int'
   11 |     using get_n_i_type = decltype(N.i);
      |                                   ~~^
```

But was accepted in GCC 13.  Note the difference between this and PR 112594 is
that C here is declared an `inline constexpr` rather than a concept.

Reply via email to