Skip to content

Incorrect type signature code #4

@berkus

Description

@berkus

Hi!

The code in

template < class R, class... Args >
struct TypeSignature< R (Args...) >
{
private:
template < class... T > void DoNothingWith( T&&... ) const {}
std::string Compute() const
{
static std::string result("(");
DoNothingWith( ( result += TypeSignature<Args>()() )... );
result += ")";
result += TypeSignature<R>()();
return result;
}
is incorrect.

It passes argument pack expansion as arguments to the function DoNothingWith(). Per standard compiler is free to arrange function arguments computation in any order - and gcc and clang disagree here. Clang computes arguments left to right, producing correct signature; android gcc 4.9 computes them right to left, producing completely invalid function signature.

You can verify it here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions