Skip to content

Clang does not diagnose an explicit specialization or partial specialization of initializer_list #126270

@miyuki

Description

@miyuki

According to the C++ standard (C++23 [initializer.list.syn] paragraph 2):

If an explicit specialization or partial specialization of initializer_list is declared, the program is ill-formed.

It does not say "no diagnostic is required"; therefore, I think Clang must produce an error, but it does not. Example code:

#include <initializer_list>

template<>
class std::initializer_list<int> {};

template<typename T>
class std::initializer_list<T*> {};

Clang (current trunk version) accepts the code with -std=c++23 -pedantic-errors.

Metadata

Metadata

Assignees

Labels

accepts-invalidlibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions