I think this is the wrong place for this fix; can we check for types being
defined in a parameter type sooner, and mark the type invalid in that case?
(The assertion will be suppressed for an invalid type.)
We also assert on this test case, for a reason that looks closely related:
struct pr19018 {
short foo6 (struct bar0 {} bar3); // expected-error{{cannot be defined in a
parameter type}}
bar0 *p;
};
... and I'd really like us to fix this more thoroughly, for all relevant cases.
================
Comment at: lib/Sema/SemaDecl.cpp:10743-10748
@@ -10743,6 +10742,8 @@
+ }
+ if (S->isFunctionPrototypeScope() && TUK == TUK_Definition) {
// If this is an enum declaration in function prototype scope, set its
// initial context to the translation unit.
// FIXME: [citation needed]
SearchDC = Context.getTranslationUnitDecl();
}
----------------
This looks wrong in C. Given:
void f(enum E { e } *p);
... the enum definition should not be visible outside the function.
http://reviews.llvm.org/D3925
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits