Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Never make any mistaeks. -- Anonymous, in a mail discussion about to a kernel bug report


devel / comp.lang.c++ / Is this a bug in GCC with private non-type template parameters?

SubjectAuthor
o Is this a bug in GCC with private non-type template parameters?Renegat

1
Is this a bug in GCC with private non-type template parameters?

<88bee1d9-8961-4607-9ced-418226d8f2c0n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=965&group=comp.lang.c%2B%2B#965

  copy link   Newsgroups: comp.lang.c++
X-Received: by 2002:ae9:de03:0:b0:767:f89f:fef1 with SMTP id s3-20020ae9de03000000b00767f89ffef1mr1235qkf.1.1690331809103;
Tue, 25 Jul 2023 17:36:49 -0700 (PDT)
X-Received: by 2002:a05:6808:1513:b0:3a1:f3e2:c977 with SMTP id
u19-20020a056808151300b003a1f3e2c977mr1122323oiw.11.1690331808961; Tue, 25
Jul 2023 17:36:48 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Tue, 25 Jul 2023 17:36:48 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=80.141.179.231; posting-account=QG1pcwoAAAC5OD-1v4QquxGLPSUW-7FX
NNTP-Posting-Host: 80.141.179.231
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <88bee1d9-8961-4607-9ced-418226d8f2c0n@googlegroups.com>
Subject: Is this a bug in GCC with private non-type template parameters?
From: renegat.nospam@gmail.com (Renegat)
Injection-Date: Wed, 26 Jul 2023 00:36:49 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2795
 by: Renegat - Wed, 26 Jul 2023 00:36 UTC

Hello everybody,

do you agree that the following template related problem is a bug in the g++ front-end of GCC?

If someone with a GCC bugzilla account thinks so, maybe he can submit a bug report there (the automatic account creation has been restricted now).

Thanks.

/*
Product: gcc
Comp: c++
Versions: 11.4 / 12.3 / 13.1 (all currently supported)

Summary: False access error for non-type template parameter of a nested class

Keywords: rejects-valid, accepts-invalid
*/

//
// The out-of-class definition of a nested class member template with a
// private non-type template parameter triggers a false compilation error
//
class A
{ enum e{ E };
template <A::e T>
struct class_template;
};
// BUG #1: This definition outside the class body is valid, but g++ aborts
// the compilation with an error: ‘enum A::e’ is private within this context’
template <A::e T>
struct A::class_template
{ };

// Maybe helpful for a bug fix:
// The compilation error is not triggered for a similar class with a member
// function template defined outside the class body
class B
{ enum e{ E };
template <B::e T>
void function_template();
};

// g++ compiles fine for a function template :
template <B::e T>
void B::function_template()
{ }

// BUG #2: g++ compiles this without any error, but ‘B::e’ is private within
// this context
template <B::e T>
void global_function_template()
{ }

// No BUG here: For a similar class template the g++ compiler correctly reports
// a compilation error (‘enum B::e’ is private within this context)
template <B::e T>
class global_class_template
{ };

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor