-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Closed as duplicate of#147127
Closed as duplicate of#147127
Copy link
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluationAnything related to constant evaluationdiverges-from:edgDoes the clang frontend diverge from edg compiler on this issueDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issueduplicateResolved as duplicateResolved as duplicate
Description
This program
union U {
constexpr bool operator ==(const U&) const = default;
};
static_assert( U{} == U{} );is accepted in GCC and EDG. But Clang fails with the error:
<source>:5:16: error: static assertion expression is not an integral constant expression
5 | static_assert( U{} == U{} );
| ^~~~~~~~~~
<source>:5:16: note: pointer to temporary is not a constant expression
<source>:5:16: note: temporary created here
Online demo: https://gcc.godbolt.org/z/MMrbaaWae
Related discussion: https://stackoverflow.com/q/79793373/7325599
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluationAnything related to constant evaluationdiverges-from:edgDoes the clang frontend diverge from edg compiler on this issueDoes the clang frontend diverge from edg compiler on this issuediverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issueduplicateResolved as duplicateResolved as duplicate