This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/59729] [DR1732] C++11 allows type definitions in conditions and for-range-declarations, but shouldn't
- From: "harald at gigawatt dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 08 Jan 2014 20:58:01 +0000
- Subject: [Bug c++/59729] [DR1732] C++11 allows type definitions in conditions and for-range-declarations, but shouldn't
- Auto-submitted: auto-generated
- References: <bug-59729-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59729
Harald van Dijk <harald at gigawatt dot nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|C++11 allows type |[DR1732] C++11 allows type
|definitions in conditions |definitions in conditions
| |and for-range-declarations,
| |but shouldn't
--- Comment #1 from Harald van Dijk <harald at gigawatt dot nl> ---
As it turns out, this was indeed accidental, and GCC's and clang's behaviour is
what's intended for conditions, according to
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1732. However,
according to that, the intent is to also disallow type definitions in
for-range-declarations, where GCC currently does permit them (and clang rejects
them).
struct S {
template <typename T>
operator T() { return T(); }
};
int main() {
S s[1];
for (struct T { } t : s) { }
}
Perhaps this should be suspended until the wording is fixed, and reevaluated at
that time?