Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • graph-tool graph-tool
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 46
    • Issues 46
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Tiago Peixoto
  • graph-toolgraph-tool
  • Merge requests
  • !27

Merged
Created Jun 06, 2020 by Jeff Trull@jaafarContributor

Remove const qualifier from object that can be modified

  • Overview 4
  • Commits 2
  • Pipelines 2
  • Changes 1

Modifying an object declared const is technically undefined behavior, and compilers are entitled to do as they like with such code. The most likely result - in the event of some future optimizer - would be elimination of the code performing the modification, although it could theoretically be anything.

Given that ConstantPropertyMap defines an assignment operator already, simply changing the underlying data member to non-const (while making it private) seems to achieve the same result as the current code, while avoiding UB.

Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: UB-constness