Skip to content

Support for expressions with template arguments. #5

@CalebAdrianXYZ

Description

@CalebAdrianXYZ

Currently, the following code fails to compile:

template<int X, int Y> bool foo() { return X == Y; }

int main()
{
    foo<3,4>();
    ASSERT(foo<3,4>());
}

This code can be seen in action on compiler explorer.

This is due to foo<3,4>() being seen as two arguments when passed to a macro, specifically foo<3 and 4>(). This can be worked around with an extra set of parenthesis. Working around this in the library would be difficult, but should be possible. Decomposition would need to overload operator, to handle the error message string, and additional diagnostic variables. The top level macros would then consume a single variadic argument pack.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions