[Bug c++/99569] New: segfault when running a module

2021-03-12 Thread ryan.burn at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99569

Bug ID: 99569
   Summary: segfault when running a module
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Here's how to reproduce

// a-m.cc
module;

#include 

export module a;

export std::string do_a() {
return "abc";
}

// main.cc
#include 

import a;

int main() {
std::cout << do_a() << "\n";
return 0;
}

If I then run

g++ -fmodules-ts -std=c++20 -c a-m.cc
g++ -fmodules-ts -std=c++20 -c main.cc
g++ *.o
./a.out

the program prints

abc
Segmentation fault

This is the version of gcc I used

root@15a43977d8e1:/t/strfunc# g++ --version
g++ (GCC) 11.0.1 20210311 (experimental)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[Bug c++/99543] ICE module compilation ../../gcc/toplev.c:327

2021-03-12 Thread ryan.burn at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99543

ryan.burn at gmail dot com changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|WAITING |RESOLVED

[Bug c++/99543] ICE module compilation ../../gcc/toplev.c:327

2021-03-12 Thread ryan.burn at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99543

--- Comment #2 from ryan.burn at gmail dot com ---
it worked with 

root@15a43977d8e1:/t/hdr-mod# g++ --version
g++ (GCC) 11.0.1 20210311 (experimental)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[Bug c++/99568] New: ICE when compiling basic module: internal compiler error: in module_may_redeclare, at cp/module.cc:18453

2021-03-12 Thread ryan.burn at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99568

Bug ID: 99568
   Summary: ICE when compiling basic module: internal compiler
error: in module_may_redeclare, at cp/module.cc:18453
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Here's how to reproduce

/// say_hello.cc
module;
#include 
#include 
export module Hello;
// the module purview starts here
// provide a function to users by exporting it
export void SayHello
  (std::string_view const )
{
  std::cout << "Hello " << name << "!\n";
}

/// main.cc
import Hello;

#include 

int main() {
  SayHello("world");
  return 0;
}

If I compile with
g++ -fmodules-ts -std=c++20 -c say_hello.cc
g++ -fmodules-ts -std=c++20 -c main.cc

I get the ICE below.

This is my gcc version

root@15a43977d8e1:/hello-world# g++ --version
g++ (GCC) 11.0.1 20210311 (experimental)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



root@15a43977d8e1:/hello-world# g++ -fmodules-ts -std=c++20 -c main.cc
In file included from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:61,
 from /usr/local/include/c++/11.0.1/bits/char_traits.h:39,
 from /usr/local/include/c++/11.0.1/string_view:41,
 from main.cc:4:
/usr/local/include/c++/11.0.1/bits/cpp_type_traits.h:429:7: error: template
definition of non-template 'enum
std::__is_nonvolatile_trivially_copyable<_Tp>::'
  429 |   enum { __value = __is_trivially_copyable(_Tp) };
  |   ^~~~
/usr/local/include/c++/11.0.1/bits/cpp_type_traits.h:436:12: error:
redefinition of 'struct std::__is_nonvolatile_trivially_copyable'
  436 | struct __is_nonvolatile_trivially_copyable
  |^
In file included from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:61,
 from /usr/local/include/c++/11.0.1/bits/char_traits.h:39,
 from /usr/local/include/c++/11.0.1/ios:40,
 from /usr/local/include/c++/11.0.1/ostream:38,
 from /usr/local/include/c++/11.0.1/iostream:39,
 from say_hello.cc:4,
of module Hello, imported at main.cc:2:
/usr/local/include/c++/11.0.1/bits/cpp_type_traits.h:436:12: note: previous
definition of 'struct std::__is_nonvolatile_trivially_copyable'
  436 | struct __is_nonvolatile_trivially_copyable
  |^
In file included from /usr/local/include/c++/11.0.1/bits/stl_algobase.h:63,
 from /usr/local/include/c++/11.0.1/bits/char_traits.h:39,
 from /usr/local/include/c++/11.0.1/string_view:41,
 from main.cc:4:
/usr/local/include/c++/11.0.1/ext/numeric_traits.h:159:41: error: template
definition of non-template 'const int
__gnu_cxx::__numeric_traits_floating<_Value>::__max_digits10'
  159 |   static const int __max_digits10 = __glibcxx_max_digits10(_Value);
  | ^~
/usr/local/include/c++/11.0.1/ext/numeric_traits.h:162:39: error: template
definition of non-template 'const bool
__gnu_cxx::__numeric_traits_floating<_Value>::__is_signed'
  162 |   static const bool __is_signed = true;
  |   ^~~~
/usr/local/include/c++/11.0.1/ext/numeric_traits.h:163:37: error: template
definition of non-template 'const int
__gnu_cxx::__numeric_traits_floating<_Value>::__digits10'
  163 |   static const int __digits10 = __glibcxx_digits10(_Value);
  | ^~
/usr/local/include/c++/11.0.1/ext/numeric_traits.h:164:43: error: template
definition of non-template 'const int
__gnu_cxx::__numeric_traits_floating<_Value>::__max_exponent10'
  164 |   static const int __max_exponent10 =
__glibcxx_max_exponent10(_Value);
  |   ^~~~
In file included from /usr/local/include/c++/11.0.1/bits/move.h:57,
 from /usr/local/include/c++/11.0.1/bits/nested_exception.h:40,
 from /usr/local/include/c++/11.0.1/exception:148,
 from /usr/local/include/c++/11.0.1/ios:39,
 from /usr/local/include/c++/11.0.1/ostream:38,
 from /usr/local/include/c++/11.0.1/iostream:39,
 from say_hello.cc:4,
of module Hello, imported at main.cc:2:
/usr/local/include/c++/11.0.1/type_traits:231:11: error: conflicting global
module declaration 'template using __remove_cv_t = typename
std::r

[Bug c++/99543] New: ICE module compilation ../../gcc/toplev.c:327

2021-03-10 Thread ryan.burn at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99543

Bug ID: 99543
   Summary: ICE module compilation  ../../gcc/toplev.c:327
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Here is the stacktrace.

It happened when I tried to compile a header module that imported another
header module:

// a.h
import ;



SUBCOMMAND: # //example/header-module:a_hdr [action 'Action
example/header-module/a.h.gcm', configuration:
86d23d2b5aedbeecfc6e6954ea9486ec39e9e40bcbc4b17cec46a06eed198d11, execution
platform: @local_config_platform//:host]
(cd
/root/.cache/bazel/_bazel_root/f8087e59fd95af1ae29e8fcb7ff1a3dc/execroot/com_github_rnburn_bazel_cpp20_modules
&& \
  exec env - \
  bazel-out/k8-opt-exec-2B5CBBC6/bin/util/process_wrapper/process_wrapper --
/usr/local/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall
-Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer
'-std=c++0x'
-Ibazel-out/k8-fastbuild/bin/example/header-module/system/iostream-include -x
c++-header -fmodules-ts '-std=c++20' -fno-canonical-system-headers
-Wno-builtin-macro-redefined '-D__DATE__="redacted"'
'-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c
example/header-module/a.h
'-fmodule-mapper=bazel-out/k8-fastbuild/bin/example/header-module/a_hdr-module-map'
-iquote .)
INFO: From Action example/header-module/a.h.gcm:
example/header-module/a.h: internal compiler error: Segmentation fault
0x10a9ccf crash_signal
../../gcc/toplev.c:327
0x1c671d6 get_location_from_adhoc_loc(line_maps const*, unsigned int)
../../libcpp/line-map.c:257
0x9ff6dd module_state::write_location(bytes_out&, unsigned int)
../../gcc/cp/module.cc:15569
0xa01faf module_state::write_define(bytes_out&, cpp_macro const*, bool)
../../gcc/cp/module.cc:16337
0xa0340a module_state::write_macros(elf_out*, cpp_reader*, unsigned int*)
../../gcc/cp/module.cc:16839
0xa16218 module_state::write(elf_out*, cpp_reader*)
../../gcc/cp/module.cc:17713
0xa168f5 finish_module_processing(cpp_reader*)
../../gcc/cp/module.cc:19728
0x9aaa8b c_parse_final_cleanups()
../../gcc/cp/decl2.c:5170
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


gcc version
root@748001480fc4:/src# g++ --version
g++ (GCC) 11.0.0 20201218 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[Bug c++/99541] New: ICE when reading a module

2021-03-10 Thread ryan.burn at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99541

Bug ID: 99541
   Summary: ICE when reading a module
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Backtrace


  bazel-out/k8-opt-exec-2B5CBBC6/bin/util/process_wrapper/process_wrapper --
/usr/local/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall
-Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer
'-std=c++0x'
'-frandom-seed=bazel-out/k8-fastbuild/bin/example/transitive/main.o'
-fmodules-ts '-std=c++20' -fno-canonical-system-headers
-Wno-builtin-macro-redefined '-D__DATE__="redacted"'
'-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c
example/transitive/main.cc -o
bazel-out/k8-fastbuild/bin/example/transitive/main.o
'-fmodule-mapper=bazel-out/k8-fastbuild/bin/example/transitive/a.out-module-map'
-iquote .)
SUBCOMMAND: # //example/transitive:a [action 'Action example/transitive/a.a',
configuration:
86d23d2b5aedbeecfc6e6954ea9486ec39e9e40bcbc4b17cec46a06eed198d11, execution
platform: @local_config_platform//:host]
(cd
/root/.cache/bazel/_bazel_root/f8087e59fd95af1ae29e8fcb7ff1a3dc/execroot/com_github_rnburn_bazel_cpp20_modules
&& \
  exec env - \
  /usr/bin/ar rcsD bazel-out/k8-fastbuild/bin/example/transitive/a.a
bazel-out/k8-fastbuild/bin/example/transitive/a.o)
INFO: From Action example/header-module/main.o:
In module imported at example/header-module/main.cc:3:1:
./bazel-out/k8-fastbuild/bin/example/header-module/system/iostream-include/iostream:
error: failed to read compiled module cluster 2: Bad file data
./bazel-out/k8-fastbuild/bin/example/header-module/system/iostream-include/iostream:
note: compiled module file is
'bazel-out/k8-fastbuild/bin/example/header-module/system/iostream.gcm'
./bazel-out/k8-fastbuild/bin/example/header-module/system/iostream-include/iostream:
error: failed to read compiled module cluster 20: Bad file data
example/header-module/main.cc:3:19: internal compiler error: Segmentation fault
3 | import ;
  |   ^
0x10a9ccf crash_signal
../../gcc/toplev.c:327
0xa1bd0f contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
../../gcc/tree.h:3451
0xa1bd0f trees_in::key_mergeable(int, merge_kind, tree_node*, tree_node*,
tree_node*, tree_node*, bool)
../../gcc/cp/module.cc:10716
0xa16b13 trees_in::decl_value()
../../gcc/cp/module.cc:7987
0xa18967 trees_in::tree_node(bool)
../../gcc/cp/module.cc:9202
0xa1f103 module_state::read_cluster(unsigned int)
../../gcc/cp/module.cc:14878
0xa1f60d module_state::load_section(unsigned int, binding_slot*)
../../gcc/cp/module.cc:18018
0xa1f6cf module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/cp/module.cc:18667
0xa197c8 trees_in::tree_node(bool)
../../gcc/cp/module.cc:9713
0xa188d9 trees_in::tree_node(bool)
../../gcc/cp/module.cc:9252
0xa1acd5 trees_in::core_vals(tree_node*)
../../gcc/cp/module.cc:6701
0xa21157 trees_in::tree_node_vals(tree_node*)
../../gcc/cp/module.cc:7131
0xa21157 trees_in::tree_value()
../../gcc/cp/module.cc:8979
0xa1846f trees_in::tree_node(bool)
../../gcc/cp/module.cc:9197
0xa1c01b trees_in::key_mergeable(int, merge_kind, tree_node*, tree_node*,
tree_node*, tree_node*, bool)
../../gcc/cp/module.cc:10795
0xa16b13 trees_in::decl_value()
../../gcc/cp/module.cc:7987
0xa18967 trees_in::tree_node(bool)
../../gcc/cp/module.cc:9202
0xa1f103 module_state::read_cluster(unsigned int)
../../gcc/cp/module.cc:14878
0xa1f60d module_state::load_section(unsigned int, binding_slot*)
../../gcc/cp/module.cc:18018
0xa1f6cf module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/cp/module.cc:18667
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


My gcc version
root@748001480fc4:/src# g++ --version
g++ (GCC) 11.0.0 20201218 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[Bug c/98267] New: internal compiler error: verify_ssa failed

2020-12-13 Thread ryan.burn at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98267

Bug ID: 98267
   Summary: internal compiler error: verify_ssa failed
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Compiling valgrind-3.16.1 fails with the error message below using the latest
version of gcc.

gcc --version
root@929ac6d10aed:/valgrind/valgrind-3.16.1# gcc --version
gcc (GCC) 11.0.0 20201213 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



### Error
m_debuginfo/readpdb.c: In function 'DEBUG_SnarfLinetab':
m_debuginfo/readpdb.c:1631:16: warning: this 'if' clause does not guard...
[-Wmisleading-indentation]
 1631 |if (debug)
  |^~
In file included from ./pub_core_basics.h:38,
 from m_debuginfo/readpdb.c:38:
../include/pub_tool_basics.h:69:30: note: ...this statement, but the latter is
misleadingly indented as if it were guarded by the 'if'
   69 | #define ML_(str)VGAPPEND(vgModuleLocal_,str)
  |  ^~
../include/pub_tool_basics.h:66:29: note: in definition of macro 'VGAPPEND'
   66 | #define VGAPPEND(str1,str2) str1##str2
  | ^~~~
