Skip to content

Conversation

michaelknoch
Copy link

Description

This PR fixes invalid use of 'template' keyword when calling do_pop_any in atomic_queue.h

While do_pop_any is a function template, Clang 17 fails to compile the following call:

Base::template do_pop_any(states_[index], elements_[index]);

with error error: a template argument list is expected after a name prefixed by the 'template' keyword

This is because the template keyword is only allowed when explicitly specifying template arguments (e.g., Base::template do_pop_any(...)). In this case, template argument deduction is used, so the template keyword must not be present. This change adheres to the C++ language rules regarding dependent names and member function templates. Other calls that explicitly specify template arguments (like do_pop_atomic<T, NIL>) continue to use the template keyword correctly.

Potentially fixes #1305

Screenshot

Screenshot 2025-04-10 at 23 39 25

Copy link

@ephemer ephemer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@geraintluff
Copy link

Verified that this is a problem for Clang 17, and that this change fixes it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build fails with clang-19: a template argument list is expected after a name prefixed by the template keyword

3 participants