Skip to content

False negative Wmissing-noreturn warning when a function always throws #146223

Open
@TiborGY

Description

@TiborGY

Unlike GCC, Clang's implementation of -Wmissing-noreturn does not fire when seeing a function that always throws:

void throwError(const std::string& msg){
	throw std::runtime_error(msg);
}

GCC 15.1 issues the following warning:
warning: function might be candidate for attribute 'noreturn' [-Wsuggest-attribute=noreturn]

https://godbolt.org/z/nWPjxb377

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions