Skip to content

Parsing error when using template type parameter with assignment #2317

@slnj

Description

@slnj

Hello!

When using a template parameter with regular type parameters with default value assignment, a parsing error is reported.
This cases are valid and generate parsing errors:

template < typename T,  size_t s = 15 >
void f(){}
template < values v = v::ok >   // where values is an enum
void f(){}
template<class T, T::type n = 0>  //Where T::type is an integral type
class X;

The type could be:
integral type
enumerator
lvalue reference
nullptr
pointer

An a default value could be assigned

Also, the default value could be an expression like: (sizeof(T)*2)

Regards

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions