Skip to content

Templated class with deprecated attribute -> Invalid C++ declaration: Expected identifier in nested name #9451

@Pro

Description

@Pro

Describe the bug

I have a code where I use templated classes.
One of these I now marked as deprecated (see code below).

Sphinx fails with:

Exception occurred:
  File "/path/to/sphinx/3.4.3/lib/python3.6/site-packages/sphinx/util/cfamily.py", line 291, in fail
    raise self._make_multi_error(errors, '')
sphinx.util.cfamily.DefinitionError: Invalid C++ declaration: Expected identifier in nested name. [error at 1]
  ((deprecated("Do not use this")))
  -^

How to Reproduce

Use the following code:

template <typename TReq>
class BaseClass<TReq>
{

}

template <typename TReq>
class [[deprecated("Do not use this!")]] SomeOldClass<TReq> : public BaseClass<Treq>
{

}

Expected behavior

No response

Your project

See how to reproduce

Screenshots

No response

OS

Linux

Python version

3.6.9

Sphinx version

3.4.3

Sphinx extensions

No response

Extra tools

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions