Skip to content

"error: identifier 'line' after '~' in destructor name does not name a type" in struct line that has line member #88597

Open
@nabijaczleweli

Description

#include <string_view>

struct line {
	std::string_view line;
	~line() {
		line = {};
	}
};

trunk returns

<source>:5:3: error: identifier 'line' after '~' in destructor name does not name a type

cmd/join.cpp:49:5: error: identifier 'line' after '~' in destructor name does not name a type
   49 |                         ~line() {
      |                          ^~~~
      |                          line
cmd/join.cpp:32:21: note: non-type declaration found by destructor name lookup
   32 |                         std::string_view line;
      |                                          ^

older versions return

<source>:5:3: error: expected the class name after '~' to name a destructor

All GCC versions accept this.

Don't particularly see why the member would factor into the lookup at all here, but it's not like I can call this ~(struct line)() { or ~struct line() {.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions