[Bug c++/85415] New: internal compiler error: in finish_member_declaration, at cp/semantics.c:2984

2018-04-16 Thread frederik.engels24 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85415

Bug ID: 85415
   Summary: internal compiler error: in finish_member_declaration,
at cp/semantics.c:2984
   Product: gcc
   Version: 7.3.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: frederik.engels24 at gmail dot com
  Target Milestone: ---

Created attachment 43944
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43944&action=edit
testcase triggering error

Not sure if this is similar to #82722.
Seems to happen when trying to use fold expressions, but the same thing
occurred when I used std::make_tuple to execute over all tuple members.
The same code compiles in clang 6.0.0 and MSVC

Here is the full output, with the testcase as an attachment

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --enable-multilib --disable-werror
--enable-checking=release --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 7.3.1 20180312 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-Wall' '-Wextra' '-save-temps' '-std=c++1z' '-o'
'testcase' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/cc1plus -E -quiet -v -D_GNU_SOURCE
testcase.cpp -mtune=generic -march=x86-64 -std=c++1z -Wall -Wextra
-fpch-preprocess -o testcase.ii
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../include/c++/7.3.1

/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../include/c++/7.3.1/x86_64-pc-linux-gnu
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../include/c++/7.3.1/backward
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/include
 /usr/local/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-Wall' '-Wextra' '-save-temps' '-std=c++1z' '-o'
