Skip to content

template parameter std::enable_if_t not parsed #2305

@slnj

Description

@slnj

Hi,
I have some parsing issues using version 2.0.6.
It seems the problem occurs when I use std::enable_if_t macro helper in templates

There is not problem using std::enable_if like:

template < typename T , typename std::enable_if<std::is_base_of<BaseT, T>::value, int>::type = 0 >
class A
{
....
};

But parsing fails if using similar but simplified syntax using std::enable_if_t :

template < typename T ,  std::enable_if_t<std::is_base_of<BaseT, T>::value, int> = 0 > 
class A
{
....
};

Yo can see it usage at the "Notes" section at https://en.cppreference.com/w/cpp/types/enable_if

Both syntax have similar functionality, only that enable_if_t adds the "template" and ":type" on it definition (can see a type_traits header file), so both "template" and ":type" are not needed when used.
std::enable_if_t helper is specified since C++14 ( according to cppreference )

It's expected both alternatives to be recognized, but only the fist one is.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions