[LLVMbugs] [Bug 22124] New: friend keyword used on nested template class results in ignoring of the class specializations
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jan 8 06:50:20 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22124
Bug ID: 22124
Summary: friend keyword used on nested template class results
in ignoring of the class specializations
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: roman.kurc at wp.pl
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
The following example is compiled by g++ but causes clang compile error. It
seems that after using 'friend' on nested template class compiler ignores
possible class specializations.
.h
#pragma once
template< typename a >
struct friended
{
template < typename f, typename c >
struct inside ;
};
class A
{
public:
friend friended<A>::inside<A, int>;
int the_answer()
{
return 42;
}
};
template< typename a > template< typename b >
struct friended<a>::inside<A, b>
{
static int get_my_id( )
{
A ap;
return ap.the_answer();
}
};
.cpp
#include "template_test.h"
#include <iostream>
int main()
{
std::cout << friended<A>::inside<A,int>::get_my_id() << std::endl;
return 0;
}
for the above:
g++ -c -std=c++11 template_test.cpp - compiles just fine
clang++ -c -std=c++11 template_test.cpp gives
bash-4.1$ clang++ -c -std=c++11 template_test.cpp
template_test.cpp:6:31: error: implicit instantiation of undefined template
'friended<A>::inside<A, int>'
std::cout << friended<A>::inside<A,int>::get_my_id() << std::endl;
^
./template_test.h:12:12: note: template is declared here
struct inside ;
^
1 error generated.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150108/bea08607/attachment.html>
More information about the llvm-bugs
mailing list