This is an archive of the discontinued LLVM Phabricator instance.

Instantiation all of local class members.
ClosedPublic

Authored by sepavloff on May 25 2015, 5:13 AM.

Details

Summary

If a function containing a local class is instantiated, instantiate
all of local class member, including default arguments and exception
specifications.

This change fixes PR21332 and thus implements DR1484.

Diff Detail

Repository
rL LLVM

Event Timeline

sepavloff updated this revision to Diff 26423.May 25 2015, 5:13 AM
sepavloff retitled this revision from to Instantiation all of local class members..
sepavloff updated this object.
sepavloff edited the test plan for this revision. (Show Details)
sepavloff added a subscriber: Unknown Object (MLST).
sepavloff updated this revision to Diff 26920.Jun 1 2015, 12:54 PM

Avoid crash if noexcept argument parsed with errors.

Ping.

Thanks,
--Serge

2015-06-02 1:54 GMT+06:00 Serge Pavlov <sepavloff@gmail.com>:

Avoid crash if noexcept argument parsed with errors.

http://reviews.llvm.org/D9990

Files:

lib/Parse/ParseDeclCXX.cpp
lib/Sema/SemaTemplateInstantiateDecl.cpp
test/SemaTemplate/instantiate-local-class.cpp

EMAIL PREFERENCES

http://reviews.llvm.org/settings/panel/emailpreferences/
rsmith accepted this revision.Jun 8 2015, 1:37 PM
rsmith added a reviewer: rsmith.
rsmith added a subscriber: rsmith.

This looks like a good start; I'm happy for you to go ahead with this as-is and deal with the local function declaration case separately if you prefer, or (since that change will require significant changes to this patch) rework this patch to deal with both cases together.

lib/Sema/SemaTemplateInstantiateDecl.cpp
1825–1841 ↗(On Diff #26920)

I don't think this is the right place for this; we should do this if we're in a local function declaration within a function definition too. Consider:

template<typename T> void f() {
  int g(int defarg = T::error);
}                        
template void f<int>();

Can you do the eager instantiation in Sema::SubstParmVarDecl instead?

3268–3273 ↗(On Diff #26920)

This should likewise also apply to the case of a function declaration within a function definition.

This revision is now accepted and ready to land.Jun 8 2015, 1:37 PM
This revision was automatically updated to reflect the committed changes.