From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27940 invoked by alias); 13 Jan 2013 19:17:34 -0000 Received: (qmail 27902 invoked by uid 48); 13 Jan 2013 19:17:06 -0000 From: "manu at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55962] improper location for static_assert Date: Sun, 13 Jan 2013 19:17:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: minor X-Bugzilla-Who: manu at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Last reconfirmed CC Ever Confirmed Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg01138.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D55962 Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2013-01-13 CC| |manu at gcc dot gnu.org Ever Confirmed|0 |1 --- Comment #1 from Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez 2013-01-13 19:17:05 UTC --- Confirmed. If you run GCC under GDB, you'll notice that the call=20 if (expr =3D=3D error_mark_node || TREE_CODE (expr) =3D=3D TREE_LIST) { if (complain & tf_error) qualified_name_lookup_error (scope, TREE_OPERAND (qualified_id, 1), =3D> expr, input_location); return error_mark_node; } uses input_location. I think it should use an explicit location. The proble= m is how to get the location of 'value' to this point.=20 Up one-level input_location is "hacked" to be=20 loc =3D input_location; if (EXPR_HAS_LOCATION (t)) input_location =3D EXPR_LOCATION (t); but in this case t is just: > arg 1 local bindings <(nil)>>> so it doesn't have a location, so it uses input_location. The issue seems to be that input_location has somehow been smashed by somet= hing else. For the testcase: void assert(int, const char *); template int foo(int b) { assert(T::value, "toto"); return b; } int main() { foo(12); } we get: test.cc:6:26: error: =E2=80=98value=E2=80=99 is not a member of =E2=80=98in= t=E2=80=99 assert(T::value, "toto"); ^ which is slightly better and the only difference seems to be the value of input_location in the condition above. This requires much more investigation.