Skip to content

[clang] Diagnose invalid specializations of type traits #101509

@ldionne

Description

@ldionne

The following code is ill-formed, but we don't diagnose it:

#include <type_traits>

template <>
struct std::common_type<int, int> { using type = long; }; // should warn

struct Foo { };
template <>
struct std::common_type<Foo> { using type = int; }; // should warn

template <>
struct is_integral<Foo> { }; // should warn

// etc...

It would be nice if Clang caught invalid specializations of std::common_type, and in fact perhaps of the other type trait classes as well.

Extracted from #99473 (comment).

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzer

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions