Erroneous “Remove this empty namespace” in C++ files in Visual Studio for namespace containing only template

Version
SonarLint v4.29.0.25125

Steps
When validating the following code:

namespace foo {
	template<typename T>
	struct bar	{};
}

Expected behaviour:
SonarLint should not report that the namespace is empty

Observed behaviour
SonarLint reports cpp:S3261 Remove this empty namespace

Related issues


https://jira.sonarsource.com/browse/CPP-2614 (linked from the community issue above, I don’t have access to this jira issue)

Hello @gpetit,

I tried to reproduce your situation, but in my case the namespace was not detected as empty. Did you have anything before in your code that could interfere with this? Can you try to see if, in an empty project, you still reproduces this? (and if yes, can you send us this empty project?).

Thank you!