Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed const modifier from LPInfo object on stack that was causing a… #4696

Merged
merged 3 commits into from
Feb 14, 2024

Conversation

clarkse
Copy link
Member

@clarkse clarkse commented Feb 13, 2024

… warning from not being initialized properly.

… warning from not being initialized properly.
@clarkse clarkse requested a review from lucafedeli88 February 13, 2024 22:38
@clarkse clarkse added component: magnetostatic magneticstatic solver warning A compiler or tool warning labels Feb 13, 2024
@clarkse clarkse requested a review from ax3l February 13, 2024 22:41
Copy link
Member

@lucafedeli88 lucafedeli88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @clarkse ,
thank you for your contribution.
Could you please provide some more details on the configuration in which you saw a warning about this variable? In principle, the amrex::MLEBNodeFDLaplacian constructor takes info as a constant reference, so it should be OK to have const amrex::LPInfo info; here.

@clarkse
Copy link
Member Author

clarkse commented Feb 14, 2024

This is the error I am getting building with GCC 9.4.0:

/home/st247c@HE.local/src/WarpX/Source/ablastr/fields/VectorPoissonSolver.H(133): warning #811-D: const variable "info" requires an initializer -- class "amrex::LPInfo" has no user-provided default constructor
const amrex::LPInfo info;

I checked in PoissonSolver.H and it appears that the const is not in front of the amrex::LPInfo instantiation in that case. I traced the addition of the const modifier to:
#3921

In this PR it was added to VectorPoissonSolver, but not PoissonSolver. I was just getting annoyed at seeing the compile time warning, so if we want to use the const then the default constructor for amrex::LPInfo should have a default constructor.

…ere in AMReX and avoiding compile time warning.
@clarkse
Copy link
Member Author

clarkse commented Feb 14, 2024

@lucafedeli88 does this work for you? It appears consistent with usage in AMReX.

Copy link
Member

@lucafedeli88 lucafedeli88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me. Thanks!

@lucafedeli88 lucafedeli88 enabled auto-merge (squash) February 14, 2024 18:07
@lucafedeli88 lucafedeli88 merged commit 9f52a45 into BLAST-WarpX:development Feb 14, 2024
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: magnetostatic magneticstatic solver warning A compiler or tool warning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants