Skip to content

M0-1-3: Consider uses of global, namespace and member constexprs as variable arguments #384

Closed
@lcartey

Description

@lcartey

Affected rules

  • M0-1-3

Description

Similar to, but for global/namespace/member variables:
5ecee7e

Example

#include <cstdio>
template <int t>
class CharBuffer
{
  public:
  int member[t];
  CharBuffer():member{0}{}
};

constexpr int line_length = 1024U;

int foo()
{
  CharBuffer<line_length> buffer{};
  constexpr std::size_t max_stack_size_usage = 64 * 1024;
  static_assert(
      (sizeof(buffer) + sizeof(line_length)) <= max_stack_size_usage,
        "assert");
  return buffer.member[0];
}

Metadata

Metadata

Assignees

Labels

Difficulty-LowA false positive or false negative report which is expected to take <1 day effort to addressImpact-Mediumfalse positive/false negativeAn issue related to observed false positives or false negatives.user-reportIssue reported by an end user of CodeQL Coding Standards

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions