This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/59191] New: Accessibility of types not checked in template functions
- From: "akim.demaille at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 19 Nov 2013 15:44:50 +0000
- Subject: [Bug c++/59191] New: Accessibility of types not checked in template functions
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59191
Bug ID: 59191
Summary: Accessibility of types not checked in template
functions
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: akim.demaille at gmail dot com
Hi all,
Below, GCC forgets to check the accessibility of "type", which
turns out to be private:
$ cat foo.cc
class foo
{
typedef int type;
};
template <typename T>
foo::type bar()
{
return 1;
}
int main()
{
return bar<char>();
}
$ g++-mp-4.9 -Wall foo.cc
$ clang++-mp-3.1 -Wall foo.cc
foo.cc:7:6: error: 'type' is a private member of 'foo'
foo::type bar()
^
foo.cc:3:15: note: implicitly declared private here
typedef int type;
^
1 error generated.
All the GCCs I have access to (4.4 .. 4.9) exhibit the same behavior.
Cheers!