This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/71035] GNU does not give error on declaration of non literal type in template function
- From: "Judy.Ward at intel dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 10 May 2016 00:00:23 +0000
- Subject: [Bug c++/71035] GNU does not give error on declaration of non literal type in template function
- Auto-submitted: auto-generated
- References: <bug-71035-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71035
--- Comment #2 from Judy Ward <Judy.Ward at intel dot com> ---
Yes I have a beta copy of EDG
4.11 which has relaxed constexpr and they give an error. Unfortunately some
Boost code (I think inadvertently) relies on not giving a diagnostic.
Yes I see your point that this is really a QOI issue but GNU does seem
inconsistent and EDG will have to emulate that inconsistency.
Thanks
Judy
> On May 9, 2016, at 7:38 PM, msebor at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org> wrote:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71035
>
> Martin Sebor <msebor at gcc dot gnu.org> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> Keywords| |accepts-invalid
> Status|UNCONFIRMED |NEW
> Last reconfirmed| |2016-05-09
> CC| |msebor at gcc dot gnu.org
> Ever confirmed|0 |1
> Known to fail| |4.9.3, 5.3.0, 6.1.0
> Severity|normal |enhancement
>
> --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
> Hi Judy!
>
> I'll take a stab at this -- let me know if I missed something. I agree that
> similarly to the non-template case, (in the absence of a valid explicit
> specialization) diagnosing the constexpr function template below would be
> useful, even though in p5 and p6 of [dcl.constexpr], the standard leaves both
> cases as a matter of QoI:
>
> -6- If the instantiated template specialization of a constexpr function
> template o 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. 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.
>
> (I read the last sentence as referring to implicit specializations of the
> template definition, not explicit ones with valid definitions.)
>
> Thus, I'm inclined to view this bug not as a defect but an enhancement request.
> Let me know if you disagree.
>
> Clang is more strict than GCC here by issuing the optional diagnostic.
>
> My copy of EDG (version 4.10) rejects the program because it doesn't fully
> implement the C++ 14 rules: a) it doesn't recognize void as a literal type, and
> b) it doesn't allow statements in constexpr functions.
>
> --
> You are receiving this mail because:
> You reported the bug.