[Bug c++/57979] New: G++ accepts constant expression defined using floating point glvalue

2013-07-25 Thread jogojapan at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57979

Bug ID: 57979
   Summary: G++ accepts constant expression defined using floating
point glvalue
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jogojapan at gmail dot com

The following code is accepted and compiled without error by G++:

int main()
{
  const float f1 = 0.0;

  constexpr float f2 = f1;

  return 0;
}

Note that the declaration of f2 as constexpr requires f1 to be a constant
expression, which it isn't, according to ยง5.19/2:

(QUOTE)
A condition-expression is a core constant expression unless it involves
[...] 
[..9th item..]
 - an lvalue-to-rvalue conversion (4.1) unless it is applied to [...] a glvalue
of integral or enumeration type that refers to a non-volatile const object with
a preceding initialization, initialized with a constant expresion, or
[...]
(ENDQUOTE)

So if f1 had been declared as const int, the code would be acceptable, but
there is no such exception for floating point (or any other non-integral or
non-enum type).


Tested with a 20130708 snapshot checkout from the master branch of the
git-mirror of the repository. (I'll test with a more recent version soon.)

[Bug c++/57979] G++ accepts constant expression defined using floating point non-constexpr glvalue

2013-07-25 Thread jogojapan at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57979

--- Comment #2 from Johannes Goller jogojapan at gmail dot com ---
Confirmed that the problem exists in the most recent version of GCC 4.9, i.e. a
20130725 snapshot from the master branch.


[Bug c++/56014] [C++1y] ICE using return type deduction for member functions with -g enabled

2013-07-25 Thread jogojapan at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56014

Johannes Goller jogojapan at gmail dot com changed:

   What|Removed |Added

Version|4.8.1   |4.9.0

--- Comment #3 from Johannes Goller jogojapan at gmail dot com ---
It also exists in a 4.9.0 snapshot from yesterday (20130725, built from the
master branch).


[Bug c++/56014] [C++1y] ICE using return type deduction for member functions with -g enabled

2013-06-03 Thread jogojapan at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56014

--- Comment #1 from Johannes Goller jogojapan at gmail dot com ---
I've just confirmed that the problem also exists in GCC 4.9 20130602 snapshot.


[Bug c++/56014] [C++1y] ICE using return type deduction for member functions with -g enabled

2013-06-03 Thread jogojapan at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56014

--- Comment #2 from Johannes Goller jogojapan at gmail dot com ---
It also exists in 4.8.1.


[Bug c++/56014] New: [C++1y] Return type deduction for member functions does not work when -g is enabled

2013-01-16 Thread jogojapan at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56014



 Bug #: 56014

   Summary: [C++1y] Return type deduction for member functions

does not work when -g is enabled

Classification: Unclassified

   Product: gcc

   Version: 4.8.0

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: jogoja...@gmail.com





Created attachment 29187

  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29187

Preprocessed file



GCC version: Snapshot 4.8-20130113 (built from source)

System: Linux diogenes 3.6.11-1.fc17.x86_64



C++1y implements return type deduction for functions (i.e. without trailing

return type). This does not work when the following two conditions are

satisfied:



 - The function is a member function (static or non-static)

 - *and* the -g option is used



Example:



#include iostream



struct Elem

{

  static auto test()

  { return 12; }

};



int main()

{

  std::cout  Elem::test()  std::endl;

  return 0;

}



When compiling this code using `g++ --std=c++1y -g -o test ./test.cpp`, the

following error is displayed:



./test.cpp:3:8: internal compiler error: in gen_type_die_with_usage, at

dwarf2out.c:19477

 struct Elem

^

0x813d06 gen_type_die_with_usage

../../gdc/gcc-4.8-20130106/gcc/dwarf2out.c:19477

0x810c25 gen_decl_die

../../gdc/gcc-4.8-20130106/gcc/dwarf2out.c:19971

0x812afc gen_member_die

../../gdc/gcc-4.8-20130106/gcc/dwarf2out.c:19037

0x812afc gen_struct_or_union_type_die

../../gdc/gcc-4.8-20130106/gcc/dwarf2out.c:19110

0x812afc gen_tagged_type_die

../../gdc/gcc-4.8-20130106/gcc/dwarf2out.c:19300

0x813ced gen_type_die_with_usage

../../gdc/gcc-4.8-20130106/gcc/dwarf2out.c:19447

0x810e6a gen_decl_die

../../gdc/gcc-4.8-20130106/gcc/dwarf2out.c:20010

0x9deed2 rest_of_type_compilation(tree_node*, int)

../../gdc/gcc-4.8-20130106/gcc/passes.c:217

0x5c7c0d finish_struct_1(tree_node*)

../../gdc/gcc-4.8-20130106/gcc/cp/class.c:6390

0x5c90cc finish_struct(tree_node*, tree_node*)

../../gdc/gcc-4.8-20130106/gcc/cp/class.c:6555

0x5f71be cp_parser_class_specifier_1

../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:18245

0x5f71be cp_parser_class_specifier

../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:18453

0x5f71be cp_parser_type_specifier

../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:13568

0x60e2cd cp_parser_decl_specifier_seq

../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:10895

0x611ce9 cp_parser_simple_declaration

../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:10494

0x613c60 cp_parser_block_declaration

../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:10443

0x61c84b cp_parser_declaration

../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:10340

0x61b51d cp_parser_declaration_seq_opt

../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:10226

0x61cdc2 cp_parser_translation_unit

../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:3808

0x61cdc2 c_parse_file()

../../gdc/gcc-4.8-20130106/gcc/cp/parser.c:28175

Please submit a full bug report,





The error also occurs when the function is non-static. It does *not* occur,

however, when '-g' isn't used, or when the function is not a member function.