Skip to content

[clang] template specialization + member function template with default arg and alignof crash #68490

@rfenelus

Description

@rfenelus
template<typename TemplateParam>
struct Problem{
  template<typename FunctionTemplateParam>
  void Func(int param = alignof(FunctionTemplateParam));
};

template <>
template<typename FunctionTemplateParam>
void Problem<int>::Func(int param) {}

int main(){
    Problem<int> p = {};
    p.Func<char>();
}

This bit of code causes a crash where it correctly compiles in msvc and gcc. With my local clang install (windows, x64) it seems to at least compile successfully replacing alignof with sizeof but I can't reproduce this behavior on godbolt.
Godbolt

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partycrashPrefer [crash-on-valid] or [crash-on-invalid]

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions