Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • Nektar Nektar
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 88
    • Issues 88
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 74
    • Merge requests 74
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Nektar
  • NektarNektar
  • Merge requests
  • !1391

Fix lack of explicit operator= for warnings in clang 13+

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Dave Moxey requested to merge dmoxey/nektar:fix/clang-implicit-assignment into master Sep 07, 2022
  • Overview 6
  • Commits 12
  • Pipelines 11
  • Changes 11

Issue/feature addressed

This branch fixes #301 (closed) to add an explicit operator= to classes inside SimdLib to disable compiler warning.

Proposed solution

Presently SimdLib has the following default copy constructor, e.g. for scalar types:

    inline scalarT(const scalarT &rhs) = default;

This causes a warning (compiler error with -Werror):

/nektar++/library/LibUtilities/SimdLib/scalar.hpp:124:12: error: definition of implicit copy assignment 
operator for 'scalarT<unsigned long long, void>' is deprecated because it has a user-declared 
copy constructor [-Werror,-Wdeprecated-copy]

The solution is to add appropriate operator= functions, e.g.:

    inline scalarT<T> &operator=(const scalarT<T> &rhs) = default;

A new CI job has been added to compile with clang and capture warnings for future code.

Implementation

The solution above seems adequate. An alternative is to remove the original copy constructor = default. It seems that the presence of this triggers this warning, even though with or without the line you'll get a copy constructor for this class. However adding operator= is more explicit and probably the right approach.

Tests

Checklist

  • Functions and classes, or changes to them, are documented.
  • Changelog is updated.
  • Suitable tests added for new functionality.
  • Contributed code is correctly formatted. (See the contributing guidelines).
  • License added to any new files.
  • No extraneous files have been added (e.g. compiler output or test data files).

Warning

On the 19.07 the code formatting (code style) was standardised using clang-format, over the whole Nektar++ code. This means changes in your branch will conflict with formatting changes on the master branch. To resolve these conflicts , see #295

Edited Sep 09, 2022 by Dave Moxey
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: fix/clang-implicit-assignment