Skip to content

explicit conversion functions are incompatible with C++98 not warning in C++20 #161689

@shafik

Description

@shafik

Given:

struct HasExplicitConversion {
  explicit operator bool(); 
};

Using -Wc++98-compat in C+11/14/17 we obtain the following diagnostic:

warning: explicit conversion functions are incompatible with C++98 [-Wc++98-compat]
    2 |   explicit operator bool(); 
      |   ^~~~~~~~

but not in C++20. This change came in w/ 76b9027

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