[Bug c++/88595] Template type lacking template-id-expr

ensadc at mailnesia dot com gcc-bugzilla@gcc.gnu.org
Wed Dec 26 06:47:00 GMT 2018


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

ensadc at mailnesia dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ensadc at mailnesia dot com

--- Comment #1 from ensadc at mailnesia dot com ---
As far as I know, CTAD (class template argument deduction) is like `auto`; both
are not allowed in non-static member declarations. So gcc is correct in both
places.

```
template<typename T = void> struct Any
{
  constexpr Any (int x) {}
};

struct Container
{
  auto c = 1; // error
  Any car; // also error
};

auto c = 1; // OK
Any x (2); // also OK
```

The error message can probably be improved though.


More information about the Gcc-bugs mailing list