Skip to content

#embed interacts poorly with template argument deduction and initializer lists #122306

Closed
@cor3ntin

Description

@cor3ntin

Clang incorrectly rejects the following because it fails to deduce the correct size for the array/initializer list

static constexpr auto std_to_char_array = std::to_array<char>({
         #embed __FILE__
         , '\0'
    });
  static constexpr auto initializer_list = std::initializer_list<char>{
      #embed __FILE__
       , '\0'
  };

https://godbolt.org/z/4oj8Tr4d5

(From reddit)

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyembed#embed (not embedded systems)rejects-valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions