This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/60399] constexpr ctor that does not init an attribute should be rejected but isn't


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60399

Daniel KrÃgler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #1 from Daniel KrÃgler <daniel.kruegler at googlemail dot com> ---
No, the compiler is conforming: According to 7.1.6 p6:

"If the instantiated template specialization of a constexpr [..] member
function of a class template would fail to satisfy the requirements for a
constexpr function or constexpr constructor, that specialization is still a
constexpr function or constexpr constructor, even though a call to such a
function
cannot appear in a constant expression."

So, per se, the situation is well-defined here and there is fundamentally
nothing wrong with the constructor, because your code does not attempt to use
it in a constant expression. 

What makes your code ill-formed is the fact that your template could never be
instantiated to make the constructor a constexpr constructor, see the following
sentence:

"If no specialization of the template would satisfy the requirements for
a constexpr function or constexpr constructor when considered as a non-template
function or constructor, the template is ill-formed; no diagnostic required."

As you may notice, this kind of code does not require a diagnostics.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]