[EXT_EP-9294] Compiler may crash when auto as return type of uninstantiated member function in template class resolves to template parameter Created: 01/Mar/19 Updated: 19/Feb/20 Resolved: 01/Mar/19 |
|
| Status: | Fixed |
| Project: | Embedded Software & Tools |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Medium |
| Reporter: | TI User | Assignee: | TI User |
| Resolution: | Fixed | Votes: | 0 |
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Product: | Code Generation Tools |
| Internal ID: | CODEGEN-5986 |
| Forum URL: | https://e2e.ti.com/support/tools/ccs/f/81/t/778491 |
| Found In Release: | ARM_18.1.0.LTS MSP430_18.1.0.LTS C6000_8.3.0 ARM_18.12.0.LTS ARM_19.6.0.STS MSP430_18.12.0.LTS MSP430_19.6.0.STS |
| Fix In Release: | ARM_18.1.6.LTS MSP430_18.1.6.LTS ARM_19.6.0.STS C6000_8.3.4 ARM_18.12.3.LTS MSP430_19.6.0.STS MSP430_18.12.3.LTS |
| Affected Platform/Device: | default |
| Workaround: | Avoid "auto" as the return type of a member function if its immediate resolution is a template parameter.
Or explicitly instantiate the class or function. In the given test case, there's a variable defined with type EventSubscriberTable<int>. To avoid the problem, then, include either template class EventSubscriberTable<int>; or template auto EventSubscriberTable<int>::getBroadcastList(void); in the source file. |
| Release Notes: | Given a class definition like
template <typename T> class Table { public : auto getList(void) { return m_Callbacks; } private : T m_Callbacks; }; where the member function getList() returns "auto" and that "auto" can be seen to be "T", and this program: int main(int argc, char* argv[]) { Table<int> m_Table; return 0; } in which the Table class is instantiated but the function getList() is never used, the compiler may crash. The problem requires the combination of auto, template parameter, and uninstantiated function. Changing any of those details will avoid it. |
| Description |
|
Compiler may crash when auto as return type of uninstantiated member function in template class resolves to template parameter |