Skip to content

Compile error in generator.transpose.cpp: taking address of rvalue #237

Open
@electroniceel

Description

@electroniceel

Since gcc 11 the compiler detects this problem and aborts the compilation:

src/library/generator.transpose.cpp: In function 'clfftStatus clfft_transpose_generator::genSwapKernelGeneral(const Signature&, std::string&, std::string&, const size_t&, size_t)':
src/library/generator.transpose.cpp:1092:95: error: taking address of rvalue [-fpermissive]
1092 | std::string smaller_dim_str = static_caststd::ostringstream*(&(std::ostringstream() << smaller_dim))->str();
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
src/library/generator.transpose.cpp:1093:93: error: taking address of rvalue [-fpermissive]
1093 | std::string dim_ratio_str = static_caststd::ostringstream*(&(std::ostringstream() << dim_ratio))->str();
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~

It seems to me that the compiler is right in this case and the code indeed tries to get an address of a temporary object, which is not allowed in C++.

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