m_debuginfo/readpdb.c:1636:19: note: in expansion of macro 'ML_'
 1636 |   ML_(addLineInfo)(
  |   ^~~
m_debuginfo/readpdb.c: In function 'pdb_dump.constprop':
m_debuginfo/readpdb.c:1902:13: error: definition in block 66 follows the use
 1902 | static void pdb_dump( const struct pdb_reader* pdb,
  | ^~~~
for SSA_NAME: _144 in statement:
_928 = .ADD_OVERFLOW (_142, _144);
during GIMPLE pass: widening_mul
m_debuginfo/readpdb.c:1902:13: internal compiler error: verify_ssa failed
0x5f verify_ssa(bool, bool)
../../gcc/tree-ssa.c:1214
0xd0932d execute_function_todo
../../gcc/passes.c:2049
0xd09c7b execute_todo
../../gcc/passes.c:2096
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.

[Bug libgcc/86215] New: Exceptions are broken on OSX when linking with -static-libgcc

2018-06-19 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86215

Bug ID: 86215
   Summary: Exceptions are broken on OSX when linking with
-static-libgcc
   Product: gcc
   Version: 7.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libgcc
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

If I compile program below with g++-7 main.cpp -static-libgcc -static-libstdc++
and run it on OSX, I get

$ ./a.out
Abort trap: 6
$ echo $?
134

instead of printing abc123 as expected

/// main.cpp
#include 
#include 

int main() try {
  throw std::runtime_error{"abc123"};
  return 0;
} catch (const std::runtime_error& e) {
  std::cout << e.what() << "\n";
  return 0;
}
//


Additional information about the environment

$ uname -a
Darwin Ryans-MacBook-Pro.local 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15
17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64

$ g++-7 --version
g++-7 (Homebrew GCC 7.3.0_1) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See also https://stackoverflow.com/q/50920999/4447365

[Bug c++/82380] New: [concepts] Error when using requires constraint with attributes

2017-09-30 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82380

Bug ID: 82380
   Summary: [concepts] Error when using requires constraint with
attributes
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

I believe the below code should work but it gives me the error:

main.cpp:6:1: error: two consecutive '[' shall only introduce an attribute
before '[' token
 [[nodiscard]] int f(T t) {
 ^

tested with gcc head 8.0.0 201709

///
template 
concept bool C = true;

template 
  requires C
[[nodiscard]] int f(T t) {
  return 22;
}

int main() {
  return 0;
}
///

[Bug c++/81366] New: pragma omp simd reduce(max:m) not vectorizing

2017-07-09 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81366

Bug ID: 81366
   Summary: pragma omp simd reduce(max:m) not vectorizing
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Compiling this code:

###
double max(double* x, int n) {
  double m = 0;
  int i;
#pragma omp simd linear (i) reduction(max:m)
  for (i=0; i<n; ++i) 
m = std::max(x[i], m);
  return m;
}
###

with g++ -fopenmp-simd -march=haswell -O3 -S main.cpp

g++ -v
Using built-in specs.
COLLECT_GCC=/usr/local/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin15.0.0/8.0.0/lto-wrapper
Target: x86_64-apple-darwin15.0.0
Configured with: ../gcc/configure --disable-multilib --enable-languages=c++
--with-gmp=/opt/local --with-libiconv-prefix=/opt/local
Thread model: posix
gcc version 8.0.0 20170610 (experimental) (GCC)

Produces the below unvectorized assembly. Similar code with "+" will work.


LFE1116:
.align 4,0x90
.globl __Z3maxPdi
__Z3maxPdi:
LFB1117:
leaq8(%rsp), %r10
LCFI6:
andq$-32, %rsp
pushq   -8(%r10)
pushq   %rbp
LCFI7:
movq%rsp, %rbp
pushq   %r10
LCFI8:
vmovsd  lC1(%rip), %xmm1
vmovsd  %xmm1, -48(%rbp)
testl   %esi, %esi
jle L13
leal-1(%rsi), %eax
leaq8(%rdi,%rax,8), %rax
.align 4,0x90
L14:
vmovsd  (%rdi), %xmm0
vucomisd%xmm0, %xmm1
jbe L20
addq$8, %rdi
cmpq%rax, %rdi
jne L14
L13:
vmovsd  -48(%rbp), %xmm2
vmaxsd  lC0(%rip), %xmm2, %xmm0
popq%r10
LCFI9:
popq%rbp
leaq-8(%r10), %rsp
LCFI10:
ret
.align 4,0x90
L20:
LCFI11:
addq$8, %rdi
vmovsd  %xmm0, -48(%rbp)
cmpq%rax, %rdi
je  L13
vmovapd %xmm0, %xmm1
jmp L14


[Bug middle-end/81052] ICE in verify_dominators, at dominance.c:1184

2017-06-12 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81052

--- Comment #3 from ryan.burn at gmail dot com ---
The only other gcc I have installed is

g++ (GCC) 7.0.1 20170408 (experimental)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I attached the preprocessed output from that compiler as well if it helps.

[Bug middle-end/81052] ICE in verify_dominators, at dominance.c:1184

2017-06-12 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81052

--- Comment #2 from ryan.burn at gmail dot com ---
Created attachment 41538
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41538=edit
old compiler preprocessed

[Bug c++/81052] New: ICE in verify_dominators, at dominance.c:1184

2017-06-10 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81052

Bug ID: 81052
   Summary: ICE in verify_dominators, at dominance.c:1184
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 41535
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41535=edit
preprocessed code

Using gcc:
g++ (GCC) 8.0.0 20170610 (experimental)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Running
g++ -std=c++1z -fconcepts -fopenmp-simd ice.cpp
with the attached file produces this ICE:

/Users/rnickb/proj/satyr/include/satyr/serial_for.h:40:6: error: dominator of
10 should be 11, not 2
 bool for_with_cancel(Policy policy, index_t first, index_t last, F f) {
  ^~~
during GIMPLE pass: ompexp
/Users/rnickb/proj/satyr/include/satyr/serial_for.h:40:6: internal compiler
error: in verify_dominators, at dominance.c:1184

during GIMPLE pass: ompexp
/Users/rnickb/proj/satyr/include/satyr/serial_for.h:40:6: internal compiler
error: Abort trap: 6
g++: internal compiler error: Abort trap: 6 (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.

[Bug c++/80967] ICE in tsubst_decomp_names, at cp/pt.c:15660

2017-06-04 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80967

--- Comment #2 from ryan.burn at gmail dot com ---
That's built from trunk only less than 2 months ago. Are you certain this is
invalid? Did you actually try to reproduce?

[Bug c++/80967] New: ICE in tsubst_decomp_names, at cp/pt.c:15660

2017-06-03 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80967

Bug ID: 80967
   Summary: ICE in tsubst_decomp_names, at cp/pt.c:15660
   Product: gcc
   Version: c++-concepts
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 41466
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41466=edit
preprocessed code

Running with trunk:
g++ (GCC) 7.0.1 20170408 (experimental)
to reproduce run attached file with
g++ -std=c++1z -fconcepts bug.cpp

This is the full output:

/Users/rnickb/proj/satyr/linear_algebra/test/test_blas_lapack.cpp:17:24:  
required from ‘void test_product(const A&, const X&) [with A =
satyr::n_array<double, 2, satyr::symmetric_structure>; X =
satyr::n_array<double, 1, satyr::general_structure>]’
/Users/rnickb/proj/satyr/linear_algebra/test/test_blas_lapack.cpp:56:20:  
required from here
/Users/rnickb/proj/satyr/linear_algebra/include/satyr/linear_algebra/matrix_accessor.h:19:10:
internal compiler error: in tsubst_decomp_names, at cp/pt.c:15660
 auto [s, t] = std::minmax(i, j);
  ^~

/Users/rnickb/proj/satyr/linear_algebra/include/satyr/linear_algebra/matrix_accessor.h:19:10:
internal compiler error: Abort trap: 6
g++: internal compiler error: Abort trap: 6 (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
MacBook-Pro-3:structbind rnickb$ ls
bug.cpp.bz2 main.cpp

[Bug c++/80637] New: [concepts] incorrect ambiguous overload

2017-05-04 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80637

Bug ID: 80637
   Summary: [concepts] incorrect ambiguous overload
   Product: gcc
   Version: c++-concepts
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

This code won't compile with GCC

/
template 
struct A {
  void f() 
requires std::is_same_v<T, int>
  {
  }

  void f(int) 
requires !std::is_same_v<T, int>
  {
  }
};

int main() {
  auto fptr = ::f;
  return 0;
}
/

According to the discussion here, it should be valid:

http://stackoverflow.com/q/43793941/4447365

[Bug c++/78073] New: inherited initializer_list constructor is not accessible

2016-10-21 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78073

Bug ID: 78073
   Summary: inherited initializer_list constructor is not
accessible
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code should compile but gives this error with g++ built from trunk
(20161022).

main.cpp: In function ‘int main()’:
main.cpp:12:13: error: could not convert ‘2.0e+0’ from ‘double’ to ‘A’
   B b = {2.0};
 ^



#include 

struct A {
  A(std::initializer_list) {}
};

struct B : A {
  using A::A;
};

int main() {
  B b = {2.0};
  return 0;
}


[Bug c++/77811] New: [concepts] invalid redefinition error when declaring friend function

2016-09-30 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77811

Bug ID: 77811
   Summary: [concepts] invalid redefinition error when declaring
friend function
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code should be valid but gives this error when compiling with gcc
(7.0.0 201609)

prog.cc: In instantiation of 'struct B':
prog.cc:22:20:   required from here
prog.cc:16:14: error: redefinition of 'template int f(const S&)'
   friend int f(const S& s) {

/
#include 

template
struct A {
  template 
requires std::is_same<S, A>::value
  friend int f(const S& s) {
return 0;
  }
};

template 
struct B {
  template 
requires std::is_same<S, B>::value
  friend int f(const S& s) {
return 1;
  }
};

int main() {
  A a; B b;
  int x = f(a);
  int y = f(b);
  return 0;
}
/

[Bug c++/71209] New: [c++] erroneous 'is not a base class of' error

2016-05-19 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71209

Bug ID: 71209
   Summary: [c++] erroneous 'is not a base class of' error
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code compiles fine with clang and a version of gcc build from trunk
on 20160428, but with the trunk version from 20160519, it gives this bad error
message:

 B::B()
a.cpp:7:18: error: ‘A’ is not a base of ‘B’
   B() { this->A::table_clear; }

The bugs causing major libraries like intel's TBB not to compile.

//
class A {   
  int table_clear;  
};  

template
class B : T {   
  B() { this->A::table_clear; } 
};  

int main() {} 
//

[Bug c++/70862] [concepts] adding a concept-constrained version of a variable template causes multiple definition assembler error

2016-05-15 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70862

--- Comment #3 from ryan.burn at gmail dot com ---
It's a different bug. The test case from 70095 compiles fine with the trunk
from 20160428, but the above example won't.

[Bug c++/63142] gcc-cilk can not spawn a function template

2016-04-28 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63142

ryan.burn at gmail dot com changed:

   What|Removed |Added

 CC||ryan.burn at gmail dot com

--- Comment #2 from ryan.burn at gmail dot com ---
I checked and this looks like it compiles fine with gcc7.

[Bug other/69582] [meta-bug] Cilk+

2016-04-28 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69582

--- Comment #6 from ryan.burn at gmail dot com ---
There's also some issues with cilk features and precompiled headers. I put in
70865 to track.

[Bug c++/70865] New: [cilkplus] errors when using cilk features with precompiled headers

2016-04-28 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70865

Bug ID: 70865
   Summary: [cilkplus] errors when using cilk features with
precompiled headers
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 38372
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38372=edit
example that reproduces the problem

Using cilk features in a precompiled header file causes various compilation
bugs if the options "-std=c++1z" and "-fconcepts" are also used. I attached an
example that reproduces the bug. The code should compile fine (and does so, if
not using a pch or not using cilk features), but depending on what options are
used, gcc produces these different errors.

Using both "-std=c++1z -fconcepts -fcilkplus" (reproduced with Makefile),
causes the error:

cc1plus: error: using result of function returning ‘void’
(null):0: confused by earlier errors, bailing out
make: *** [a] Error 1



Using just "-std=c++1z" (Makefile.v2), causes the error:

cc1plus: internal compiler error: Segmentation fault
0xb45bff crash_signal
../../gcc/gcc/toplev.c:333
0x95565c gimplify_call_expr
../../gcc/gcc/gimplify.c:2486
0x94d339 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc/gcc/gimplify.c:10258
0x95a381 force_gimple_operand_1(tree_node*, gimple**, bool (*)(tree_node*),
tree_node*)
../../gcc/gcc/gimplify-me.c:78
0x95a47f force_gimple_operand_gsi_1(gimple_stmt_iterator*, tree_node*, bool
(*)(tree_node*), tree_node*, bool, gsi_iterator_update)
../../gcc/gcc/gimplify-me.c:115
0xa5a757 expand_task_call
../../gcc/gcc/omp-low.c:6865
0xa5a757 expand_omp_taskreg
../../gcc/gcc/omp-low.c:7423
0xa6103f expand_omp
../../gcc/gcc/omp-low.c:13799
0xa637ad execute_expand_omp
../../gcc/gcc/omp-low.c:14028
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
make: *** [a] Error 1

[Bug middle-end/65960] ICE in Cilk spawn with argument with non-trivial constructor

2016-04-28 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65960

ryan.burn at gmail dot com changed:

   What|Removed |Added

 CC||ryan.burn at gmail dot com

--- Comment #2 from ryan.burn at gmail dot com ---
This should be fixed now. I just checked with gcc-7.

[Bug c++/70862] [concepts] adding a concept-constrained version of a variable template causes multiple definition assembler error

2016-04-28 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70862

--- Comment #1 from ryan.burn at gmail dot com ---
Simpler reproduction:

template 
concept bool C = true;

template 
constexpr bool a = false;

template 
  requires C
constexpr bool a = true;

template 
  requires a
void f(Tx...) {
}

int main() {
  f();
  f(3);
  return 0;
}

[Bug c++/70862] New: [concepts] adding a concept-constrained version of a variable template causes multiple definition assembler error

2016-04-28 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70862

Bug ID: 70862
   Summary: [concepts] adding a concept-constrained version of a
variable template causes multiple definition assembler
error
   Product: gcc
   Version: 7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 38369
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38369=edit
reproduces the bug

The attached code should be valid and compiles with an older version of gcc
(20160120), but now breaks with (20160428) giving the following error:

/tmp/ccthKyXf.s: Assembler messages:
/tmp/ccthKyXf.s:269: Error: symbol
`_ZN4echo3htl14detail_conceptL23mappable_predicate_implE' is already defined

[Bug other/69582] [meta-bug] Cilk+

2016-02-11 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69582

--- Comment #5 from ryan.burn at gmail dot com ---
My copyright assignment should be set up now. Thanks.

[Bug other/69582] [meta-bug] Cilk+

2016-02-04 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69582

ryan.burn at gmail dot com changed:

   What|Removed |Added

 CC||ryan.burn at gmail dot com

--- Comment #3 from ryan.burn at gmail dot com ---
There's also 69024, 69021, and 69017.

This patch (https://gcc.gnu.org/ml/gcc-patches/2016-01/msg01560.html) a few of
them.

[Bug c++/69362] New: ICE when doing a pragma reduction with the wrong variable

2016-01-19 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69362

Bug ID: 69362
   Summary: ICE when doing a pragma reduction with the wrong
variable
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code when compiled with -fcilkplus gives the following ICE:

main.cpp: In function ‘double t1(double*, int)’:
main.cpp:4:3: internal compiler error: in build2_stat, at tree.c:4433
   for(int i=0; i<N; ++i) {
   ^~~

0xf90323 build2_stat(tree_code, tree_node*, tree_node*, tree_node*)
../../src/gcc/tree.c:4432
0xc05d27 lower_rec_input_clauses
../../src/gcc/omp-low.c:5197
0xc0aaef lower_omp_for
../../src/gcc/omp-low.c:14449
0xbfaa66 lower_omp_1
../../src/gcc/omp-low.c:16349
0xbfaa66 lower_omp
../../src/gcc/omp-low.c:16481
0xbfa6ad lower_omp_1
../../src/gcc/omp-low.c:16334
0xbfa6ad lower_omp
../../src/gcc/omp-low.c:16481
0xbfa6ad lower_omp_1
../../src/gcc/omp-low.c:16334
0xbfa6ad lower_omp
../../src/gcc/omp-low.c:16481
0xc019e9 execute_lower_omp
../../src/gcc/omp-low.c:16519
0xc019e9 execute
../../src/gcc/omp-low.c:16556
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


double t1(double* x, int N) {
  double result = 0;
#pragma simd reduction(+:x)
  for(int i=0; i<N; ++i) {
result += x[i];
  }
  return result;
}


[Bug c++/69364] New: [concepts] failure to properly order constraints when using fold expressions

2016-01-19 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69364

Bug ID: 69364
   Summary: [concepts] failure to properly order constraints when
using fold expressions
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code produces an ambiguous overload error.

I'm not completely sure if the concept-lite standard dictates that it should
compile (see discussion:
http://stackoverflow.com/questions/34843745/how-are-fold-expressions-used-in-the-partial-ordering-of-constraints),
but it seems like it ought to work.

///
#include 
#include 

template  concept bool A = std::is_move_constructible::value;
template  concept bool B = std::is_copy_constructible::value;

template  concept bool C = A && B;

template 
  requires A<_a> && A<_b>
void f(_a a, _b b) {
  std::cout << "a\n";
}

template 
  requires C<_a> && C<_b>
void f(_a a, _b b) {
  std::cout << "c\n";
}

template 
  requires (A<_tx> && ...)
void g(_tx... tx) {
  std::cout << "a\n";
}

template 
  requires (C<_tx> && ...)
void g(_tx... tx) {
  std::cout << "c\n";
}

int main() {
  f(3, 7.0); // works with no fold expressions
  g(3, 7.0); // ambiguous overload error

  return 0;
}
///

[Bug c++/69363] New: ICE when doing a pragma simd reduction with max

2016-01-19 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69363

Bug ID: 69363
   Summary: ICE when doing a pragma simd reduction with max
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code causes this ICE:

rnburn@localhost ~/test/cilk_reduction $ /usr/local/experimental/bin/g++
-fcilkplus -O3 -march=native -c -S bug.cpp
bug.cpp: In function ‘double t1(double*, int)’:
bug.cpp:7:3: internal compiler error: Segmentation fault
   for(int i=0; i<N; ++i) {
   ^~~

0xcfba0f crash_signal
../../src/gcc/toplev.c:334
0xab2451 omp_add_variable
../../src/gcc/gimplify.c:5715
0xac523e gimplify_scan_omp_clauses
../../src/gcc/gimplify.c:7156
0xab637a gimplify_omp_for
../../src/gcc/gimplify.c:8369
0xabe54e gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.c:10561
0xac1436 gimplify_stmt(tree_node**, gimple**)
../../src/gcc/gimplify.c:5598
0xac260d gimplify_bind_expr
../../src/gcc/gimplify.c:1139
0xabc772 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.c:10295
0xac1436 gimplify_stmt(tree_node**, gimple**)
../../src/gcc/gimplify.c:5598
0xabd80b gimplify_statement_list
../../src/gcc/gimplify.c:1520
0xabd80b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.c:10513
0xac1436 gimplify_stmt(tree_node**, gimple**)
../../src/gcc/gimplify.c:5598
0xac260d gimplify_bind_expr
../../src/gcc/gimplify.c:1139
0xabc772 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src/gcc/gimplify.c:10295
0xac1436 gimplify_stmt(tree_node**, gimple**)
../../src/gcc/gimplify.c:5598
0xac3269 gimplify_body(tree_node*, bool)
../../src/gcc/gimplify.c:11227
0xac3896 gimplify_function_tree(tree_node*)
../../src/gcc/gimplify.c:11383
0x9444d7 cgraph_node::analyze()
../../src/gcc/cgraphunit.c:623
0x947a59 analyze_functions
../../src/gcc/cgraphunit.c:1078
0x948968 symbol_table::finalize_compilation_unit()
../../src/gcc/cgraphunit.c:2518
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

//
#include 

double t1(double* x, int N) {
  double result = 0;
  int i;
#pragma simd reduction(max:result) private(i)
  for(int i=0; i<N; ++i) {
result = std::fmax(x[i], result);
  }
  return result;
}
//

[Bug c++/69267] New: [cilkplus] ICE when calling a function with an empty class as an argument

2016-01-13 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69267

Bug ID: 69267
   Summary: [cilkplus] ICE when calling a function with an empty
class as an argument
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code generates this ICE:

prog.cc: In function 'void g()':
prog.cc:6:21: internal compiler error: in gimplify_expr, at gimplify.c:11058
   _Cilk_spawn f(A{});
 ^

0x8cd198 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/heads/gcc/gcc-source/gcc/gimplify.c:11058
0x74a26a cilk_gimplify_call_params_in_spawned_fn(tree_node**, gimple**,
gimple**)
/home/heads/gcc/gcc-source/gcc/c-family/cilk.c:796
0x6df107 cilk_cp_gimplify_call_params_in_spawned_fn
/home/heads/gcc/gcc-source/gcc/cp/cp-gimplify.c:101
0x6e17b5 cp_gimplify_expr(tree_node**, gimple**, gimple**)
/home/heads/gcc/gcc-source/gcc/cp/cp-gimplify.c:755
0x8c9c75 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/heads/gcc/gcc-source/gcc/gimplify.c:10023
0x8cd336 gimplify_stmt(tree_node**, gimple**)
/home/heads/gcc/gcc-source/gcc/gimplify.c:5616
0x8ca548 gimplify_cleanup_point_expr
/home/heads/gcc/gcc-source/gcc/gimplify.c:5392
0x8ca548 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/heads/gcc/gcc-source/gcc/gimplify.c:10479
0x8cd336 gimplify_stmt(tree_node**, gimple**)
/home/heads/gcc/gcc-source/gcc/gimplify.c:5616
0x8cb082 gimplify_and_add(tree_node*, gimple**)
/home/heads/gcc/gcc-source/gcc/gimplify.c:425
0x8cb082 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/heads/gcc/gcc-source/gcc/gimplify.c:10453
0x8cd336 gimplify_stmt(tree_node**, gimple**)
/home/heads/gcc/gcc-source/gcc/gimplify.c:5616
0x8cb98b gimplify_statement_list
/home/heads/gcc/gcc-source/gcc/gimplify.c:1526
0x8cb98b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/heads/gcc/gcc-source/gcc/gimplify.c:10531
0x8cd336 gimplify_stmt(tree_node**, gimple**)
/home/heads/gcc/gcc-source/gcc/gimplify.c:5616
0x8ce586 gimplify_body(tree_node*, bool)
/home/heads/gcc/gcc-source/gcc/gimplify.c:11245
0x8ce8f7 gimplify_function_tree(tree_node*)
/home/heads/gcc/gcc-source/gcc/gimplify.c:11401
0x7b0057 cgraph_node::analyze()
/home/heads/gcc/gcc-source/gcc/cgraphunit.c:625
0x7b2a7f analyze_functions
/home/heads/gcc/gcc-source/gcc/cgraphunit.c:1080
0x7b3258 symbol_table::finalize_compilation_unit()
/home/heads/gcc/gcc-source/gcc/cgraphunit.c:2531
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


struct A {};

void f(A) {}

void g() {
  _Cilk_spawn f(A{});
}

int main() {
  return 0;
}


[Bug c++/69091] New: valid code with operator| causes ICE "tree check: accessed elt 2 of tree_vec with 1 elts in tsubst, at cp/pt.c:12851"

2015-12-30 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69091

Bug ID: 69091
   Summary: valid code with operator| causes ICE "tree check:
accessed elt 2 of tree_vec with 1 elts in tsubst, at
cp/pt.c:12851"
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code compiles fine with clang  but causes this ICE with gcc
g++ (GCC) 6.0.0 20151222 (experimental)



bug.cpp:5:6: internal compiler error: tree check: accessed elt 2 of tree_vec
with 1 elts in tsubst, at cp/pt.c:12851
 auto operator|(Option<ValueType, Value>, OptionsRhs) {
  ^~~~

0xf7ac05 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
../../src-fix/gcc/tree.c:9802
0x6aff39 tree_vec_elt_check(tree_node const*, int, char const*, int, char
const*)
../../src-fix/gcc/tree.h:3445
0x678dd7 tsubst(tree_node*, tree_node*, int, tree_node*)
../../src-fix/gcc/cp/pt.c:12851
0x66f740 tsubst_copy
../../src-fix/gcc/cp/pt.c:13949
0x674e68 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../src-fix/gcc/cp/pt.c:16088
0x669d88 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src-fix/gcc/cp/pt.c:15658
0x68ed4a tsubst_template_args
../../src-fix/gcc/cp/pt.c:11108
0x681d9a tsubst_decl
../../src-fix/gcc/cp/pt.c:11607
0x678807 tsubst(tree_node*, tree_node*, int, tree_node*)
../../src-fix/gcc/cp/pt.c:12695
0x66fd7e tsubst_copy
../../src-fix/gcc/cp/pt.c:13865
0x674e68 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../src-fix/gcc/cp/pt.c:16088
0x67547b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../src-fix/gcc/cp/pt.c:16326
0x669d88 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src-fix/gcc/cp/pt.c:15658
0x667f07 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src-fix/gcc/cp/pt.c:14974
0x669b88 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../src-fix/gcc/cp/pt.c:15146
0x6a8eb6 instantiate_decl(tree_node*, int, bool)
../../src-fix/gcc/cp/pt.c:21810
0x6afbeb instantiate_pending_templates(int)
../../src-fix/gcc/cp/pt.c:21927
0x6f08e1 c_parse_final_cleanups()
../../src-fix/gcc/cp/decl2.c:4589
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


//
template 
struct Option {};

template 
auto operator|(Option<ValueType, Value>, OptionsRhs) {
  return Value;
}

enum canine_t { no, yes };
Option<canine_t, no> cat;
Option<canine_t, yes> dog;

template 
void f(T) {
  cat | dog;
}

struct A {};
int main() { 
  f(A{}); 
  return 0;
}
//

[Bug c++/69048] New: [cilkplus] bug when spawning a function that returns a type with a destructor

2015-12-24 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69048

Bug ID: 69048
   Summary: [cilkplus] bug when spawning a function that returns a
type with a destructor
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code generates this ICE:

In function ‘’:
cc1plus: internal compiler error: in verify_gimple_stmt, at tree-cfg.c:4603
0xd2f403 verify_gimple_stmt
../../src-fix/gcc/tree-cfg.c:4603
0xd312b7 verify_gimple_in_seq_2
../../src-fix/gcc/tree-cfg.c:4718
0xd31238 verify_gimple_in_seq_2
../../src-fix/gcc/tree-cfg.c:4691
0xd31238 verify_gimple_in_seq_2
../../src-fix/gcc/tree-cfg.c:4691
0xd35ee1 verify_gimple_in_seq(gimple*)
../../src-fix/gcc/tree-cfg.c:4748
0xac3332 gimplify_body(tree_node*, bool)
../../src-fix/gcc/gimplify.c:11295
0xac36c6 gimplify_function_tree(tree_node*)
../../src-fix/gcc/gimplify.c:11383
0xd90df2 gimplify_all_functions
../../src-fix/gcc/tree-nested.c:3104
0xd90dd7 gimplify_all_functions
../../src-fix/gcc/tree-nested.c:3106
0xd991f6 lower_nested_functions(tree_node*)
../../src-fix/gcc/tree-nested.c:3123
0x944133 cgraph_node::analyze()
../../src-fix/gcc/cgraphunit.c:630
0x9478a9 analyze_functions
../../src-fix/gcc/cgraphunit.c:1079
0x9487b8 symbol_table::finalize_compilation_unit()
../../src-fix/gcc/cgraphunit.c:2519
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


/
struct A {  
  ~A() {}   
};  

A f() { 
  return {};
}   

int main() {
  _Cilk_spawn f();  
  return 0; 
}
/

[Bug c++/69021] New: [cilkplus] valid cilk_spawn won't compile when invoking non-trivial assignment operator

2015-12-22 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69021

Bug ID: 69021
   Summary: [cilkplus] valid cilk_spawn won't compile when
invoking non-trivial assignment operator
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code gives this error but should compile:

prog.cc: In function 'void g()':
prog.cc:12:21: error: invalid use of '_Cilk_spawn'
   a = _Cilk_spawn f();

//
struct A {  
  A() = default;
  A& operator=(const A&) { 
  return *this;
  } 
};  

A f() { return {}; }

void g() {  
  A a;  
  a = _Cilk_spawn f();  
}
//

[Bug c++/69024] New: [cilkpus] cilk_spawn is broken for initializations with implicit conversion operators defined

2015-12-22 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69024

Bug ID: 69024
   Summary: [cilkpus] cilk_spawn is broken for initializations
with implicit conversion operators defined
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The following code should compile but gives this error:

implicit_cast.cpp: In function ‘void g()’:
implicit_cast.cpp:12:28: error: invalid use of ‘_Cilk_spawn’
   double x = _Cilk_spawn f();

/
struct A {
  operator double() {
return 33.0;
  }
};

A f() {
  return {};
}

void g() {
  double x = _Cilk_spawn f();
}

int main() {
  g();
  return 0;
}
/

[Bug c++/69017] New: [cilkplus] ICE with valid cilk_spawn

2015-12-22 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69017

Bug ID: 69017
   Summary: [cilkplus] ICE with valid cilk_spawn
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below valid code causes this ICE:

t1.cpp: In function ‘void g()’:
t1.cpp:18:22: internal compiler error: gimplification failed
   b = _Cilk_spawn f2();
  ^

0xd6388a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src-fix/gcc/gimplify.c:11047
0xd493c6 gimplify_addr_expr
../../src-fix/gcc/gimplify.c:5075
0xd60829 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src-fix/gcc/gimplify.c:10162
0xd4b2fd gimplify_stmt(tree_node**, gimple**)
../../src-fix/gcc/gimplify.c:5616
0xd48e5e gimplify_compound_expr
../../src-fix/gcc/gimplify.c:4943
0xd48de0 gimplify_compound_expr
../../src-fix/gcc/gimplify.c:4930
0xd6049b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src-fix/gcc/gimplify.c:10105
0xd4b2fd gimplify_stmt(tree_node**, gimple**)
../../src-fix/gcc/gimplify.c:5616
0xd4a9e5 gimplify_cleanup_point_expr
../../src-fix/gcc/gimplify.c:5392
0xd61c92 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src-fix/gcc/gimplify.c:10481
0xd4b2fd gimplify_stmt(tree_node**, gimple**)
../../src-fix/gcc/gimplify.c:5616
0xd3c296 gimplify_statement_list
../../src-fix/gcc/gimplify.c:1526
0xd62039 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src-fix/gcc/gimplify.c:10533
0xd4b2fd gimplify_stmt(tree_node**, gimple**)
../../src-fix/gcc/gimplify.c:5616
0xd38d23 gimplify_and_add(tree_node*, gimple**)
../../src-fix/gcc/gimplify.c:425
0xd619a9 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src-fix/gcc/gimplify.c:10455
0xd4b2fd gimplify_stmt(tree_node**, gimple**)
../../src-fix/gcc/gimplify.c:5616
0xd3c296 gimplify_statement_list
../../src-fix/gcc/gimplify.c:1526
0xd62039 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../src-fix/gcc/gimplify.c:10533
0xd4b2fd gimplify_stmt(tree_node**, gimple**)
../../src-fix/gcc/gimplify.c:5616
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

///
struct A {  
  A() = default;
  A(const A&) {}
};  

struct B {  
  B() = default;

  B& operator=(A a) {   
  } 
};  

B f() { return {}; }

void g() {  
  B b;  
  b = _Cilk_spawn f();  
}   

int main() {
  g();  
  return 0; 
}  
///

[Bug c++/69017] [cilkplus] ICE with valid cilk_spawn

2015-12-22 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69017

--- Comment #1 from ryan.burn at gmail dot com ---
Better example:
struct B {  
};  

B f() { return {}; }

void g() {  
  B b;  
  b = _Cilk_spawn f();  
}   

int main() {
  g();  
  return 0; 
}

[Bug c++/68997] New: [cilkplus] cilk_spawn is broken for functions that return a type with a custom copy or move constructor

2015-12-20 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68997

Bug ID: 68997
   Summary: [cilkplus] cilk_spawn is broken for functions that
return a type with a custom copy or move constructor
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code should be valid but gives this error:

main.cpp: In function ‘void compute_cilk()’:
main.cpp:15:26: error: invalid use of ‘_Cilk_spawn’
   auto v1 = cilk_spawn f();
  ^


#include   
#include   

struct A {  
  A() = default;

  A(const A&) {} // uncomment and it works  

  // A(A &&) {} // broken for move constructors also
};  

A f() { 
  return A{};   
}   

void compute_cilk() {   
  auto v1 = cilk_spawn f(); 
  auto v2 = f();
  cilk_sync;
}   

int main() {
  compute_cilk();   
  return 0; 
} 


[Bug c++/68985] New: braced initializer bug when defining a static constexpr int within a class

2015-12-18 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68985

Bug ID: 68985
   Summary: braced initializer bug when defining a static
constexpr int within a class
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The follow code compiles fine with clang
(http://melpon.org/wandbox/permlink/VNNQJW7whi3CmEKH) but gives this error with
gcc:

prog.cc:12:39: error: cannot convert 'my_t<I, T>' to 'const int' in
initialization
   static constexpr int x = my_t<I, T>{};
   ^


template 
struct A{   
  constexpr operator int() { return I; }
};  

template
using my_t = A;  

template
class B {   
 public:
  static constexpr int x = my_t<I, T>{};
};  

int main() {
  return 0; 
} 


[Bug c++/68429] [concepts] ICE in in placeholder_extract_concept_and_args, at cp/constraint.cc:1401

2015-12-07 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68429

--- Comment #1 from ryan.burn at gmail dot com ---
Additional case. (not sure if it's the same bug)

namespace std { 
typedef int size_t; 
template 
struct A {  
  static constexpr _Tp value = __v; 
  typedef _Tp value_type;   
};  
typedef A<bool, true> true_type;
template <bool, typename, typename> 
struct conditional {
  using type = int; 
};  

struct B : true_type {};
template  
struct is_integral {
  static constexpr bool value = true;   
};  

template <typename, typename>   
struct is_same  {   
  static constexpr bool value = true;   
};  

}   
template
concept bool Same = std::is_same<T, U>::value;  

template
concept bool Integral = requires{{T()}->Same};  

template  
struct compose; 

template   
constexpr typename T::value_type _v = T::value; 
template
using size_t = std::A<long, N>; 
template
using bool_ = std::A<bool, B>;  
template
using apply = typename Fn::template apply; 
namespace detail {  
template  class C, typename... Ts>   
struct defer_ { 
  using type = C;
};  
}   
template  class C, typename... Ts>   
struct defer : detail::defer_<C, Ts...> {}; 
template 
struct compose {   
  template  
  using apply = apply<Fn0, Ts...>;  
};  
template   
struct compose<Fn0, Fns...> {   
  template  
  using apply = apply<Fn0, apply<compose, Ts...>>;  
};  
template  class C>   
struct quote {  
  template  
  using apply = typename defer<C, Ts...>::type; 
};  
namespace detail {  
template   
struct _if_;
template   

[Bug c++/68683] [concepts] function satisfy_argument_deduction_constraint modifies a type tree node but leaves TYPE_CANONICAL unchanged

2015-12-07 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68683

ryan.burn at gmail dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from ryan.burn at gmail dot com ---
fixed with 231385

[Bug c++/68719] New: [concepts] placeholder deduction doesn't work for member functions

2015-12-05 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68719

Bug ID: 68719
   Summary: [concepts] placeholder deduction doesn't work for
member functions
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code should compile but gives this error with gcc 20151123:

main.cpp: In function ‘int main()’:
main.cpp:7:3: error: expected primary-expression before ‘double’
   double (auto::*fptr)(int) = ::f;
   ^~

//
struct A {   
  double f(int i) {   
  }   
};   

int main() {   
  double (auto::*fptr)(int) = ::f;   
  return 0;   
}
//

[Bug c++/68731] New: [concepts] ICE when referencing struct type in specialization

2015-12-05 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68731

Bug ID: 68731
   Summary: [concepts] ICE when referencing struct type in
specialization
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code segfaults with g++ 20151123

///
template 
struct a_type {
};

template 
  requires !requires { typename a_type::type; }
struct a_type {
  using type = T;
};

int main() {
  a_type a;
  return 0;
}
///

[Bug c++/68434] [concepts] ICE: same canonical type node for different types

2015-12-03 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68434

--- Comment #5 from ryan.burn at gmail dot com ---
reduction for the other test case:

template <typename, typename>   
struct is_same  {   
  static constexpr bool value = true;   
};  

template
concept bool Same = is_same<T, U>::value;   

template
concept bool Integral = requires{   
  { T() } -> Same;  
};  

struct A {  
  using value_type = bool;  
};  

template
using not_ = A; 

int main() {
  Integral<not_>;
  return 0; 
}

[Bug c++/68434] [concepts] function tsubst sets TYPE_CANONICAL before setting a type's PLACEHOLDER_TYPE_CONSTRAINTS

2015-12-03 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68434

ryan.burn at gmail dot com changed:

   What|Removed |Added

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

--- Comment #6 from ryan.burn at gmail dot com ---
fixed with 230909. I put in 68683 for the other test case that's caused by a
different problem with the satisfy_argument_deduction_constraint function.

[Bug c++/68290] g++.dg/concepts/auto1.C FAILs

2015-12-03 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68290
Bug 68290 depends on bug 68434, which changed state.

Bug 68434 Summary: [concepts] function tsubst sets TYPE_CANONICAL before 
setting a type's PLACEHOLDER_TYPE_CONSTRAINTS
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68434

   What|Removed |Added

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

[Bug c++/67491] [meta-bug] concepts issues

2015-12-03 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
Bug 67491 depends on bug 68434, which changed state.

Bug 68434 Summary: [concepts] function tsubst sets TYPE_CANONICAL before 
setting a type's PLACEHOLDER_TYPE_CONSTRAINTS
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68434

   What|Removed |Added

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

[Bug c++/68683] New: [concepts] function satisfy_argument_deduction_constraint modifies a type tree node but leaves TYPE_CANONICAL unchanged

2015-12-03 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68683

Bug ID: 68683
   Summary: [concepts] function
satisfy_argument_deduction_constraint modifies a type
tree node but leaves TYPE_CANONICAL unchanged
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code causes a "same canonical type node for different types" ICE
because the function satisfy_argument_deduction_constraint changes the
PLACEHOLDER_TYPE_CONSTRAINTS for a tree node but leaves the TYPE_CANONICAL
value unchanged. Since PLACEHOLDER_TYPE_CONSTRAINTS are used when checking for
equality, \ the TYPE_CANONICAL value is no longer valid for the changed type
which triggers the ICE.

///
template <typename, typename>   
struct is_same  {   
  static constexpr bool value = true;   
};  

template
concept bool Same = is_same<T, U>::value;   

template
concept bool Integral = requires{   
  { T() } -> Same;  
};  

struct A {  
  using value_type = bool;  
};  

int main() {
  Integral;  
  Integral;  
  return 0; 
}
///

[Bug c++/68608] New: [concepts] ICE with with explicit class instantiation

2015-11-29 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68608

Bug ID: 68608
   Summary: [concepts] ICE with with explicit class instantiation
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code causes this ICE when compiled with

rnburn@localhost ~/test/explicit_concept $ g++17 --version
g++ (GCC) 6.0.0 20151123 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

main.cpp:13:23: error: Two symbols with same comdat_group are not linked by the
same_comdat_group list.
 template struct A;
   ^

_ZN1AIiE1fEv/2 (int A::f() requires predicate(!(C)) [with T = int])
@0x7f63087cf2e0
  Type: function definition analyzed
  Visibility: forced_by_abi public weak comdat_group:_ZN1AIiE1fEv one_only
  previous sharing asm name: 1
  References: 
  Referring: 
  First run: 0
  Function flags: body
  Called by: 
  Calls: 
_ZN1AIiE1fEv/1 (int A::f() requires predicate( C) [with T = int])
@0x7f63087cf170
  Type: function definition analyzed
  Visibility: forced_by_abi public weak comdat_group:_ZN1AIiE1fEv one_only
  next sharing asm name: 2
  References: 
  Referring: 
  First run: 0
  Function flags: body
  Called by: 
  Calls: 
main.cpp:13:23: internal compiler error: symtab_node::verify failed
0x934e59 symtab_node::verify_symtab_nodes()
../../src-fix/gcc/symtab.c:1120
0x94823b symtab_node::checking_verify_symtab_nodes()
../../src-fix/gcc/cgraph.h:566
0x94823b symbol_table::compile()
../../src-fix/gcc/cgraphunit.c:2358
0x94a952 symbol_table::compile()
../../src-fix/gcc/cgraphunit.c:2514
0x94a952 symbol_table::finalize_compilation_unit()
../../src-fix/gcc/cgraphunit.c:2540
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


///
template  concept constexpr bool C = true;

template 
struct A {
  int f() requires C { return 1; }
  int f() requires !C { return 2; }
};

int main() {
  return 0;
}

template struct A;
///

[Bug c++/68597] ice inin check_return_expr, at cp/typeck.c:8635

2015-11-28 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68597

--- Comment #1 from ryan.burn at gmail dot com ---
This looks similar to 67846, but the fix from that bug was already put in and I
verified its test case works.

[Bug c++/68597] New: ice inin check_return_expr, at cp/typeck.c:8635

2015-11-28 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68597

Bug ID: 68597
   Summary: ice inin check_return_expr, at cp/typeck.c:8635
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Below code causes this stack trace when compiled with -std=c++1z when compiled
with

rnburn@localhost ~/bugs/lambda_check_return $ g++17 --version
g++ (GCC) 6.0.0 20151123 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

main.cpp: In lambda function:
main.cpp:19:35: internal compiler error: in check_return_expr, at
cp/typeck.c:8635
   return 1 / beta * (alpha - 1);
   ^

0x75f9dd check_return_expr(tree_node*, bool*)
../../src-fix/gcc/cp/typeck.c:8635
0x79bfae finish_return_stmt(tree_node*)
../../src-fix/gcc/cp/semantics.c:867
0x73a6dd cp_parser_jump_statement
../../src-fix/gcc/cp/parser.c:11414
0x73a6dd cp_parser_statement
../../src-fix/gcc/cp/parser.c:10035
0x74239f cp_parser_implicitly_scoped_statement
../../src-fix/gcc/cp/parser.c:11527
0x73aab1 cp_parser_selection_statement
../../src-fix/gcc/cp/parser.c:10555
0x73aab1 cp_parser_statement
../../src-fix/gcc/cp/parser.c:10010
0x74239f cp_parser_implicitly_scoped_statement
../../src-fix/gcc/cp/parser.c:11527
0x73aab1 cp_parser_selection_statement
../../src-fix/gcc/cp/parser.c:10555
0x73aab1 cp_parser_statement
../../src-fix/gcc/cp/parser.c:10010
0x73ae41 cp_parser_statement_seq_opt
../../src-fix/gcc/cp/parser.c:10426
0x741662 cp_parser_lambda_body
../../src-fix/gcc/cp/parser.c:9894
0x741662 cp_parser_lambda_expression
../../src-fix/gcc/cp/parser.c:9378
0x70f887 cp_parser_primary_expression
../../src-fix/gcc/cp/parser.c:4753
0x71b523 cp_parser_postfix_expression
../../src-fix/gcc/cp/parser.c:6444
0x7199f9 cp_parser_unary_expression
../../src-fix/gcc/cp/parser.c:7688
0x724059 cp_parser_binary_expression
../../src-fix/gcc/cp/parser.c:8441
0x7248bf cp_parser_assignment_expression
../../src-fix/gcc/cp/parser.c:8712
0x724d35 cp_parser_constant_expression
../../src-fix/gcc/cp/parser.c:8964
0x73c4e7 cp_parser_init_declarator
../../src-fix/gcc/cp/parser.c:18147
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

/
#include 

auto make_test_objective3(double beta, double l, int& evaluation_counter) { 
  auto phi0 = [=](double alpha) {   
if (alpha <= 1-beta)
  return 1-alpha;   
else if (alpha >= 1+beta)   
  return alpha-1;   
else
  return 1 / (2*beta)*std::pow(alpha-1,2)+beta/2;   
  };

  auto phi0_prime = [=](double alpha) { 
if (alpha <= 1-beta)
  return -1;
else if (alpha >= 1+beta)   
  return 1; 
else
  return 1 / beta * (alpha - 1);
  };
}   

int main() {
  return 0; 
} 
/

[Bug c++/68487] New: [concepts] bad "invalid reference to variadic concept" error

2015-11-22 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68487

Bug ID: 68487
   Summary: [concepts] bad "invalid reference to variadic concept"
error
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code should compile but it gives the error:

main.cpp:7:15: error: invalid reference to function concept ‘template constexpr bool C()’
 requires C<decltype(xs)...>();
   ^


template  concept bool C() {   
  return true;   
}   

template
  requires requires(const Xs&... xs) {   
requires C<decltype(xs)...>();   
  }   
struct A {   
};   

int main() {   
  return 0;   
} 


[Bug c++/68464] ICE in valid constexpr function: ../../src/gcc/tree.c:11497

2015-11-21 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68464

ryan.burn at gmail dot com changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|DUPLICATE   |---

--- Comment #2 from ryan.burn at gmail dot com ---
I don't think this is the same issue. I tried with 

g++ (GCC) 6.0.0 20151119 (experimental)

And got the same crash (223901 was from 5 months ago).

This is the flags and system I used

g++ -std=c++1z main.cpp
ec2-user@ip-10-0-0-146 ~/test/constexpr_ice $ uname -a
Linux ip-10-0-0-146.ec2.internal 4.0.5-gentoo #1 SMP Mon Jul 6 23:32:54 UTC
2015 x86_64 Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz GenuineIntel GNU/Linux

[Bug c++/68464] ICE in valid constexpr function: ../../src/gcc/tree.c:11497

2015-11-21 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68464

--- Comment #3 from ryan.burn at gmail dot com ---
Also, the test case attached to 223901 compiles fine for me.

[Bug c++/68464] New: ICE in constexpr function: ../../src/gcc/tree.c:11497

2015-11-20 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68464

Bug ID: 68464
   Summary: ICE in constexpr function: ../../src/gcc/tree.c:11497
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code produces this ICE:

rnburn@localhost ~/bugs/constexprice $ g++ -std=c++1z main.cpp 
main.cpp: In function ‘constexpr std::array<double, 3ul> f(int, int, int)’:
main.cpp:12:12:   in constexpr expansion of ‘increment(std::get<2ul, double,
3ul>(#‘result_decl’ not supported by dump_expr#))’
main.cpp:14:1: internal compiler error: Segmentation fault
 }
 ^

0xcf834f crash_signal
../../src/gcc/toplev.c:334
0x831ef8 cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3180
0x835198 cxx_eval_component_reference
../../src/gcc/cp/constexpr.c:1880
0x831fd2 cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3521
0x831515 cxx_eval_array_reference
../../src/gcc/cp/constexpr.c:1767
0x831515 cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3506
0x830985 cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3349
0x8306be cxx_eval_increment_expression
../../src/gcc/cp/constexpr.c:2886
0x8306be cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3627
0x83138a cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3570
0x830985 cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3349
0x830985 cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3349
0x82fdfd cxx_eval_call_expression
../../src/gcc/cp/constexpr.c:1396
0x831222 cxx_eval_constant_expression
../../src/gcc/cp/constexpr.c:3238
0x8365db cxx_eval_outermost_constant_expr
../../src/gcc/cp/constexpr.c:3773
0x8380e0 maybe_constant_value_1
../../src/gcc/cp/constexpr.c:3960
0x8380e0 maybe_constant_value(tree_node*, tree_node*)
../../src/gcc/cp/constexpr.c:3981
0x817cc2 cp_fold
../../src/gcc/cp/cp-gimplify.c:2149
0x818400 cp_fold_r
../../src/gcc/cp/cp-gimplify.c:932
0xfa01f2 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
../../src/gcc/tree.c:11497
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

///
#include 

constexpr void increment(double& x) {
  ++x;
}

constexpr std::array<double, 3> f(int a, int b, int c) {
  std::array<double, 3> r = {};
  std::get<0>(r) = a;
  std::get<1>(r) = b;
  std::get<2>(r) = c;
  increment(std::get<2>(r));
  return r;
}

int main() {
  return 0;
}
///

[Bug c++/68396] function auto-deduced return types get incorrectly classified as parameter packs

2015-11-20 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68396

ryan.burn at gmail dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from ryan.burn at gmail dot com ---
fixed with revision 230620

[Bug c++/68434] New: [concepts] ICE same canonical type node for different types

2015-11-19 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68434

Bug ID: 68434
   Summary: [concepts] ICE same canonical type node for different
types
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The code below generates this ICE when compiled with 

g++ (GCC) 6.0.0 20151118 (experimental)

 constexpr bool C1() constexpr bool C2() constexpr bool C3()
reduce2.cpp: At global scope:
reduce2.cpp:19:10: internal compiler error: same canonical type node for
different types C2 and C1
 auto f(C3) {
  ^

0x8fb760 comptypes(tree_node*, tree_node*, int)
../../src-orig/gcc/cp/typeck.c:1435
0x9857e8 cp_tree_equal(tree_node*, tree_node*)
../../src-orig/gcc/cp/tree.c:3128
0x9857a1 cp_tree_equal(tree_node*, tree_node*)
../../src-orig/gcc/cp/tree.c:3121
0x9857a1 cp_tree_equal(tree_node*, tree_node*)
../../src-orig/gcc/cp/tree.c:3121
0xa17928 insert
../../src-orig/gcc/cp/logic.cc:131
0xa17c8d left_conjunction
../../src-orig/gcc/cp/logic.cc:237
0xa17e6d decompose_left_term
../../src-orig/gcc/cp/logic.cc:292
0xa17f07 decompose_left_goal
../../src-orig/gcc/cp/logic.cc:315
0xa17f5d decompose_left
../../src-orig/gcc/cp/logic.cc:327
0xa18179 decompose_assumptions(tree_node*)
../../src-orig/gcc/cp/logic.cc:373
0xa12af0 build_constraints(tree_node*, tree_node*)
../../src-orig/gcc/cp/constraint.cc:1035
0x780e0f grokfndecl
../../src-orig/gcc/cp/decl.c:7819
0x78c25d grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
../../src-orig/gcc/cp/decl.c:11292
0x79f2c9 start_function(cp_decl_specifier_seq*, cp_declarator const*,
tree_node*)
../../src-orig/gcc/cp/decl.c:14069
0x8bd2c1 cp_parser_function_definition_from_specifiers_and_declarator
../../src-orig/gcc/cp/parser.c:24703
0x8b09bd cp_parser_init_declarator
../../src-orig/gcc/cp/parser.c:17972
0x8a6d64 cp_parser_simple_declaration
../../src-orig/gcc/cp/parser.c:11971
0x8a6b22 cp_parser_block_declaration
../../src-orig/gcc/cp/parser.c:11843
0x8a689c cp_parser_declaration
../../src-orig/gcc/cp/parser.c:11740
0x8a63a7 cp_parser_declaration_seq_opt
../../src-orig/gcc/cp/parser.c:11619
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions

//
template 
concept bool C1() { 
  return true;  
}   

template 
concept bool C2() { 
  return true;  
}   

template
concept bool C3() { 
  return requires(Expr expr) {  
  {expr}->C1;   
  {expr}->C2;   
  };
}   

auto f(C3) {
} 
//

[Bug c++/68429] New: [concepts] ICE in in placeholder_extract_concept_and_args, at cp/constraint.cc:1401

2015-11-18 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68429

Bug ID: 68429
   Summary: [concepts] ICE in in
placeholder_extract_concept_and_args, at
cp/constraint.cc:1401
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code causes this ICE:

bug.cpp: In function ‘int main()’:
bug.cpp:19:8: internal compiler error: in placeholder_extract_concept_and_args,
at cp/constraint.cc:1401
   f(A());
^

0x83f181 placeholder_extract_concept_and_args(tree_node*, tree_node*&,
tree_node*&)
../../src/gcc/cp/constraint.cc:1399
0x83f6a1 hash_placeholder_constraint(tree_node*)
../../src/gcc/cp/constraint.cc:1472
0x65f310 auto_hash::hash(tree_node*)
../../src/gcc/cp/pt.c:23537
0x65f310 hash_table<auto_hash, xcallocator>::find_slot(tree_node* const&,
insert_option)
../../src/gcc/hash-table.h:408
0x65f310 extract_autos_r
../../src/gcc/cp/pt.c:23571
0x664590 for_each_template_parm_r
../../src/gcc/cp/pt.c:8791
0xfa01f2 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
../../src/gcc/tree.c:11497
0x66409c for_each_template_parm
../../src/gcc/cp/pt.c:8889
0x6658c8 extract_autos
../../src/gcc/cp/pt.c:23599
0x6658c8 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context)
../../src/gcc/cp/pt.c:23690
0x840415 satisfy_argument_deduction_constraint
../../src/gcc/cp/constraint.cc:1903
0x840415 satisfy_constraint_1
../../src/gcc/cp/constraint.cc:2010
0x840493 satisfy_conjunction
../../src/gcc/cp/constraint.cc:1959
0x840493 satisfy_constraint_1
../../src/gcc/cp/constraint.cc:2019
0x83feed satisfy_parameterized_constraint
../../src/gcc/cp/constraint.cc:1941
0x83feed satisfy_constraint_1
../../src/gcc/cp/constraint.cc:2016
0x840886 satisfy_constraint
../../src/gcc/cp/constraint.cc:2049
0x8409ea constraints_satisfied_p(tree_node*)
../../src/gcc/cp/constraint.cc:2156
0x60865d add_function_candidate
../../src/gcc/cp/call.c:1994
0x609811 add_template_candidate_real
../../src/gcc/cp/call.c:3118
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.



//
template <class, class>
concept bool C1() {
  return true;
}

template 
concept bool C2() {
  return requires(Expr expr, decltype(expr.identity) x) {
{ expr }
->C1<decltype(x)>;
  };
}

void f(C2) {}

struct A {};

int main() {
  f(A());
}
//

[Bug c++/68387] New: [c++1z] gcc hangs forever on this code

2015-11-17 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68387

Bug ID: 68387
   Summary: [c++1z] gcc hangs forever on this code
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 36740
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36740=edit
preprocessed code

The attached code causes gcc to hang forever.

[Bug c++/68388] New: incomplete type bug when using decltype

2015-11-17 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68388

Bug ID: 68388
   Summary: incomplete type bug when using decltype
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code compiles fine with clang
(http://melpon.org/wandbox/permlink/Rm6dpbmC0N3eMJJa) and earlier versions of
gcc-6, but was recently broken. Gcc gives this error when compiling:

bug.cpp: In instantiation of ‘auto map_impl(std::index_sequence,
Functor, T1, T2) [with int ...Indexes = {0}; Functor = Less; T1 = Tuple;
T2 = Tuple]’:
bug.cpp:27:11:   required from ‘auto map_impl(Functor, T1, T2) [with Functor =
Less; T1 = Tuple; T2 = Tuple]’
bug.cpp:40:26:   required from here
bug.cpp:22:3: error: invalid use of incomplete type ‘class Tuple(f, t1, t2))...>’
   Tuple<decltype(apply_impl(f, t1, t2))...>();
   ^

bug.cpp:8:27: note: declaration of ‘class Tuple(f, t1, t2))...>’
 template  class Tuple {};

///
typedef int size_t; 
template
struct index_sequence {};   
}   


template  class Tuple {}; 

template   
auto get(Tuple) {   
  return TFirst();  
}   

template  
auto apply_impl(Functor f, T1 t1, T2 t2) {  
  return f(get(t1), get(t2)); 
}   

template 
auto map_impl(std::index_sequence, Functor f, T1 t1, T2 t2) {   
  Tuple<decltype(apply_impl(f, t1, t2))...>(); 
}   

template 
auto map_impl(Functor f, T1 t1, T2 t2) {
  map_impl(std::index_sequence<0>(), f, t1, t2);
}   

struct Less {   
  template
  auto operator()(Lhs lhs, Rhs rhs) -> decltype(lhs < rhs) {
return lhs < rhs;   
  } 
};  

int main() {
  auto t1 = Tuple();   
  auto t2 = Tuple();   
  map_impl(Less(), t1, t2); 
}
///

[Bug c++/68396] bug with parameter pack expansion

2015-11-17 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68396

--- Comment #1 from ryan.burn at gmail dot com ---
It looks like this was caused with the commit "Handle auto parameter packs."
(https://github.com/gcc-mirror/gcc/commit/018c146eec4143116f7f422239d56eb4047be3a4#diff-8570312acacadf34317aa24621800c00)

The addition of these lines to the function find_parameter_packs_r in pt.c

+  if (ppd->type_pack_expansion_p && is_auto_or_concept (t))
+   TEMPLATE_TYPE_PARAMETER_PACK (t) = true;

are interfering with non-pack autos. If I remove them, the code compiles fine.

[Bug c++/68395] [concepts] segfault in valid code

2015-11-17 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68395

--- Comment #1 from ryan.burn at gmail dot com ---
Created attachment 36745
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36745=edit
preprocessed code

[Bug c++/68396] New: bug with parameter pack expansion

2015-11-17 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68396

Bug ID: 68396
   Summary: bug with parameter pack expansion
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

This valid code below worked until recently with gcc-6. The latest version of
gcc-6 gives the incorrect error:

bug2.cpp: In function ‘auto make_dimensionality_impl()’:
bug2.cpp:7:17: error: parameter packs not expanded with ‘...’:
   return get<2>();
 ^

bug2.cpp:7:17: note: ‘auto’



template  auto get() {
  return 2; 
};  
template  class Dimensionality {};   
template  auto make_dimensionality_impl() { 
  Dimensionality<decltype(get())...>();
  return get<2>();  
}   

int main() { return 0; }


[Bug c++/68395] New: [concepts] segfault in valid code

2015-11-17 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68395

Bug ID: 68395
   Summary: [concepts] segfault in valid code
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The attached code compiles with an earlier version of gcc-6 but now it
segfaults with the following stack trace:

bug5.cpp: In instantiation of ‘constexpr const bool
htl::detail_concept::mappable_elements’:
bug5.cpp:102:26:   required from ‘constexpr const bool
htl::detail_concept::mappable_impl’
bug5.cpp:159:30:   required from here
bug5.cpp:88:19: internal compiler error: Segmentation fault
   std::forward(get(std::forward)...);
   ^

0xcfb02f crash_signal
../../gcc/gcc/toplev.c:334
0x5fadf5 resolve_args
../../gcc/gcc/cp/call.c:3956
0x612759 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
../../gcc/gcc/cp/call.c:4066
0x7a4cde finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2403
0x677cb4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:16420
0x66c7fc tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15592
0x843ebb satisfy_expression_constraint
../../gcc/gcc/cp/constraint.cc:1827
0x843ebb satisfy_constraint_1
../../gcc/gcc/cp/constraint.cc:2001
0x8449f6 satisfy_constraint
../../gcc/gcc/cp/constraint.cc:2049
0x612944 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
../../gcc/gcc/cp/call.c:4135
0x7a4cde finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2403
0x677cb4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:16420
0x66c7fc tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15592
0x688bd2 gen_elem_of_pack_expansion_instantiation
../../gcc/gcc/cp/pt.c:10493
0x688bd2 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:10911
0x69174a tsubst_template_args
../../gcc/gcc/cp/pt.c:11014
0x67633e tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15778
0x66c7fc tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15592
0x6a9c74 regenerate_decl_from_template
../../gcc/gcc/cp/pt.c:21216
0x6a9c74 instantiate_decl(tree_node*, int, bool)
../../gcc/gcc/cp/pt.c:21635
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

[Bug c++/68394] New: [concepts] segfault in valid code

2015-11-17 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68394

Bug ID: 68394
   Summary: [concepts] segfault in valid code
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 36744
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36744=edit
preprocessed code

The attached code compiles with an earlier version of gcc-6 but now it
segfaults with the following stack trace:

bug5.cpp: In instantiation of ‘constexpr const bool
htl::detail_concept::mappable_elements’:
bug5.cpp:102:26:   required from ‘constexpr const bool
htl::detail_concept::mappable_impl’
bug5.cpp:159:30:   required from here
bug5.cpp:88:19: internal compiler error: Segmentation fault
   std::forward(get(std::forward)...);
   ^

0xcfb02f crash_signal
../../gcc/gcc/toplev.c:334
0x5fadf5 resolve_args
../../gcc/gcc/cp/call.c:3956
0x612759 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
../../gcc/gcc/cp/call.c:4066
0x7a4cde finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2403
0x677cb4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:16420
0x66c7fc tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15592
0x843ebb satisfy_expression_constraint
../../gcc/gcc/cp/constraint.cc:1827
0x843ebb satisfy_constraint_1
../../gcc/gcc/cp/constraint.cc:2001
0x8449f6 satisfy_constraint
../../gcc/gcc/cp/constraint.cc:2049
0x612944 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
../../gcc/gcc/cp/call.c:4135
0x7a4cde finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2403
0x677cb4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:16420
0x66c7fc tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15592
0x688bd2 gen_elem_of_pack_expansion_instantiation
../../gcc/gcc/cp/pt.c:10493
0x688bd2 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:10911
0x69174a tsubst_template_args
../../gcc/gcc/cp/pt.c:11014
0x67633e tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15778
0x66c7fc tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15592
0x6a9c74 regenerate_decl_from_template
../../gcc/gcc/cp/pt.c:21216
0x6a9c74 instantiate_decl(tree_node*, int, bool)
../../gcc/gcc/cp/pt.c:21635
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

[Bug c++/68377] New: [c++1z] "binary expression in operand of fold-expression" error when folding an expression

2015-11-16 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68377

Bug ID: 68377
   Summary: [c++1z] "binary expression in operand of
fold-expression" error when folding an expression
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The following code gives the error "binary expression in operand of
fold-expression"


#include 

template 
int f(Tx... xs) {
return ((sizeof(Tx) == sizeof(int)) && ...);
}

int main() {
std::cout << f(3,4,5) << "\n";
return 0;
}


It works fine with clang (http://melpon.org/wandbox/permlink/cqH0ENHFHNGLbkZW)

[Bug c++/68085] New: bug when using anonymous structs in function

2015-10-24 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68085

Bug ID: 68085
   Summary: bug when using anonymous structs in function
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The following code compiles fine with clang and EDG, but gives this error with
g++ -std=c++1z:

main.cpp: In function ‘auto make(int)’:
main.cpp:5:17: error: declaration of ‘int make(int)y’
[-fpermissive]
 decltype(y) y;
 ^
main.cpp:3:8: error: changes meaning of ‘y’ from ‘int y’ [-fpermissive]
   auto y = x;

//
auto make(int x) {  
  auto y = x;   
  struct {  
decltype(y) y;  
  } result{x};  
  return result;
}   

int main() {
  return 0; 
} 
//

[Bug c++/68045] New: [concepts] segfault in contains_struct_check ../../gcc/gcc/tree.h:2971

2015-10-21 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68045

Bug ID: 68045
   Summary: [concepts] segfault in contains_struct_check
../../gcc/gcc/tree.h:2971
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 36560
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36560=edit
preprocessed code

The attached code gives this stack trace:

rnburn@localhost ~/bugs/contains_struct_check_segfault $ c++17
contains_struct_check_segfault.cpp 
In file included from
/home/rnburn/proj/echo/parallel/include/echo/parallel/invoke_create.h:3:0,
 from
/home/rnburn/proj/echo/parallel/unittest/invoke_create.cpp:1:
/home/rnburn/proj/echo/parallel/include/echo/parallel/concept.h: In function
‘void C_A_T_C_HT_E_S_T6()’:
/home/rnburn/proj/echo/parallel/include/echo/parallel/concept.h:63:61: internal
compiler error: Segmentation fault
 uncvref_t<decltype(functors_rest())>>()...>();
 ^
0xcacfef crash_signal
../../gcc/gcc/toplev.c:352
0x67833e contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
../../gcc/gcc/tree.h:2971
0x67833e tsubst_copy
../../gcc/gcc/cp/pt.c:13490
0x67f202 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:16238
0x6813f8 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15712
0x661a6c tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:13138
0x67cd12 tsubst_template_args
../../gcc/gcc/cp/pt.c:10839
0x6621c1 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:12829
0x6623bf tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:12452
0x67cd12 tsubst_template_args
../../gcc/gcc/cp/pt.c:10839
0x67fafb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15230
0x6813f8 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15712
0x66aad1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15044
0x67a71e tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:10675
0x67d04a tsubst_template_args
../../gcc/gcc/cp/pt.c:10803
0x67fafb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15230
0x6813f8 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15712
0x66aad1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15044
0x823207 satisfy_predicate_constraint
../../gcc/gcc/cp/constraint.cc:1694
0x823207 satisfy_constraint_1
../../gcc/gcc/cp/constraint.cc:1898
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

[Bug target/66326] Floating point exception with -mfpmath=387 and -fcilkplus.

2015-10-21 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66326

ryan.burn at gmail dot com changed:

   What|Removed |Added

 CC||ryan.burn at gmail dot com

--- Comment #4 from ryan.burn at gmail dot com ---
I'm getting a similar problem testing with 6.0. Only the flags -mfpmath doesn't
seem to make a difference for the case I'm testing. But it runs successfully
with -O1 or above but fails with -O0. Not sure which particular option is
causing the problem.

Here's the code I'm testing with

///
#include 
#include 
#include 

template 
void do_not_optimize_away(T&& x) {
  asm volatile("" : "+r"(x));
}

const int N = 1'000'000;

auto compute() {
  std::vector v(N);
  auto rng = std::mt19937{std::random_device{}()};
  std::uniform_real_distribution dist(0, 1);
  for (int i = 0; i < N; ++i) v[i] = std::log(std::sqrt(dist(rng)));
  return v;
}

int main() {
  std::vector v1, v2, v3;
  cilk_spawn [&] { v1 = compute(); }();
  cilk_spawn [&] { v2 = compute(); }();
  v3 = compute();
  do_not_optimize_away(v1.data());
  do_not_optimize_away(v2.data());
  do_not_optimize_away(v3.data());
  return 0;
}
///

// O1 level - good
rnburn@localhost ~/test/gcc_cilk $ /home/rnburn/local/bin/g++ -std=c++1z -O1
-fcilkplus -std=c++14   -march=haswell t2.cpp 
rnburn@localhost ~/test/gcc_cilk $ ./a.out 

// O0 level - fails
rnburn@localhost ~/test/gcc_cilk $ /home/rnburn/local/bin/g++ -std=c++1z -O0
-fcilkplus -std=c++14   -march=haswell t2.cpp 
rnburn@localhost ~/test/gcc_cilk $ ./a.out 
Floating point exception


[Bug c++/68001] New: [cilkplus] ICE in cp_gimplify_expr, at cp/cp-gimplify.c:760

2015-10-17 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68001

Bug ID: 68001
   Summary: [cilkplus] ICE in cp_gimplify_expr, at
cp/cp-gimplify.c:760
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code causes the following ICE

rnburn@localhost ~/test/gcc_cilk $ c++17 -fcilkplus -lcilkrts t.cpp 
t.cpp: In function ‘void compute_cilk()’:
t.cpp:21:33: error: ‘do_not_optimize_away’ was not declared in this scope
   do_not_optimize_away(v1.data());
 ^
cc1plus: error: invalid use of ‘_Cilk_spawn’
t.cpp:18:26: error: invalid use of ‘_Cilk_spawn’
   auto v1 = cilk_spawn f();
  ^
t.cpp:18:26: internal compiler error: tree check: expected call_expr or
aggr_init_expr, have target_expr in cp_gimplify_expr, at cp/cp-gimplify.c:760
0xf2508c tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/gcc/tree.c:9512
0x7fc015 tree_check2(tree_node*, char const*, int, char const*, tree_code,
tree_code)
../../gcc/gcc/tree.h:2877
0x7fc015 cp_gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**)
../../gcc/gcc/cp/cp-gimplify.c:760
0xa965c2 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
../../gcc/gcc/gimplify.c:8025
0xaa80b1 gimplify_addr_expr
../../gcc/gcc/gimplify.c:4985
0xa97f09 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
../../gcc/gcc/gimplify.c:8162
0xaa386b gimplify_call_expr
../../gcc/gcc/gimplify.c:2452
0xa97dda gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
../../gcc/gcc/gimplify.c:8087
0xa9bb96 gimplify_stmt(tree_node**, gimple_statement_base**)
../../gcc/gcc/gimplify.c:5526
0xa97e58 gimplify_cleanup_point_expr
../../gcc/gcc/gimplify.c:5302
0xa97e58 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
../../gcc/gcc/gimplify.c:8479
0xa9bb96 gimplify_stmt(tree_node**, gimple_statement_base**)
../../gcc/gcc/gimplify.c:5526
0xa993bb gimplify_statement_list
../../gcc/gcc/gimplify.c:1462
0xa993bb gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
../../gcc/gcc/gimplify.c:8531
0xa9bb96 gimplify_stmt(tree_node**, gimple_statement_base**)
../../gcc/gcc/gimplify.c:5526
0xa99209 gimplify_and_add(tree_node*, gimple_statement_base**)
../../gcc/gcc/gimplify.c:398
0xa99209 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
../../gcc/gcc/gimplify.c:8453
0xa9bb96 gimplify_stmt(tree_node**, gimple_statement_base**)
../../gcc/gcc/gimplify.c:5526
0xa993bb gimplify_statement_list
../../gcc/gcc/gimplify.c:1462
0xa993bb gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
../../gcc/gcc/gimplify.c:8531
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

//
#include   
#include   
#include
#include
#include 

const int N = 100'000'000;  

auto f() {  
  std::vector v(N); 
  auto rng = std::mt19937{std::random_device{}()};  
  std::uniform_real_distribution dist(0, 1);
  for (int i = 0; i < N; ++i) v[i] = std::log(std::sqrt(dist(rng)));
  return v; 
}   

void compute_cilk() {   
  auto v1 = cilk_spawn f(); 
  auto v2 = f();
  cilk_sync;
  do_not_optimize_away(v1.data());  
  do_not_optimize_awa

[Bug c++/67969] [concepts] bug with overloaded function when using constraints

2015-10-14 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67969

--- Comment #1 from ryan.burn at gmail dot com ---
Reduced further:

emplate <class, class>
class NumericArray {};

template 
constexpr bool match_numeric_array = false;
template 
constexpr bool
match_numeric_array<NumericArray<Scalar, Shape>> =
true;
template 
concept bool cpt_NumericArrayContainer() {
  return match_numeric_array;
}

template 
concept bool cpt_NumericArray() {
  return requires{requires cpt_NumericArrayContainer()};
}


template 
requires !cpt_NumericArray() auto func(int, X) {}

template 
requires cpt_NumericArray() auto func(int, X) {}

int main() {
  NumericArray<double, int> v5;
  func(0, v5);
}


[Bug c++/67969] New: [concepts] bug with overloaded function when using constraints

2015-10-14 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67969

Bug ID: 67969
   Summary: [concepts] bug with overloaded function when using
constraints
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 36514
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36514=edit
code

The attached code contains these two functions

template  requires !Q() auto func(vtype, X) {}  

template  requires Q() auto func(vtype, X) {} 

I get an ambiguous overload when trying to call it, but one should be disabled.


[Bug c++/67970] New: [concepts] variable template bug

2015-10-14 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67970

Bug ID: 67970
   Summary: [concepts] variable template bug
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code should compile, but I get this error:

bug.cpp: In function ‘int main()’:
bug.cpp:29:13: error: the value of ‘match_numeric_array’ is not usable in a
constant expression
   func(0, v5);
 ^
bug.cpp:8:5: note: ‘match_numeric_array’ used in its own initializer
 match_numeric_array<NumericArray> =
 ^
bug.cpp:29:13: error: ‘’ is not a constant expression
   func(0, v5);

///
template 
class NumericArray {};

template 
constexpr bool match_numeric_array = false;
template 
constexpr bool
match_numeric_array<NumericArray> =
true;
template 
concept bool cpt_NumericArrayContainer() {
  return match_numeric_array;
}

template 
concept bool cpt_NumericArray() {
  return requires{requires cpt_NumericArrayContainer()};
}


template 
requires !cpt_NumericArray() auto func(int, X) {}

template 
requires cpt_NumericArray() auto func(int, X) {}

int main() {
  NumericArray v5;
  func(0, v5);
}
///

[Bug c++/67901] New: [concepts] overloading bug when considered more specialized vs more constrained

2015-10-08 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67901

Bug ID: 67901
   Summary: [concepts] overloading bug when considered more
specialized vs more constrained
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

I think the below code should compile. 

>From section 14.6.6.2:

Partial ordering selects which of two function templates is more specialized
than the other by transforming each template in turn (see next paragraph) and
performing template argument de- duction using the function type. The deduction
process determines whether one of the templates is more specialized than the
other. If so, the more specialized template is the one chosen by the partial
ordering process. If both deductions succeed, the partial ordering selects the
more
constrained template as described by the rules in 14.10.3.

And since the first version of apply_odd_arguments is more specialized, it
should be selected before considering which version is more constrained.

/
template  
  //requires true // works if uncommented   
decltype(auto) apply_odd_arguments(const Functor& functor,  
   ArgumentFirst argument_first,
   ArgumentSecond argument_second) {
  return functor(argument_first);   
}   

template
  requires sizeof...(ArgumentsRest) % 2 == 0
decltype(auto) apply_odd_arguments(const Functor& functor,  
   ArgumentFirst argument_first,
   ArgumentSecond argument_second,  
   ArgumentsRest... arguments_rest) {   
  return apply_odd_arguments([&](auto... arguments) {   
return functor(argument_first, arguments...);   
  }, arguments_rest...);
}   

int main() {
  auto f = [](int i1, int i2) { 
return i1+i2;   
  };
  apply_odd_arguments(f, 1, 2, 3, 4);   
  return 0; 
}
/


[Bug c++/67878] New: [concepts] when processing a valid concept check, gcc errors trying to expand variadic in unrelated code

2015-10-06 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67878

Bug ID: 67878
   Summary: [concepts] when processing a valid concept check, gcc
errors trying to expand variadic in unrelated code
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code should be valid, but gcc gives the following error, which
references a completely unrelated concept:

t2.cpp:42:53: error: expansion pattern ‘indexes#0’ contains no argument packs
 requires cpt_Scalar<uncvref_t<decltype(evaluator(indexes...))>>();
 ^
t2.cpp: In function ‘int main()’:
t2.cpp:89:42: error: cannot call function ‘auto make_indexed_evaluator(const
Evaluator&) [with long unsigned int K = 2ul; Evaluator =
main()::<lambda(index_t, index_t, index_t, index_t)>]’
   auto f1_ = make_indexed_evaluator<2>(f1);
  ^
t2.cpp:81:6: note:   constraints not satisfied
 auto make_indexed_evaluator(const Evaluator& evaluator) {
  ^
t2.cpp:81:6: note:   concept ‘cpt_IndexedEvaluatable<main()::<lambda(index_t,
index_t, index_t, index_t)>, 2ul>()’ was not satisfied

//
#include 
#include 

using index_t = long;

//--
// repeat_type_c
//--
namespace DETAIL_NS {
template  struct repeat_type_c_impl {
  using type = T;
};
}

template 
using repeat_type_c = typename DETAIL_NS::repeat_type_c_impl<A, T>::type;

//--
// uncvref_t
//--
template 
using uncvref_t =
typename std::remove_cv::type>::type;

//--
// cpt_Scalar
//--
template  concept bool cpt_Scalar() {
  return std::is_floating_point::value;
}

//--
// cpt_KEvaluator
//--
namespace DETAIL_NS {
template <class, class> constexpr bool k_evaluator_impl = false;

// clang-format off
template 
  requires requires(const Evaluator& evaluator,
repeat_type_c<Indexes, index_t>... indexes) {
requires cpt_Scalar<uncvref_t<decltype(evaluator(indexes...))>>();
::operator();
  }
constexpr bool k_evaluator_impl<std::index_sequence, Evaluator> =
true;
// clang-format on
}

template  concept bool cpt_KEvaluator() {
  return DETAIL_NS::k_evaluator_impl<std::make_index_sequence<2 * K>, X>;
}

//--
// cpt_IndexedEvaluatable
//--
namespace DETAIL_NS {
template <class, class> constexpr bool indexed_evaluatable_impl = false;

// clang-format off
template 
requires requires(const Evaluator& evaluator,
  repeat_type_c<Indexes, index_t>... indexes) {
  requires cpt_Scalar<uncvref_t<decltype(evaluator(indexes...))>>();
 }
constexpr bool indexed_evaluatable_impl<
  std::index_sequence, Evaluator> = true;
// clang-format on
}

template 
concept bool cpt_IndexedEvaluatable() {
  return DETAIL_NS::indexed_evaluatable_impl<std::make_index_sequence<2 * K>,
 Evaluator>;
}

//--
// make_indexed_evaluator
//--
template  Evaluator>
auto make_indexed_evaluator(const Evaluator& evaluator) {
  return true;
}

int main() {
  auto f1 = [](index_t i, index_t m, index_t j, index_t n) {
return 2.0;
  };
  auto f1_ = make_indexed_evaluator<2>(f1);
  return 0;
}
//

[Bug c++/67862] New: [concepts] ICE in tsubst, at cp/pt.c:12625

2015-10-05 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67862

Bug ID: 67862
   Summary: [concepts] ICE in tsubst, at cp/pt.c:12625
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 36447
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36447=edit
preprocessed code

the attached code gives this trace:

rnburn@localhost ~/bugs/tsubst_ice $ c++17 tsubst_ice.cpp 
In file included from
/home/rnburn/proj/echo/numeric_array/unittest/map.cpp:1:0:
/home/rnburn/proj/echo/numeric_array/include/echo/numeric_array/map.h: In
function ‘void C_A_T_C_HT_E_S_T8()’:
/home/rnburn/proj/echo/numeric_array/include/echo/numeric_array/map.h:22:16:
internal compiler error: in tsubst, at cp/pt.c:12625
   requires and_(cpt_FlatEvaluator()...)
^
0x66475d tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:12625
0x826520 tsubst_compound_requirement
../../gcc/gcc/cp/constraint.cc:1538
0x826520 tsubst_requirement
../../gcc/gcc/cp/constraint.cc:1566
0x826520 tsubst_requirement_body
../../gcc/gcc/cp/constraint.cc:1585
0x826520 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/constraint.cc:1616
0x67f312 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:16396
0x66aad1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15044
0x67a6db gen_elem_of_pack_expansion_instantiation
../../gcc/gcc/cp/pt.c:10496
0x67a6db tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:10700
0x680e4f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15733
0x66aad1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15044
0x823207 satisfy_predicate_constraint
../../gcc/gcc/cp/constraint.cc:1694
0x823207 satisfy_constraint_1
../../gcc/gcc/cp/constraint.cc:1898
0x823f76 satisfy_constraint
../../gcc/gcc/cp/constraint.cc:1949
0x8240da constraints_satisfied_p(tree_node*)
../../gcc/gcc/cp/constraint.cc:2056
0x5ff57d add_function_candidate
../../gcc/gcc/cp/call.c:1995
0x6007b9 add_template_candidate_real
../../gcc/gcc/cp/call.c:3118
0x600e8c add_template_candidate
../../gcc/gcc/cp/call.c:3160
0x600e8c add_candidates
../../gcc/gcc/cp/call.c:5316
0x603503 perform_overload_resolution
../../gcc/gcc/cp/call.c:4012
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

[Bug c++/67860] New: [concepts] bug with overloaded, refined function with explicit and variadic template arguments

2015-10-05 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67860

Bug ID: 67860
   Summary: [concepts] bug with overloaded, refined function with
explicit and variadic template arguments
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Gcc gives this error compiling the below code. But function v1 is more
specialized than v2 so there should be no ambiguity.

main.cpp: In function ‘int main()’:
main.cpp:27:18: error: call of overloaded ‘f(double, float)’ is ambiguous
   f<10>(3.0, 2.0f);
  ^
main.cpp:18:6: note: candidate: void f(const Xs& ...) [with int  =
10; Xs = {double, float}]
 void f(const Xs&... xs) {
  ^
main.cpp:23:6: note: candidate: void f(const Xs& ...) [with int  =
10; Xs = {double, float}]
 void f(const Xs&... xs) {


/
inline constexpr bool and_impl() { return true; }

template 
constexpr bool and_impl(OperandFirst operand_first,
OperandsRest... operands_rest) {
  return operand_first && and_impl(operands_rest...);
}

template  constexpr bool and_(Operands... operands) {
  return and_impl(operands...);
}

template  concept bool C() { return true; }

// v1
template<int, class... Xs>
  requires and_(C()...)
void f(const Xs&... xs) {
}

// v2
template<int, class... Xs>
void f(const Xs&... xs) {
}

int main() {
  f<10>(3.0, 2.0f);
  return 0;
}
/

[Bug c++/67835] New: bug with auto-deduced return type and functions invoked via ADL

2015-10-03 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67835

Bug ID: 67835
   Summary: bug with auto-deduced return type and functions
invoked via ADL
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: major
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code compiles fine with clang and EDG (intel's compiler) but gives
this error with gcc:

t.cpp: In instantiation of ‘auto g(Tag, T) [with Tag = abc::tag; T = abc::A]’:
t.cpp:16:25:   required from here
t.cpp:3:11: error: use of ‘template auto abc::f(abc::tag, T)’ before
deduction of ‘auto’
   return f(tag, x);
   ^
t.cpp:3:11: error: use of ‘auto abc::f(abc::tag, T) [with T = abc::A]’ before
deduction of ‘auto’

/
template
auto g(Tag tag, T x) {
  return f(tag, x);
}

namespace abc {
struct tag {};

struct A {};

template
auto f(tag, T x) { return x; }
}

int main() {
  g(abc::tag(), abc::A());
  return 0;
}
/

[Bug c++/67825] New: [concepts] expression constraint bug when taking address of a member function

2015-10-02 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67825

Bug ID: 67825
   Summary: [concepts] expression constraint bug when taking
address of a member function
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code prints 1 but ::operator() is an invalid expression so it
should print 0.

///
#include 

struct A {
  template 
  double operator()(T x) const {
return 0;
  }
};

template  concept bool C() {
  return requires {
::operator();
  };
}

int main() {
  std::cout << C() << '\n';
  return 0;
}
///


[Bug c++/67823] New: ICE in tsubst_copy, at cp/pt.c:13635

2015-10-02 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67823

Bug ID: 67823
   Summary: ICE in tsubst_copy, at cp/pt.c:13635
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 36439
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36439=edit
preprocessed code

the attached code produces this ICE when compiled with -std=c++1z:

home/rnburn/proj/echo/execution_context/include/echo/execution_context/tbb/expression_executer.h:477:35:
internal compiler error: in tsubst_copy, at cp/pt.c:13635
  return mapper(indexes_rest..., index_last, size_last);
   ^
0x678d8d tsubst_copy
../../gcc/gcc/cp/pt.c:13633
0x67f202 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:16238
0x680adc tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:16018
0x6813f8 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15712
0x66aad1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15044
0x5c8384 tsubst_init
../../gcc/gcc/cp/pt.c:13434
0x677fdb tsubst_copy
../../gcc/gcc/cp/pt.c:13623
0x67f202 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:16238
0x680d9f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15728
0x66aad1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15044
0x669e1f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:14451
0x66a8df tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:14627
0x669ba4 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:14441
0x66a8df tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:14627
0x667f00 instantiate_decl(tree_node*, int, bool)
../../gcc/gcc/cp/pt.c:21174
0x6e14a5 mark_used(tree_node*, int)
../../gcc/gcc/cp/decl2.c:5134
0x5f6a56 build_over_call
../../gcc/gcc/cp/call.c:7578
0x6067b9 build_op_call_1
../../gcc/gcc/cp/call.c:4367
0x6067b9 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
../../gcc/gcc/cp/call.c:4390
0x7901ba finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2408
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


[Bug c++/67774] New: [concepts] ICE when mismatching template arguments to concept

2015-09-29 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67774

Bug ID: 67774
   Summary: [concepts] ICE when mismatching template arguments to
concept
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Below code produces this ICE:

t.cpp: In function ‘int main()’:
t.cpp:21:16: error: wrong number of template arguments (1, should be 2)
   std::cout << cpt_KEvaluator<decltype(f)> << '\n';
^
t.cpp:16:48: note: provided for ‘template
constexpr const bool cpt_KEvaluator<X, K>’
 template  concept bool cpt_KEvaluator =
^
t.cpp:21:16: internal compiler error: tree check: expected tree_vec, have
error_mark in tsubst, at cp/pt.c:12570
   std::cout << cpt_KEvaluator<decltype(f)> << '\n';
^
0xf2508c tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc/gcc/tree.c:9512
0x6642bc tree_check(tree_node*, char const*, int, char const*, tree_code)
../../gcc/gcc/tree.h:2858
0x6642bc tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:12570
0x676b70 tsubst_copy
../../gcc/gcc/cp/pt.c:13675
0x680c0a tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15474
0x66aad1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15044
0x66fbbc tsubst_template_arg
../../gcc/gcc/cp/pt.c:10260
0x67cd12 tsubst_template_args
../../gcc/gcc/cp/pt.c:10839
0x6621c1 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:12829
0x6623bf tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:12452
0x67cd12 tsubst_template_args
../../gcc/gcc/cp/pt.c:10839
0x67fafb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15230
0x66aad1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15044
0x823207 satisfy_predicate_constraint
../../gcc/gcc/cp/constraint.cc:1694
0x823207 satisfy_constraint_1
../../gcc/gcc/cp/constraint.cc:1898
0x823f76 satisfy_constraint
../../gcc/gcc/cp/constraint.cc:1949
0x797988 finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*,
bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int)
../../gcc/gcc/cp/semantics.c:3585
0x702615 cp_parser_primary_expression
../../gcc/gcc/cp/parser.c:4817
0x70ec1b cp_parser_postfix_expression
../../gcc/gcc/cp/parser.c:6201
0x713679 cp_parser_unary_expression
../../gcc/gcc/cp/parser.c:7486
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

//
#include 
#include 
#include 

template  concept bool cpt_RealScalar() {
  return std::is_floating_point::value;
}

namespace detail {
template <class, class> constexpr bool k_evaluator_impl = false;

template 
constexpr bool k_evaluator_impl<std::index_sequence, E> = true;
}

template  concept bool cpt_KEvaluator =
  detail::k_evaluator_impl<std::make_index_sequence, X>;

int main() {
  auto f = [](int, int, int) -> double { return 3; };
  std::cout << cpt_KEvaluator<decltype(f)> << '\n';
  return 0;
}
//

[Bug c++/67775] New: [concepts] bug when using variadic expansions in compound requirements

2015-09-29 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67775

Bug ID: 67775
   Summary: [concepts] bug when using variadic expansions in
compound requirements
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code prints 0, but it should print 1.

/
#include   
#include   
#include  

template   
concept bool cpt_RealScalar = std::is_floating_point::value; 

namespace detail {  
template <class, class> constexpr bool k_evaluator_impl = false;

template   
  requires requires(E e) {  
{ e((Indexes, 0)...) } -> cpt_RealScalar;   
// requires cpt_RealScalar<decltype(e((Indexes,0)...))>; // this version
works
  } 
constexpr bool k_evaluator_impl<std::index_sequence, E> = true; 
}   

template  concept bool cpt_KEvaluator = 
  detail::k_evaluator_impl<std::make_index_sequence, X>; 

int main() {
  auto f = [](int, int, int) -> double { return 3; };   
  std::cout << cpt_KEvaluator<decltype(f), 3> << '\n';  
  return 0; 
} 
/


[Bug c++/67737] ICE in make_decl_rtl, at varasm.c:1299

2015-09-28 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67737

ryan.burn at gmail dot com changed:

   What|Removed |Added

  Attachment #36403|0   |1
is obsolete||

--- Comment #3 from ryan.burn at gmail dot com ---
Created attachment 36410
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36410=edit
ice code


[Bug c++/67737] ICE in make_decl_rtl, at varasm.c:1299

2015-09-28 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67737

ryan.burn at gmail dot com changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|DUPLICATE   |---

--- Comment #5 from ryan.burn at gmail dot com ---
replaced with correct file


[Bug c++/67737] ICE in make_decl_rtl, at varasm.c:1299

2015-09-28 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67737

--- Comment #4 from ryan.burn at gmail dot com ---
yes, sorry. I attached the wrong file.


[Bug c++/67737] New: ICE in make_decl_rtl, at varasm.c:1299

2015-09-27 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67737

Bug ID: 67737
   Summary: ICE in make_decl_rtl, at varasm.c:1299
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 36403
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36403=edit
preprocessed  code

Here's the stack trace I get when compiling the attached file with -std=c++1z:
In file included from /home/rnburn/proj/echo/k_array/unittest/slice.cpp:2:0:
/home/rnburn/proj/echo/k_array/include/echo/k_array/shape.h: In function ‘auto
echo::k_array::make_shape(const echo::htl::Tuple&) [with Extents =
{echo::htl::integral_constant, echo::htl::integral_constant}]’:
/home/rnburn/proj/echo/k_array/include/echo/k_array/shape.h:47:60: internal
compiler error: in make_decl_rtl, at varasm.c:1299
   return reinterpret_cast&>(extents);
^
0xf7e6b6 make_decl_rtl(tree_node*)
../../gcc/gcc/varasm.c:1298
0x8f3713 expand_return
../../gcc/gcc/cfgexpand.c:3392
0x8f3713 expand_gimple_stmt_1
../../gcc/gcc/cfgexpand.c:3570
0x8f3713 expand_gimple_stmt
../../gcc/gcc/cfgexpand.c:3695
0x8f4b3a expand_gimple_basic_block
../../gcc/gcc/cfgexpand.c:5698
0x8fb9e6 execute
../../gcc/gcc/cfgexpand.c:6284
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

[Bug c++/67727] New: [concepts] parameterized constraint not being checked for unused variables

2015-09-26 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67727

Bug ID: 67727
   Summary: [concepts] parameterized constraint not being checked
for unused variables
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The following code prints 1 1, but according to 

http://stackoverflow.com/questions/32801326/in-requires-parameter-lists-can-you-introduce-types-that-result-in-substitution

should print 1 0

/
#include  
#include  

template
concept bool Iterator = 
requires(Iter i, typename std::iterator_traits::value_type val,   
 typename std::iterator_traits::reference ref) {  
  ++i;  
};  

int main() {
  std::cout << Iterator<int*> << "\n"; // prints 1  
  std::cout << Iterator << "\n"; // prints 1   
  return 0; 
}
/


[Bug c++/67719] New: [concepts] bug with concepts using logical or

2015-09-25 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67719

Bug ID: 67719
   Summary: [concepts] bug with concepts using logical or
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

This code fails to compile but should.

It gives the following error:

main.cpp: In function ‘int main()’:
main.cpp:11:15: error: template constraint failure
   Ax<int, long> a;
   ^
main.cpp:11:15: note:   constraints not satisfied
main.cpp:11:15: note:   in the expansion of ‘(C)()...’

/
#include   

template concept bool C() {
  return std::is_same<X, int>::value || std::is_same<X, long>::value;   
}   

template   
struct Ax {};   

int main() {
  Ax<int, long> a;  
  return 0; 
}
/

[Bug c++/67720] New: [concepts] bug with recursive constrained function

2015-09-25 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67720

Bug ID: 67720
   Summary: [concepts] bug with recursive constrained function
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code is valid but gives this error with gcc:

main.cpp: In instantiation of ‘auto f(const std::tuple<_El0, _El ...>&)
requires predicate((cpt_BooleanFalseConstant<decltype(p((get<0>)(f::t)))>)())
[with TFirst = std::integral_constant<int, 9>; TRest =
{std::integral_constant<int, 3>, std::integral_constant<int, 5>}]’:
main.cpp:34:11:   required from ‘auto f(const std::tuple<_El0, _El ...>&)
requires predicate((cpt_BooleanFalseConstant<decltype(p((get<0>)(f::t)))>)())
[with TFirst = std::integral_constant<int, 6>; TRest =
{std::integral_constant<int, 9>, std::integral_constant<int, 3>,
std::integral_constant<int, 5>}]’
main.cpp:44:6:   required from here
main.cpp:34:11: error: call of overloaded
‘f(std::tuple<std::integral_constant<int, 3>, std::integral_constant<int, 5>
>)’ is ambiguous
   return f(std::tuple());
   ^
main.cpp:24:6: note: candidate: auto f(const std::tuple<_El0, _El ...>&)
requires predicate((cpt_BooleanTrueConstant<decltype(p((get<0>)(f::t)))>)())
[with TFirst = std::integral_constant<int, 3>; TRest =
{std::integral_constant<int, 5>}]
 auto f(const std::tuple<TFirst, TRest...>& t)
  ^
main.cpp:31:6: note: candidate: auto f(const std::tuple<_El0, _El ...>&)
requires predicate((cpt_BooleanFalseConstant<decltype(p((get<0>)(f::t)))>)())
[with TFirst = std::integral_constant<int, 3>; TRest =
{std::integral_constant<int, 5>}]
 auto f(const std::tuple<TFirst, TRest...>& t)


#include 
#include 

template 
  requires requires {
X::value;
  }
constexpr bool lift_boolean_constant_value = X::value;

template  concept bool cpt_BooleanTrueConstant() {
  return requires { requires lift_boolean_constant_value; };
}

template  concept bool cpt_BooleanFalseConstant() {
  return requires { requires !lift_boolean_constant_value; };
}

template
auto p(std::integral_constant<int, X>) {
  return std::integral_constant<bool, (X < 5)>();
}

template
auto f(const std::tuple<TFirst, TRest...>& t)
  requires cpt_BooleanTrueConstant<decltype(p(std::get<0>(t)))>()
{
  return 1;
}

template
auto f(const std::tuple<TFirst, TRest...>& t)
  requires cpt_BooleanFalseConstant<decltype(p(std::get<0>(t)))>()
{
  return f(std::tuple());
}

int main() {
  std::tuple<
std::integral_constant<int, 6>,
std::integral_constant<int, 9>,
std::integral_constant<int, 3>,
std::integral_constant<int, 5>
  > t;
  f(t);
  return 0;
}


[Bug c++/67704] New: [concepts] requirements not being applied to aliases

2015-09-24 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67704

Bug ID: 67704
   Summary: [concepts] requirements not being applied to aliases
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

I think the below code should compile: the first version of "f" should trigger
SFINAE but the second version should match so that the program prints 2.

But it compiles with this error with gcc 6:

t3.cpp: In substitution of ‘template  requires
predicate(requires{typename X::type;}) using Q = typename X::type [with X =
int]’:
t3.cpp:12:21:   required from ‘struct A’
t3.cpp:19:30:   required by substitution of ‘template  requires
predicate(requires{typename X::Q;}) using R = typename A::type [with X = int]’
t3.cpp:35:20:   required from here
t3.cpp:8:27: error: ‘int’ is not a class, struct, or union type
 using Q = typename X::type;

//
#include   
#include  

template   
  requires requires {   
typename X::type;   
  } 
using Q = typename X::type; 

template   
struct A {  
  using type = Q*;   
};  

template   
  requires requires {   
typename Q;  
  } 
using R = typename A::type;  

template   
  requires requires {   
typename R;  
  } 
int f(X x) {
  return 1; 
}   

template   
int f(X x) {
  return 2; 
}   

int main() {
  std::cout << f(22) << '\n';   
  return 0; 
}
//

[Bug c++/67697] New: [concepts] ICE when using non-constexpr in requires expression

2015-09-23 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67697

Bug ID: 67697
   Summary: [concepts] ICE when using non-constexpr in requires
expression
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The following code causes an ICE:

//
template
concept bool C() {
  return requires(X x, bool b) {
requires b;
x++;
  };
}

int main() {
  C();
  return 0;
}
//

Stack Trace:
t1.cpp: In function ‘int main()’:
t1.cpp:10:10: internal compiler error: in xform_decl, at cp/constraint.cc:797
   C();
  ^
0x82016d xform_decl
../../gcc/gcc/cp/constraint.cc:797
0x82016d transform_expression
../../gcc/gcc/cp/constraint.cc:827
0x8202f0 xform_nested_requirement
../../gcc/gcc/cp/constraint.cc:632
0x8202f0 xform_requirement
../../gcc/gcc/cp/constraint.cc:652
0x8202f0 xform_requirements
../../gcc/gcc/cp/constraint.cc:669
0x8202f0 xform_requires_expr
../../gcc/gcc/cp/constraint.cc:680
0x8202f0 xform_expr
../../gcc/gcc/cp/constraint.cc:758
0x8202f0 transform_expression
../../gcc/gcc/cp/constraint.cc:821
0x8252d7 evaluate_function_concept(tree_node*, tree_node*)
../../gcc/gcc/cp/constraint.cc:2002
0x605b94 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
../../gcc/gcc/cp/call.c:4130
0x78ff5e finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2391
0x70ecc9 cp_parser_postfix_expression
../../gcc/gcc/cp/parser.c:6419
0x713679 cp_parser_unary_expression
../../gcc/gcc/cp/parser.c:7486
0x7142b7 cp_parser_binary_expression
../../gcc/gcc/cp/parser.c:8239
0x7149bf cp_parser_assignment_expression
../../gcc/gcc/cp/parser.c:8497
0x71d131 cp_parser_expression
../../gcc/gcc/cp/parser.c:8651
0x71ecd6 cp_parser_expression_statement
../../gcc/gcc/cp/parser.c:10065
0x72a125 cp_parser_statement
../../gcc/gcc/cp/parser.c:9916
0x72ace2 cp_parser_statement_seq_opt
../../gcc/gcc/cp/parser.c:10188
0x72ae4b cp_parser_compound_statement
../../gcc/gcc/cp/parser.c:10142
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

[Bug c++/67684] New: [concepts] friend access not working with constrained function

2015-09-22 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67684

Bug ID: 67684
   Summary: [concepts] friend access not working with constrained
function
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The following code fails to compile with g++ (GCC) 6.0.0 20150915
(experimental)

/
template
class A {
 public:
  template
requires I > 0
  friend int f(const A&);
 private:
  int x = 2;
};

template
  requires I > 0
int f(const A& a) { 
  return a.x;
} 

int main() { 
  A a;
  f<2>(a);
  return 0;
} 
/

I get the error

main.cpp:14:12: error: ‘int A::x’ is private within this context

But I expect it should be valid code (it compiles fine if the constraint is
removed)

[Bug c++/67692] New: [concepts] ICE when using requires in non-concept contexts

2015-09-22 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67692

Bug ID: 67692
   Summary: [concepts] ICE when using requires in non-concept
contexts
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

The below code produces an ICE compiling with -std=c++1z:


template
bool f(T x) {
  return requires(T x) {
++x;
  };
}

int main() {
  f(3);
  return 0;
}


Stack trace:
main.cpp: In function ‘bool f(T) [with T = int]’:
main.cpp:5:3: internal compiler error: in gimplify_expr, at gimplify.c:8848
   };
   ^
0xa99c53 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
../../gcc/gcc/gimplify.c:8848
0xaa6bc0 gimplify_modify_expr
../../gcc/gcc/gimplify.c:4625
0xa979d2 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
../../gcc/gcc/gimplify.c:8116
0xa9bb96 gimplify_stmt(tree_node**, gimple_statement_base**)
../../gcc/gcc/gimplify.c:5526
0xa990d6 gimplify_and_add(tree_node*, gimple_statement_base**)
../../gcc/gcc/gimplify.c:398
0xa990d6 gimplify_return_expr
../../gcc/gcc/gimplify.c:1291
0xa990d6 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
../../gcc/gcc/gimplify.c:8363
0xa9bb96 gimplify_stmt(tree_node**, gimple_statement_base**)
../../gcc/gcc/gimplify.c:5526
0xa9d929 gimplify_body(tree_node*, bool)
../../gcc/gcc/gimplify.c:9250
0xa9df46 gimplify_function_tree(tree_node*)
../../gcc/gcc/gimplify.c:9408
0x92ccd7 cgraph_node::analyze()
../../gcc/gcc/cgraphunit.c:636
0x92fedb analyze_functions
../../gcc/gcc/cgraphunit.c:1028
0x930a68 symbol_table::finalize_compilation_unit()
../../gcc/gcc/cgraphunit.c:2477
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

[Bug c++/67686] New: [concepts] segfault in finish_call_expr function

2015-09-22 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67686

Bug ID: 67686
   Summary: [concepts] segfault in finish_call_expr function
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 36372
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36372=edit
preprocessed code

The attached code causes a segfault with gcc 6.0 when compiling with
-std=c++1z. Here's the stack trace:


In file included from
/home/rnburn/proj/echo/htl/include/echo/htl/algorithm.h:10:0,
 from /home/rnburn/proj/echo/htl/unittest/algorithm.cpp:1:
/home/rnburn/proj/echo/htl/include/echo/htl/concept.h: In instantiation of
‘constexpr const bool echo::htl::detail_concept::mappable_elements’:
/home/rnburn/proj/echo/htl/include/echo/htl/concept.h:70:22:   required from
‘constexpr const bool echo::htl::detail_concept::mappable_impl’
/home/rnburn/proj/echo/htl/unittest/algorithm.cpp:60:23:   required from here
/home/rnburn/proj/echo/htl/include/echo/htl/concept.h:40:66: internal compiler
error: Segmentation fault
 requires cpt_CopyConstructible<decltype(std::forward(functor)(
  ^
0xcacfef crash_signal
../../gcc/gcc/toplev.c:352
0x5edf35 resolve_args
../../gcc/gcc/cp/call.c:3951
0x60627d build_op_call_1
../../gcc/gcc/cp/call.c:4287
0x60627d build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
../../gcc/gcc/cp/call.c:4390
0x7901ba finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2408
0x68131f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15872
0x661a6c tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:13138
0x67cd12 tsubst_template_args
../../gcc/gcc/cp/pt.c:10839
0x660054 tsubst_aggr_type
../../gcc/gcc/cp/pt.c:11036
0x6621dc tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:12505
0x67e7ea tsubst_qualified_id
../../gcc/gcc/cp/pt.c:13335
0x68081b tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15452
0x66aad1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15044
0x823207 satisfy_predicate_constraint
../../gcc/gcc/cp/constraint.cc:1694
0x823207 satisfy_constraint_1
../../gcc/gcc/cp/constraint.cc:1898
0x8235cd satisfy_parameterized_constraint
../../gcc/gcc/cp/constraint.cc:1841
0x8235cd satisfy_constraint_1
../../gcc/gcc/cp/constraint.cc:1916
0x823f76 satisfy_constraint
../../gcc/gcc/cp/constraint.cc:1949
0x605b94 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
../../gcc/gcc/cp/call.c:4130
0x78ff5e finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2391
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

[Bug c++/67654] New: [concepts] ICE when using concepts in constexpr function

2015-09-20 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67654

Bug ID: 67654
   Summary: [concepts] ICE when using concepts in constexpr
function
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 36353
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36353=edit
reproduces problem

My version of gcc:
g++ (GCC) 6.0.0 20150915 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The attached code causes this internal compiler error:

main.cpp: In instantiation of ‘struct A<int, double>’:
main.cpp:24:18:   required from here
main.cpp:20:33: error: no matching function for call to ‘and_c()’
   A() requires and_c<C()...>() = default;
 ^
main.cpp:10:42: note: candidate: template constexpr bool
and_c()
 template  constexpr bool and_c() {
  ^
main.cpp:10:42: note:   template argument deduction/substitution failed:
main.cpp:20:33: internal compiler error: unexpected expression ‘C’ of kind
template_id_expr
   A() requires and_c<C()...>() = default;
 ^
0x816bc0 cxx_eval_constant_expression
../../gcc/gcc/cp/constexpr.c:3685
0x812e25 cxx_eval_call_expression
../../gcc/gcc/cp/constexpr.c:1186
0x81575f cxx_eval_constant_expression
../../gcc/gcc/cp/constexpr.c:3205
0x81a53b cxx_eval_outermost_constant_expr
../../gcc/gcc/cp/constexpr.c:3739
0x6846c6 convert_nontype_argument
../../gcc/gcc/cp/pt.c:6314
0x6846c6 convert_template_argument
../../gcc/gcc/cp/pt.c:7190
0x65a514 coerce_template_parameter_pack
../../gcc/gcc/cp/pt.c:7336
0x65a514 coerce_template_parms
../../gcc/gcc/cp/pt.c:7559
0x691bb3 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, bool, bool)
../../gcc/gcc/cp/pt.c:16871
0x5fa73b print_z_candidate
../../gcc/gcc/cp/call.c:3424
0x5fc33e print_z_candidates
../../gcc/gcc/cp/call.c:3494
0x605c17 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, bool, int)
../../gcc/gcc/cp/call.c:4104
0x78ff5e finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
../../gcc/gcc/cp/semantics.c:2391
0x68131f tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
../../gcc/gcc/cp/pt.c:15872
0x66aad1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
../../gcc/gcc/cp/pt.c:15044
0x822ed6 tsubst_predicate_constraint(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/constraint.cc:1416
0x824fbf tsubst_constraint_info(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/constraint.cc:1638
0x6739d0 tsubst_decl
../../gcc/gcc/cp/pt.c:11501
0x6624c6 tsubst(tree_node*, tree_node*, int, tree_node*)
../../gcc/gcc/cp/pt.c:12426
0x697a26 instantiate_class_template_1
../../gcc/gcc/cp/pt.c:9919
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

[Bug c++/67656] New: [concepts] matched variadics in expression constraint report as unmatched

2015-09-20 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67656

Bug ID: 67656
   Summary: [concepts] matched variadics in expression constraint
report as unmatched
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

In this code

/
template   
void consume(Xs&&...) {}

template   
struct A {  
  template 
requires requires(Ys... ys) {   
  consume(Xs{ys}...);   
}   
  A(Ys&&... ys) {   
  } 
};  

int main() {
  A<int, long> a(55, 2);
  return 0; 
} 
/

"consume(Xs{ys}...)" is a valid expression so the constructor should be called,
but gcc gives a mismatched pack lengths error.

# Error ##
t2.cpp: In instantiation of ‘struct A<int, long int>’:
t2.cpp:15:17:   required from here
t2.cpp:8:14: error: mismatched argument pack lengths while expanding ‘Xs{ys}’
   consume(Xs{ys}...);
  ^
t2.cpp: In function ‘int main()’:
t2.cpp:15:23: error: no matching function for call to ‘A<int, long int>::A(int,
int)’
   A<int, long> a(55, 2);
   ^
t2.cpp:10:3: note: candidate: A::A(Ys&& ...) [with Ys = {int, int}; Xs =
{int, long int}]
   A(Ys&&... ys) {
   ^
t2.cpp:10:3: note:   constraints not satisfied
t2.cpp:5:8: note: candidate: constexpr A<int, long int>::A(const A<int, long
int>&)
 struct A {
^
t2.cpp:5:8: note:   candidate expects 1 argument, 2 provided
t2.cpp:5:8: note: candidate: constexpr A<int, long int>::A(A<int, long int>&&)
t2.cpp:5:8: note:   candidate expects 1 argument, 2 provided

[Bug c++/67655] New: [concepts] expression constraints and variadic expansions

2015-09-20 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67655

Bug ID: 67655
   Summary: [concepts] expression constraints and variadic
expansions
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

I expect the following should be valid code:

### BEGIN CODE 
template   
void consume(Xs&&...) {}

template   
struct A {  
  template 
requires requires(Ys... ys) {   
  consume(Xs{ys}...);   
}   
  A(Ys&&... ys) {   
  } 
  A(int) {} 
};  

int main() {
  A<int, double> a(55); 
  return 0; 
} 
### END CODE 

with the first first of the constructor being disabled and the second matching.
But this gives the compilation error:

t2.cpp: In instantiation of ‘struct A<int, double>’:
t2.cpp:16:19:   required from here
t2.cpp:8:14: error: mismatched argument pack lengths while expanding ‘Xs{ys}’
   consume(Xs{ys}...);

Looking through N4377, I'm not entirely sure how this should be treated, but
would think it should just mean that the expression constraint
consume(Xs{ys}...) shouldn't be satisfied instead of triggering a hard error.

[Bug c++/67658] New: [concepts] invalid code with constrained concepts compiles

2015-09-20 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67658

Bug ID: 67658
   Summary: [concepts] invalid code with constrained concepts
compiles
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

This code compiles with gcc

g++ (GCC) 6.0.0 20150915 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

//
template concept bool C1() { return false; }   
template concept bool C2() { return true; }   

void f(C2 x) {  
}   

struct A {} a;  

int main() {
  f(a); 
}
//

>From page 17 example 6.3 of N4377
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4377.pdf), it looks
like constrained concepts are not allowed. And even if they were, the
constraints on concept C2 should not be satisfied.


[Bug c++/67641] New: gcc segfaults when compiling in debug mode

2015-09-19 Thread ryan.burn at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67641

Bug ID: 67641
   Summary: gcc segfaults when compiling in debug mode
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: ryan.burn at gmail dot com
  Target Milestone: ---

Created attachment 36350
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36350=edit
files to reproduce

The below steps cause gcc to segfault when building with a recent version from
trunk:

g++ (GCC) 6.0.0 20150915 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

## Steps to Reproduce
1. unpack the tartar (I couldn't reproduce if I preprocessed the code)
2. Change into the director and run the following
g++ -I. -g -c -o core-test.o core-test.cpp

## Stack Trace
rnburn@localhost ~/bugs/gcc_test_segfault/segfault $ /home/rnburn/local/bin/g++
-I. -g -c -o core-test.o core-test.cpp 
In file included from /home/rnburn/local/include/c++/6.0.0/map:61:0,
 from ./catch.hpp:3331,
 from core-test.cpp:2:
/home/rnburn/local/include/c++/6.0.0/bits/stl_map.h: In instantiation of ‘class
std::map<std::__cxx11::basic_string,
Catch::SectionTracking::TrackedSection>’:
./catch.hpp:4856:25:   required from here
/home/rnburn/local/include/c++/6.0.0/bits/stl_map.h:96:11: error:
TYPE_CANONICAL is not compatible
 class map
   ^
 
asm_written unsigned SI
size 
unit size 
align 32 symtab -291691504 alias set -1 canonical type
0x7f7fef0731f8 precision 32 min  max 
values 
local bindings <(nil)>> value 
chain 
local bindings <(nil)>> value 
chain 
local bindings <(nil)>> value 
chain  value >>>> context 
chain >
readonly constant VOID file ./catch.hpp line 4811 col 13
align 1 context  initial

chain 
readonly constant VOID file ./catch.hpp line 4810 col 13
align 1 context  initial
 chain >>
context 
full-name "const class Catch::SectionTracking::TrackedSection"
n_parents=0 use_template=0 interface-unknown
pointer_to_this  reference_to_this
>
 
asm_written unsigned SI
size 
unit size 
align 32 symtab -291691504 alias set -1 canonical type
0x7f7fef0731f8 precision 32 min  max 
values 
local bindings <(nil)>> value 
chain 
local bindings <(nil)>> value 
chain 
local bindings <(nil)>> value 
chain  value >>>> context 
chain >
private decl_3 VOID file ./catch.hpp line 4855 col 18
align 1 offset_align 1 context 
chain 
private decl_3 VOID file ./catch.hpp line 4854 col 21
align 1 offset_align 1 context  chain >> context

full-name "const mapped_type"
n_parents=0 use_template=0 interface-unknown reference_to_this
>
/home/rnburn/local/include/c++/6.0.0/bits/stl_map.h:96:11: internal compiler
error: verify_type failed
0xf4a3e9 verify_type(tree_node const*)
../../gcc/gcc/tree.c:13583
0x9ab124 gen_type_die_with_usage
../../gcc/gcc/dwarf2out.c:20707
0x9abc40 gen_type_die_with_usage
../../gcc/gcc/dwarf2out.c:20805
0x9ac7a6 gen_type_die
../../gcc/gcc/dwarf2out.c:20901
0x9b905f gen_decl_die
../../gcc/gcc/dwarf2out.c:21448
0x9aaacc gen_member_die
../../gcc/gcc/dwarf2out.c:20399
0x9aaacc gen_struct_or_union_type_die
../../gcc/gcc/dwarf2out.c:20483
0x9aaacc gen_tagged_type_die
../../gcc/gcc/dwarf2out.c:20684
0x9abc0d gen_type_die_with_usage
../../gcc/gcc/dwarf2out.c:20846
0x9ac7a6 gen_type_die
../../gcc/gcc/dwarf2out.c:20901
0x9b8de1 gen_decl_die
../../gcc/gcc/dwarf2out.c:21487
0x9b989c dwarf2out_decl
../../gcc/gcc/dwarf2out.c:21937
0x9b9bcb dwarf2out_type_decl
../../gcc/gcc/dwarf2out.c:21647
0xbe84af rest_of_type_compilation(tree_node*, int)
../../gcc/gcc/passes.c:339
0x6cfaec finish_struct_1(tree_node*)
../../gcc/gcc/cp/class.c:6747
0x6976ac instantiate_class_template_1
../../gcc/gcc/cp/pt.c:10201
0x6976ac instantiate_class_template(tree_node*)
../../gcc/gcc/cp/pt.c:10241
0x73c8ab complete_type(tree_node*)
../../gcc/gcc/cp/typeck.c:138
0x63c8a9 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)

  1   2   >