This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] c++/65579 - set readonly bit on static constexpr members of templates
- From: Martin Sebor <msebor at gmail dot com>
- To: Jason Merrill <jason at redhat dot com>, Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 17 Mar 2016 16:40:04 -0600
- Subject: Re: [PATCH] c++/65579 - set readonly bit on static constexpr members of templates
- Authentication-results: sourceware.org; auth=none
- References: <56E09F18 dot 7030103 at gmail dot com> <56EABA2F dot 2010302 at redhat dot com>
On 03/17/2016 08:07 AM, Jason Merrill wrote:
On 03/09/2016 05:09 PM, Martin Sebor wrote:
While going through constexpr bugs looking for background
on one I'm currently working on I came across bug 65579 -
[C++11] gcc requires definition of a static constexpr member
even though it is not odr-used.
The bug points out that GCC (sometimes) emits references to
static constexpr data members of class templates even when
they aren't odr-used. (A more detailed analysis of why this
happens is in my comment #1 on the bug.)
This should have been fixed up in complete_vars; why didn't it work?
IIUC, the job of complete_vars(CLASS) is to complete the type of
variables of class CLASS. In the test case from the bug (below),
the type of constexpr_member is not CLASS (struct B) but rather
struct A<0>, so its type is never completed there, or apparently
anywhere else.
template <int> struct A { int i; };
struct B {
static constexpr A<0> constexpr_member = { 1 };
};
Martin