From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25502 invoked by alias); 11 Jun 2010 13:27:16 -0000 Received: (qmail 25452 invoked by uid 48); 11 Jun 2010 13:27:05 -0000 Date: Fri, 11 Jun 2010 13:27:00 -0000 Message-ID: <20100611132705.25451.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/44500] [C++0x] Bogus narrowing conversion error In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "gpiez at web dot de" 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: 2010-06/txt/msg01300.txt.bz2 ------- Comment #9 from gpiez at web dot de 2010-06-11 13:27 ------- I understand now after the implicit promotion to int of a non constant value the result of the narrowing operation can't be guaranteed to fit in the original type. But I still think it shouldn't give an error, and if the standard says so, I think it is flawed in this regard ;-) Consider g(); // Warning, but no Error despite it can be proven that the value will not fit and this is very likely an error. Opposing to char c,d; A a = { c+d }; which is very likely not an error and would only require a mild warning. IMHO. Manuel, in your testcase, you do not only warn, you error out if compiled with -std=c++0x. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44500