Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Syntactically ambiguous declarations can lead to unexpected program execution. However, it is likely that rudimentary testing would uncover violations of this rule.

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

DCL53-CPP

Low

Unlikely

Medium

P2

L3

Automated Detection

Tool

Version

Checker

Description

CodeSonar
Include Page
CodeSonar_V
CodeSonar_V

LANG.STRUCT.DECL.FNEST

Nested Function Declaration

Helix QAC

Include Page
Helix QAC_V
Helix QAC_V

C++1109, C++2510
Klocwork
Include Page
Klocwork_V
Klocwork_V
CERT.DCL.AMBIGUOUS_DECL
LDRA tool suite
Include Page
LDRA_V
LDRA_V

296 S

Partially implemented

PRQA QA-
Parasoft C/C++test

Include Page

PRQA QA-C++_VPRQA QA-C++_V

2510

 

Parasoft_V
Parasoft_V

CERT_CPP-DCL53-a
CERT_CPP-DCL53-b
CERT_CPP-DCL53-c

Parameter names in function declarations should not be enclosed in parentheses
Local variable names in variable declarations should not be enclosed in parentheses
Avoid function declarations that are syntactically ambiguous

Polyspace Bug Finder

Include Page
Polyspace Bug Finder_V
Polyspace Bug Finder_V

CERT C++: DCL53-CPP

Checks for declarations that can be confused between:

  • Function and object declaration
  • Unnamed object or function parameter declaration

Rule fully covered.

Clang
Include Page
Clang_V
Clang_V
-Wvexing-parse
 

SonarQube C/C++ Plugin
Include Page
SonarQube C/C++ Plugin_V
SonarQube C/C++ Plugin_V
S3468
 

Related Vulnerabilities

Search for other vulnerabilities resulting from the violation of this rule on the CERT website.

Bibliography

[ISO/IEC 14882-2014]Subclause 6.8, "Ambiguity Resolution"
Subclause 8.2, "Ambiguity Resolution"
[Meyers 2001]Item 6, "Be Alert for C++'s Most Vexing Parse"

...


...

Image Modified Image Modified Image Modified