[cfe-dev] Function Instantiation: Where? Or is it?

Douglas Gregor dgregor at apple.com
Tue Feb 1 12:01:00 PST 2011


On Feb 1, 2011, at 11:45 AM, Larisse Voufo wrote:

> Let me see if I can rephrase this problem... 
> At this point, instantiation is no longer an issue. The issue is managing new DeclContext's.
> 
> Take the following definition of a concept:
> 
> concept A<typename T> {
>     void f(int) { }
> }
> 
> This definition is parsed into a ConceptDecl  object ContextA where ConceptDecl is a DeclContext as well as a TemplateDecl.
> When the concept is used on a generic function such as:
> 
> template<typename T>
> requires A<T>
> void func(T a) {
>     f(a);
> }
> 
> at the call f(a),  the lookup process finds the definition of f() in the DeclContext ContextA.  
> Hence, the definition of func() is accepted. 
> Let's refer to the found definition as Fn.
> 
> Now, when func() is used in the main, the lookup and instantiation-related processes are still finding and using that same definition of f(): Fn.

That's wrong. You need to map from the concept's function f() to the corresponding function f() in the concept map.

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110201/50f079aa/attachment.html>


More information about the cfe-dev mailing list