Fix: Intel classic (icpc) build error "EKinetic is not a template" - #7929
Merged
mohanchen merged 2 commits intoSep 8, 2026
Merged
Conversation
ekinetic.h (hamilt::EKinetic) and op_pw_ekin.h (hamilt::Ekinetic) share the __EKINETICTEMPLATE guard around their primary template declarations, but the two class templates have different names. A TU that includes op_pw_ekin.h before ekinetic.h would skip the EKinetic primary template and fail on the EKinetic<OperatorLCAO<TK,TR>> specialization with 'EKinetic is not a template' on any compiler. Declare each primary template unconditionally inside its own header guard.
icpc (Intel Classic 2021.6/2022.1) rejects the out-of-line destructor definition hamilt::EKinetic<hamilt::OperatorLCAO<TK, TR>>::~EKinetic<hamilt::OperatorLCAO<TK, TR>>() with 'EKinetic is not a template', while GCC and icpx accept it. Naming the destructor with the plain form ~EKinetic() is accepted by all three compilers. This is the actual cause of the ekinetic.cpp build failure with icpc reported for v3.11.0-beta9.
There was a problem hiding this comment.
🟢 Approval recommended
The changes are narrowly scoped to a verified compile-compatibility fix and remove a latent include-order hazard without altering runtime behavior.
Pull request overview
This pull request fixes a compiler-compatibility regression affecting Intel classic (icpc/EDG) by correcting the out-of-line destructor spelling for a partial specialization of hamilt::EKinetic, and removes a shared internal macro guard that could break translation units including both LCAO and PW kinetic-operator headers.
Changes:
- Fix icpc build failure by changing the out-of-line destructor definition of
EKinetic<OperatorLCAO<TK,TR>>to use the injected-class-name form::~EKinetic(). - Remove the shared
__EKINETICTEMPLATEinner guard blocks from bothekinetic.handop_pw_ekin.hto prevent order-dependent missing template declarations (and drop a reserved double-underscore identifier). - Keep changes limited to compile-time behavior (no runtime logic changes).
File summaries
| File | Description |
|---|---|
| source/source_pw/module_pwdft/op_pw_ekin.h | Removes shared inner macro guard around the primary Ekinetic template to avoid include-order hazards. |
| source/source_lcao/module_operator_lcao/ekinetic.h | Removes shared inner macro guard around the primary EKinetic template (outer include guard remains). |
| source/source_lcao/module_operator_lcao/ekinetic.cpp | Fixes the partial-specialization destructor out-of-line definition to be EDG/icpc-compatible. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
8 tasks
mohanchen
approved these changes
Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reminder
AGENTS.mdanddocs/developers_guide/agent_governance.md.source/changes.Linked Issue
Fix #7927
Unit Tests and/or Case Tests for my changes
icpc2022.1 (Intel classic, Rocky Linux 8.8, LCAO+LIBRI+PEXSI+MLALGO enabled): direct compilation ofsource/source_lcao/module_operator_lcao/ekinetic.cpp— previously failing witherror: EKinetic is not a template, now compiles.g++ -std=gnu++14 -fsyntax-only source/source_lcao/module_operator_lcao/ekinetic.cppwith the standard ABACUS define set (__EXX,__LCAO,__MPI, ...), GCC 11.4.0.g++ -std=gnu++14 -fsyntax-only source/source_pw/module_pwdft/op_pw_ekin.cpp(same flags).op_pw_ekin.h+ekinetic.h, both include orders) withg++ -std=gnu++11 -fsyntax-only: previously failing on GCC with'EKinetic'/'Ekinetic' is not a class template; now clean in both orders.What's changed?
source_lcao/module_operator_lcao/ekinetic.cpp: the out-of-line destructor of the partial specializationEKinetic<OperatorLCAO<TK,TR>>is named plainly again (~EKinetic()), reverting the template-argument form~EKinetic<hamilt::OperatorLCAO<TK, TR>>()introduced by bbd23ca (DFT+U refactor, step 6 #7879), which icpc's EDG frontend cannot resolve ("EKinetic is not a template"; the injected-class-name of the partial specialization is found as a type and cannot take a template argument list in this context). GCC/Clang(icpx) accept both forms, so GCC CI never caught it.source_lcao/module_operator_lcao/ekinetic.h,source_pw/module_pwdft/op_pw_ekin.h: removed the inner#ifndef __EKINETICTEMPLATEguard blocks. Both headers shared that one macro, so any TU including both headers (in either order) skipped the second primary template and failed — on any compiler, GCC included (currently unreachable in our build graph, but a latent hazard). The outer include guards already prevent double inclusion, and the change also drops the reserved double-underscore identifier.Governance Notes