This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/64666] New: gcc wrongly accepts assignment in constant expression
- From: "dcb314 at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 19 Jan 2015 11:22:49 +0000
- Subject: [Bug c++/64666] New: gcc wrongly accepts assignment in constant expression
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64666
Bug ID: 64666
Summary: gcc wrongly accepts assignment in constant expression
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Given source code
void f()
{
int i = 5, j;
int a[ j = i];
}
Recent trunk code says
$ ~/gcc/results/bin/g++ -g -O2 -Wall -Wextra -c jan19g.cc
jan19g.cc: In function âvoid f()â:
jan19g.cc:6:6: warning: unused variable âaâ [-Wunused-variable]
int a[ j = i];
^
$
Here is clang doing something different
$ ~/llvm/results/bin/clang++ -g -O2 -Wall -c jan19g.cc
jan19g.cc:6:11: error: expected ']'
int a[ j = i];
^
jan19g.cc:6:7: note: to match this '['
int a[ j = i];
^
1 error generated.
$