'testcase' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.1/cc1plus -fpreprocessed testcase.ii
-quiet -dumpbase testcase.cpp -mtune=generic -march=x86-64 -auxbase testcase
-Wall -Wextra -std=c++1z -version -o testcase.s
GNU C++14 (GCC) version 7.3.1 20180312 (x86_64-pc-linux-gnu)
compiled by GNU C version 7.3.1 20180312, GMP version 6.1.2, MPFR
version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++14 (GCC) version 7.3.1 20180312 (x86_64-pc-linux-gnu)
compiled by GNU C version 7.3.1 20180312, GMP version 6.1.2, MPFR
version 4.0.1, MPC version 1.1.0, isl version isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 3fb60f63f2e4dccab1b015b716b8b627
testcase.cpp: In instantiation of
‘tuple_vector::clear_all():: [with auto:1 =
{std::vector >, std::vector
>, std::vector >}; Ts = {int, bool, double}]’:
/usr/include/c++/7.3.1/type_traits:2428:26:   required by substitution of
‘template static std::__result_of_success()((declval<_Args>)()...)), std::__invoke_other>
std::__result_of_other_impl::_S_test(int) [with _Fn =
tuple_vector::clear_all() [with Ts = {int, bool, double}]::; _Args = {std::vector >&, std::vector >&, std::vector >&}]’
/usr/include/c++/7.3.1/type_traits:2439:55:   required from ‘struct
std::__result_of_impl::clear_all() [with Ts =
{int, bool, double}]::, std::vector >&, std::vector >&,
std::vector >&>’
/usr/include/c++/7.3.1/type_traits:2444:12:   required from ‘struct
std::__invoke_result::clear_all() [with Ts = {int, bool,
double}]::, std::vector >&,
std::vector >&, std::vector >&>’
/usr/include/c++/7.3.1/bits/invoke.h:89:5:   required by substitution of
‘template constexpr typename
std::__invoke_result<_Functor, _ArgTypes>::type std::__invoke(_Callable&&,
_Args&& ...) [with _Callable = tup

[Bug c++/91466] New: [concepts] indicates "used in its own initializer" when not, constraint order change passes compilation.

2019-08-15 Thread frederik.engels24 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91466

Bug ID: 91466
   Summary: [concepts] indicates "used in its own initializer"
when not, constraint order change passes compilation.
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: frederik.engels24 at gmail dot com
  Target Milestone: ---

Run using "g++ (Compiler-Explorer-Build) 10.0.0 20190814 (experimental)" with
options "-std=c++2a -fconcepts"
and source code: https://godbolt.org/z/aGw2d0

~`
#include 
#include 

template
concept integral_constant_ = std::is_empty_v && std::is_trivial_v &&
requires
{
typename T::value_type;
requires std::is_integral_v;
{ T::value } -> typename T::value_type;
};

struct sz_fn
{
template requires requires(R&& r) { {static_cast(r).size()} ->
integral_constant_; }
constexpr auto operator()(R&& r) {
return static_cast(r).size();
}
};

constexpr auto sz = sz_fn{};


int main()
{
auto arr = std::array{1, 2, 3, 4, 5};

return !std::is_invocable_v;
}
~~~

results in:

In file included from :1:

/opt/compiler-explorer/gcc-trunk-20190815/include/c++/10.0.0/type_traits: In
substitution of 'template static
std::__result_of_success()((declval<_Args>)()...)),
std::__invoke_other> std::__result_of_other_impl::_S_test(int) [with _Fn =
const sz_fn; _Args = {std::array}]':

/opt/compiler-explorer/gcc-trunk-20190815/include/c++/10.0.0/type_traits:2563:55:
  required from 'struct std::__result_of_impl >'

/opt/compiler-explorer/gcc-trunk-20190815/include/c++/10.0.0/type_traits:2976:12:
  recursively required by substitution of 'template
struct std::__is_invocable_impl<_Result, _Ret, std::__void_t > [with _Result = std::__invoke_result >; _Ret = void]'

/opt/compiler-explorer/gcc-trunk-20190815/include/c++/10.0.0/type_traits:2976:12:
  required from 'struct std::is_invocable >'

/opt/compiler-explorer/gcc-trunk-20190815/include/c++/10.0.0/type_traits:3021:27:
  required from 'constexpr const bool std::is_invocable_v >'

:28:18:   required from here

/opt/compiler-explorer/gcc-trunk-20190815/include/c++/10.0.0/type_traits:2552:26:
error: the value of 'std::is_empty_v' is not usable in a
constant expression

 2552 |   std::declval<_Fn>()(std::declval<_Args>()...)

  |   ~~~^~

/opt/compiler-explorer/gcc-trunk-20190815/include/c++/10.0.0/type_traits:3103:25:
note: 'std::is_empty_v' used in its own initializer

 3103 |   inline constexpr bool is_empty_v = is_empty<_Tp>::value;

  | ^~

/opt/compiler-explorer/gcc-trunk-20190815/include/c++/10.0.0/type_traits:2552:26:
error: the value of 'std::is_trivial_v' is not usable in a
constant expression

 2552 |   std::declval<_Fn>()(std::declval<_Args>()...)

  |   ~~~^~

/opt/compiler-explorer/gcc-trunk-20190815/include/c++/10.0.0/type_traits:3092:25:
note: 'std::is_trivial_v' used in its own initializer

 3092 |   inline constexpr bool is_trivial_v = is_trivial<_Tp>::value;

  | ^~~~

Compiler returned: 1


Changing

template
concept integral_constant_ = std::is_empty_v && std::is_trivial_v &&
requires
{
typename T::value_type;
requires std::is_integral_v;
{ T::value } -> typename T::value_type;
};
~`
to
~
template
concept integral_constant_ =
requires
{
typename T::value_type;
requires std::is_integral_v;
{ T::value } -> typename T::value_type;
} && std::is_empty_v && std::is_trivial_v;
~~~

Allows the program to compile successfully.

[Bug c++/91467] New: [concepts] ICE: in tsubst_copy, at cp/pt.c:15545

2019-08-15 Thread frederik.engels24 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91467

Bug ID: 91467
   Summary: [concepts] ICE: in tsubst_copy, at cp/pt.c:15545
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: frederik.engels24 at gmail dot com
  Target Milestone: ---

Run with "g++ (Compiler-Explorer-Build) 10.0.0 20190814 (experimental)"
and options "-std=c++2a -fconcepts"

source code: https://godbolt.org/z/tOIbPZ
~~~
template
struct foo {
T t;

template
void set(U&& u) requires requires { { static_cast(u)} -> T; }
{
t = static_cast(u);
}
};

int main()
{
auto w = foo{5};
w.set(5.0f);
}
~~
resulting in
~~
: In function 'int main()':

:15:15: internal compiler error: in tsubst_copy, at cp/pt.c:15545

   15 | w.set(5.0f);

  |   ^

Please submit a full bug report,

with preprocessed source if appropriate.

See <https://gcc.gnu.org/bugs/> for instructions.

Compiler returned: 1
~

[Bug c++/91487] New: [concepts] alias constraint not respected

2019-08-18 Thread frederik.engels24 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91487

Bug ID: 91487
   Summary: [concepts] alias constraint not respected
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: frederik.engels24 at gmail dot com
  Target Milestone: ---

The following should fail to compile since it doesn't pass the only_int
constraint.

https://godbolt.org/z/HrB1wz (gcc version 10.0.0 20190817)

#include 

template
requires std::is_same_v
using only_int = T;

template
using forward = only_int;

int main()
{
forward f;
}

[Bug c++/91662] New: [concepts] unable to deduce placeholder type, should be accepted

2019-09-04 Thread frederik.engels24 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91662

Bug ID: 91662
   Summary: [concepts] unable to deduce placeholder type, should
be accepted
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: frederik.engels24 at gmail dot com
  Target Milestone: ---

The following should compile but doesn't on current gcc-trunk (20190902)
with options: "-std=c++2a -fconcepts"

godbolt: https://godbolt.org/z/3jvFqX

#include 
#include 

template
concept same_as = std::is_same_v && std::is_same_v;

template
concept assignable_from = 
requires(LHS lhs, RHS&& rhs) {
{ lhs = std::forward(rhs) } -> same_as;
};

template T>
void foo(T&& t) {}

int main()
{
int i = 0;
foo(i);
}

with output

: In function 'int main()':

:19:10: error: cannot call function 'void foo(T&&) [with T = int&]'

   19 | foo(i);

  |  ^

:14:6: note:   constraints not satisfied

   14 | void foo(T&& t) {}

  |  ^~~

:8:9: note: within 'template concept const bool
assignable_from [with LHS = int&; RHS = int]'

8 | concept assignable_from =

  | ^~~

:8:9: note: with 'int& lhs'

:8:9: note: with 'int&& rhs'

:8:9: note: unable to deduce placeholder type 'same_as' from 'lhs
=(forward)(rhs)'

ASM generation compiler returned: 1

: In function 'int main()':

:19:10: error: cannot call function 'void foo(T&&) [with T = int&]'

   19 | foo(i);

  |  ^

:14:6: note:   constraints not satisfied

   14 | void foo(T&& t) {}

  |  ^~~

:8:9: note: within 'template concept const bool
assignable_from [with LHS = int&; RHS = int]'

8 | concept assignable_from =

  | ^~~

:8:9: note: with 'int& lhs'

:8:9: note: with 'int&& rhs'

:8:9: note: unable to deduce placeholder type 'same_as' from 'lhs
=(forward)(rhs)'

Execution build compiler returned: 1