public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/45011] New: template function specialization: does not respect access specifier
@ 2010-07-20 21:51 eisenstatdavid+gcc at gmail dot com
2010-07-20 21:54 ` [Bug c++/45011] " pinskia at gcc dot gnu dot org
2010-07-24 20:21 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 4+ messages in thread
From: eisenstatdavid+gcc at gmail dot com @ 2010-07-20 21:51 UTC (permalink / raw)
To: gcc-bugs
$ /ltmp/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/ltmp/bin/g++
COLLECT_LTO_WRAPPER=/ltmp/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ./configure --prefix=/ltmp --with-gimp=/ltmp --with-mpfr=/ltmp
--with-mpc=/ltmp
Thread model: posix
gcc version 4.6.0 20100720 (experimental) (GCC)
$ /ltmp/bin/g++ -save-temps test.cc
$ cat test.ii
# 1 "test.cc"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test.cc"
class C {
private:
typedef int Private;
};
template<typename T> void function(typename T::Private);
template<> void function<C>(int parameter) {
}
int main() {
function<C>(0);
}
$
--
Summary: template function specialization: does not respect
access specifier
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: eisenstatdavid+gcc at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45011
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/45011] template function specialization: does not respect access specifier
2010-07-20 21:51 [Bug c++/45011] New: template function specialization: does not respect access specifier eisenstatdavid+gcc at gmail dot com
@ 2010-07-20 21:54 ` pinskia at gcc dot gnu dot org
2010-07-24 20:21 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-07-20 21:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2010-07-20 21:54 -------
Comeau online gives an error:
"ComeauTest.c", line 6: error: type "C::Private" (declared at line 3) is
inaccessible
template<typename T> void function(typename T::Private);
^
detected during instantiation of "function" based on template
argument <C> at line 9
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45011
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/45011] template function specialization: does not respect access specifier
2010-07-20 21:51 [Bug c++/45011] New: template function specialization: does not respect access specifier eisenstatdavid+gcc at gmail dot com
2010-07-20 21:54 ` [Bug c++/45011] " pinskia at gcc dot gnu dot org
@ 2010-07-24 20:21 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-07-24 20:21 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from pinskia at gcc dot gnu dot org 2010-07-24 20:21 -------
Confirmed.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Known to fail| |4.1.2 4.3.2 4.2.2 4.6.0
Last reconfirmed|0000-00-00 00:00:00 |2010-07-24 20:21:47
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45011
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/45011] template function specialization: does not respect access specifier
[not found] <bug-45011-4@http.gcc.gnu.org/bugzilla/>
@ 2020-03-12 10:45 ` redi at gcc dot gnu.org
0 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2020-03-12 10:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45011
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |4.8.0
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Seems to have been fixed by r189640 for GCC 4.8
* pt.c (instantiate_decl): Don't recheck substitutions.
At that revision we reject the testcase with this error:
45011.cc:9:17: error: template-id ‘function<C>’ for ‘void function(int)’ does
not match any template declaration
template<> void function<C>(int parameter) {
^
45011.cc: In function ‘int main()’:
45011.cc:13:16: error: no matching function for call to ‘function(int)’
function<C>(0);
^
45011.cc:13:16: note: candidate is:
45011.cc:6:27: note: template<class T> void function(typename T::Private)
template<typename T> void function(typename T::Private);
^
45011.cc: In function ‘void function(typename T::Private) [with T = C; typename
T::Private = int]’:
45011.cc:3:15: error: ‘typedef int C::Private’ is private
typedef int Private;
^
45011.cc:6:27: error: within this context
template<typename T> void function(typename T::Private);
^
The error changed at r195779
re PR c++/56208 (Some classic sfinae cases fail to work due to access
problems)
PR c++/56208
* pt.c (fn_type_unification): Discard any access checks from
substituting explicit args.
Since then we print:
45011.cc:9:17: error: template-id ‘function<C>’ for ‘void function(int)’ does
not match any template declaration
template<> void function<C>(int parameter) {
^
And the error is similar today:
45011.cc:9:17: error: template-id 'function<C>' for 'void function(int)' does
not match any template declaration
9 | template<> void function<C>(int parameter) {
| ^~~~~~~~~~~
45011.cc:6:27: note: candidate is: 'template<class T> void function(typename
T::Private)'
6 | template<typename T> void function(typename T::Private);
| ^~~~~~~~
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-12 10:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-20 21:51 [Bug c++/45011] New: template function specialization: does not respect access specifier eisenstatdavid+gcc at gmail dot com
2010-07-20 21:54 ` [Bug c++/45011] " pinskia at gcc dot gnu dot org
2010-07-24 20:21 ` pinskia at gcc dot gnu dot org
[not found] <bug-45011-4@http.gcc.gnu.org/bugzilla/>
2020-03-12 10:45 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).