Skip to content

code compile failed: src/library/generator.transpose.cpp:1092:95: error: taking address of rvalue [-fpermissive] #256

@youngcodemasters

Description

@youngcodemasters

I meet following error:

clFFT-2.12.2/src/library/generator.transpose.cpp:1092:95: error: taking address of rvalue [-fpermissive]
 1092 |         std::string smaller_dim_str = static_cast<std::ostringstream*>(&(std::ostringstream() << smaller_dim))->str();
      |                                                                         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
clFFT-2.12.2/src/library/generator.transpose.cpp:1093:93: error: taking address of rvalue [-fpermissive]
 1093 |         std::string dim_ratio_str = static_cast<std::ostringstream*>(&(std::ostringstream() << dim_ratio))->str();
      |                                                                       ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
ninja: build stopped: subcommand failed.

the code is:

std::string smaller_dim_str = static_cast<std::ostringstream*>(&(std::ostringstream() << smaller_dim))->str();
std::string dim_ratio_str = static_cast<std::ostringstream*>(&(std::ostringstream() << dim_ratio))->str();

smaller_dim and dim_ratio are size_t type, these code want to convert size_t type to std::string, can replace following code to address error:

std::string smaller_dim_str = std::to_string(smaller_dim);
std::string dim_ratio_str = std::to_string(dim_ratio);

thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions