[LLVMbugs] [Bug 18219] New: clang doesn't find member of 'voldemort'-struct of a function template in getter for it if the later is used in a functiontemplate that receives the 'voldemort'-type as argument
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Dec 11 16:00:07 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=18219
Bug ID: 18219
Summary: clang doesn't find member of 'voldemort'-struct of a
function template in getter for it if the later is
used in a functiontemplate that receives the
'voldemort'-type as argument
Product: clang
Version: 3.3
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: florian.weber at sfz-bw.de
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Clang rejects the following code:
=================================================
template<typename T> void use2(const T& arg) {
arg.fun();
}
template<typename T> void use1(T value) {
struct range_helper {
T x;
T fun() const { return x; }
};
use2(range_helper{value});
}
int main() {
use1(3);
}
=================================================
Error if compiled with 'clang++ -Wextra -pedantic -std=c++11 main.cpp':
=================================================
main.cpp:9:26: error: 'use1(int)::range_helper::fun()::range_helper::x' is not
a member of class 'const range_helper'
T fun() const { return x; }
^
main.cpp:2:6: note: in instantiation of member function
'use1(int)::range_helper::fun' requested here
arg.fun();
^
main.cpp:11:2: note: in instantiation of function template specialization
'use2<range_helper>' requested here
use2(range_helper{value});
^
main.cpp:15:2: note: in instantiation of function template specialization
'use1<int>' requested here
use1(3);
^
1 error generated.
=================================================
I believe that this code is legal and gcc agrees with me.
Even if it were illegal, the error-message would be terrible and should be
fixed.
--
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/20131212/c1cc257c/attachment.html>
More information about the llvm-bugs
mailing list