apoch / epoch-language

Home of the Epoch Programming Language Project
Other
72 stars 3 forks source link

Taking function name can cause confusion between reference and r-value reference types. #96

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This can cause a confusion in C++11 depending on if you're looking for an 
r-value reference (T&&) or an l-value reference (T&):
    GlobalFunctions.insert(std::make_pair(name, FunctionInvocationHelper));

Solution:
Clarify the case by explicitly indicating the reference semantics you desire 
(which is probably an l-value reference):
    GlobalFunctions.insert(std::make_pair(name, &FunctionInvocationHelper));

Original issue reported on code.google.com by ryoohki@gmail.com on 1 Feb 2012 at 8:02

GoogleCodeExporter commented 9 years ago
Similar problem in Externals.cpp line 74:
    AddToMapNoDupe(table, std::make_pair(L"external", ExternalHelper));
Should be:
    AddToMapNoDupe(table, std::make_pair(L"external", &ExternalHelper));

Original comment by ryoohki@gmail.com on 1 Feb 2012 at 8:12

GoogleCodeExporter commented 9 years ago
Similar issue in Constructors.cpp, line 65:
    AddToMapNoDupe(table, std::make_pair(L"constructor", ConstructorTagHelper));
Should be:
    AddToMapNoDupe(table, std::make_pair(L"constructor", &ConstructorTagHelper));

Original comment by ryoohki@gmail.com on 1 Feb 2012 at 8:23

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Attached is a patch that fixes this issue, issue 97 and issue 98
http://code.google.com/p/epoch-language/issues/detail?id=97
http://code.google.com/p/epoch-language/issues/detail?id=98

Original comment by ryoohki@gmail.com on 1 Feb 2012 at 8:49

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in trunk via patch from issue 100.

Original comment by don.ap...@gmail.com on 7 Feb 2012 at 5:16