[Bug c++/67333] [C++11][constexpr] constexpr functions incorrectly prohibit taking references to volatile types

2016-10-12 Thread myriachan at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67333

Melissa  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Melissa  ---
Seems to have been fixed sometime between 6.0 and 6.1.

[Bug c++/67333] [C++11][constexpr] constexpr functions incorrectly prohibit taking references to volatile types

2015-08-29 Thread miyuki at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67333

Mikhail Maltsev miyuki at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-08-29
 Blocks||55004
 Ever confirmed|0   |1
  Known to fail||6.0

--- Comment #2 from Mikhail Maltsev miyuki at gcc dot gnu.org ---
For the record: https://gcc.gnu.org/ml/gcc-patches/2015-08/msg01735.html


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55004
[Bug 55004] [meta-bug] constexpr issues


[Bug c++/67333] [C++11][constexpr] constexpr functions incorrectly prohibit taking references to volatile types

2015-08-23 Thread miyuki at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67333

Mikhail Maltsev miyuki at gcc dot gnu.org changed:

   What|Removed |Added

 CC||miyuki at gcc dot gnu.org

--- Comment #1 from Mikhail Maltsev miyuki at gcc dot gnu.org ---
EDG accepts the first testcase. The second one is rejected, but presumably due
to incomplete C++14 support.

In potential_constant_expression_1 we have a check:

  if (TREE_THIS_VOLATILE (t))
{
  if (flags  tf_error)
error (expression %qE has side-effects, t);

The comment in tree.h says:
/* Nonzero means this expression is volatile in the C sense:
   its address should be of type `volatile WHATEVER *'.
   In other words, the declared item is volatile qualified.
...
   If this bit is set in an expression, so is TREE_SIDE_EFFECTS.  */

In our case t is:
(gdb) p t
$10 = var_decl 0x766a7cf0 meow
(gdb) pt
warning: Expression is not an assignment (and might have no effect)
 var_decl 0x766a7cf0 meow
type array_type 0x76800c78
type integer_type 0x76800a80 int volatile type_6 SI
size integer_cst 0x766bd0a8 constant 32
unit size integer_cst 0x766bd0c0 constant 4
align 32 symtab 0 alias set -1 canonical type 0x76800a80
precision 32 min integer_cst 0x766bd060 -2147483648 max integer_cst
0x766bd078 2147483647
pointer_to_this pointer_type 0x76800d20
TI
size integer_cst 0x7669bea0 constant 128
unit size integer_cst 0x7669beb8 constant 16
align 32 symtab 0 alias set -1 canonical type 0x76800c78
domain integer_type 0x76800b28 type integer_type 0x7669f1f8
sizetype
type_6 DI
size integer_cst 0x7669be58 constant 64
unit size integer_cst 0x7669be70 constant 8
align 64 symtab 0 alias set -1 canonical type 0x76800b28
precision 64 min integer_cst 0x7669be88 0 max integer_cst 0x7680adc8
3
pointer_to_this pointer_type 0x768133f0
side-effects addressable volatile used tree_1 decl_5 TI file
/home/miyuki/gcc/test/meow/meow.cc line 15 col 18 size integer_cst
0x7669bea0 128 unit size integer_cst 0x7669beb8 16
align 32 context function_decl 0x767ffe00 main

I.e. the condition is probably wrong and we should also check that t is an
expression, not a declaration.