Bug 59191 - Accessibility of types not checked in template functions
Summary: Accessibility of types not checked in template functions
Status: RESOLVED DUPLICATE of bug 47346
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-19 15:44 UTC by Akim Demaille
Modified: 2013-11-19 16:28 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Akim Demaille 2013-11-19 15:44:50 UTC
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!
Comment 1 Paolo Carlini 2013-11-19 16:28:10 UTC
Dup.

*** This bug has been marked as a duplicate of bug 47346 ***