Bug 517786 - Error involving specialization of local class
Summary: Error involving specialization of local class
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 9.3.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-04 18:09 EDT by Nathan Ridge CLA
Modified: 2020-09-04 15:21 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nathan Ridge CLA 2017-06-04 18:09:24 EDT
CDT does not correctly handle specializations of local classes:

template <typename T>
auto foo() {
    struct S {
        T bar();
    };
    return S{}.bar();
}

template <typename> struct Waldo;
template <> struct Waldo<int> { typedef int type; };
Waldo<decltype(foo<int>())>::type g();  // Error on 'type'
Comment 1 Nathan Ridge CLA 2017-06-04 18:25:43 EDT
Note that lambda expressions used inside a function's body generate what are effectively local classes, and while explicilty-defined local classes are rare in real-world code, lambdas are becoming increasingly common.