[Bug c++/96848] New: Inherited conditionally explicit constructors via using declaration do not enforce explicitness if dependent on template parameter

2020-08-29 Thread northon_patrick3 at yahoo dot ca
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96848

Bug ID: 96848
   Summary: Inherited conditionally explicit constructors via
using declaration do not enforce explicitness if
dependent on template parameter
   Product: gcc
   Version: 10.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: northon_patrick3 at yahoo dot ca
  Target Milestone: ---

Example: https://godbolt.org/z/4x9r7e

```cpp
#include 
#include 

struct E {};
struct F {};
struct G {};

template 
constexpr bool isValidImplicitConvert = false;
template <>
constexpr bool isValidImplicitConvert = true;

template 
struct A
{
template 
explicit(!isValidImplicitConvert) constexpr A(const OT_ &) {}

//explicit(isValidImplicitConvert) constexpr A(E) {}
//explicit(isValidImplicitConvert) constexpr A(F) {}
};

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

int main(int, char **)
{
std::cout << std::is_convertible_v> << '\n';
std::cout << std::is_convertible_v> << '\n';

std::cout << std::is_convertible_v> << '\n';
std::cout << std::is_convertible_v> << '\n';

return 0;
}
```

Output:
```
1
0
1
1
```

Expected output:
```
1
0
1
0
```

When inheriting constructors from a base class via a using declaration, if said
constructors are conditionally explicit and the condition is dependent on a
deduced template parameter, the explicit state is ignored.

Clang give the expected output, however I am not sure who is correct.

[Bug c++/105839] internal compiler error: in tsubst_omp_for_iterator with openmp and structured bindings in a template

2023-03-01 Thread northon_patrick3 at yahoo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105839

--- Comment #4 from northon_patrick3 at yahoo dot ca ---
Actually is still crash even on valid code:

```
template 
void
foo (const T &x)
{
  [&] (auto&& y)
  {
#pragma omp parallel for
for (auto&& [v1, v2] : x)
  ;
  } ([]{});
}

struct A { int a, b; };

void
bar ()
{
  A a[10];
  foo (a);
}
```

[Bug c++/105797] New: Internal compiler error: Segmentation fault ( fn_type_unification -> satisfaction_cache::satisfaction_cache -> iterative_hash_template_arg )

2022-05-31 Thread northon_patrick3 at yahoo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105797

Bug ID: 105797
   Summary: Internal compiler error: Segmentation fault (
fn_type_unification ->
satisfaction_cache::satisfaction_cache ->
iterative_hash_template_arg )
   Product: gcc
   Version: 12.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: northon_patrick3 at yahoo dot ca
  Target Milestone: ---

Created attachment 53061
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53061&action=edit
Result from -freport-bug

The code:
```
#include 
#include 

template 
struct AStruct
{
using value_type = T_;
};

template 
constexpr auto fc1(AStruct v)
requires std::integral::value_type>
//requires std::integral
{ return v; }

template 
constexpr auto fc2(AStruct v1, AStruct v2)
requires std::integral::value_type>
{ return v1; }

void test(AStruct v1, AStruct v2)
{ fc2(v1, v2); }

void test2(AStruct v)
{ fc1(v); }
```


The command line:

```
g++ -std=c++20 test.cpp
```


The error:

```
test.cpp: In substitution of ‘template constexpr auto
fc1(AStruct) requires  integral::type::value_type> [with T_ = int]’:
test.cpp:25:7:   required from here
test.cpp:25:14: internal compiler error: Segmentation fault
   25 | { fc1(v); }
  |   ~~~^~~
0x1ac4724 internal_error(char const*, ...)
???:0
0x7f1693 iterative_hash_template_arg(tree_node*, unsigned int)
???:0
0x6bf9da satisfaction_cache::satisfaction_cache(tree_node*, tree_node*,
sat_info)
???:0
0x81bbd4 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
???:0
0x69d051 build_new_function_call(tree_node*, vec**, int)
???:0
0x836c31 finish_call_expr(tree_node*, vec**, bool,
bool, int)
???:0
0x7eaa63 c_parse_file()
???:0
0x914adb c_common_parse_file()
???:0
```


It happens from GCC 11.1 and onward to GCC 13 at commit
271072ca259dd285e7723d9bf6da7295e4090dfa.

GCC is configured with:

```
configure --prefix=/opt/pat-gcc --libdir=/opt/pat-gcc/lib
--libexecdir=/opt/pat-gcc/lib --enable-languages=c,c++,lto --with-isl
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id
--enable-lto --enable-multilib --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-libunwind-exceptions --disable-werror
gdc_include_dir=/opt/pat-gcc/include/dlang/gdc
```


If I comment out either one of test or test2 functions, it compiles. If I
change either one of the requires clause to use T_ or T1_ instead of decltype,
it compiles. If I change either one of fc1 or fc2 to use auto instead of a
template<> clause, it compiles. So it seem to crash at a very specific
condition.

[Bug libgomp/105839] New: internal compiler error: in tsubst_omp_for_iterator, at cp/pt.cc:18122 (instantiate_pending_templates -> instantiate_decl -> tsubst_lambda_expr)

2022-06-03 Thread northon_patrick3 at yahoo dot ca via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105839

Bug ID: 105839
   Summary: internal compiler error: in tsubst_omp_for_iterator,
at cp/pt.cc:18122 (instantiate_pending_templates ->
instantiate_decl -> tsubst_lambda_expr)
   Product: gcc
   Version: 12.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libgomp
  Assignee: unassigned at gcc dot gnu.org
  Reporter: northon_patrick3 at yahoo dot ca
CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Created attachment 53079
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53079&action=edit
Result from -freport-bug

The code:
```
void test(const auto &b1)
{
const auto loopImpl = [&](auto&& fc)
{
#pragma omp parallel for
for(auto&& [v1, v2] : b1);
};

loopImpl([]{});
}

void test2()
{
int a[10];
test(a);
}
```

The command line:
```
g++ -fopenmp test.cpp
```

The error:
```
internal compiler error: in tsubst_omp_for_iterator, at cp/pt.cc:18126
   11 | for(auto&& [v1, v2] : b1);
  | ^~~
0x1ac4724 internal_error(char const*, ...)
???:0
0x663b55 fancy_abort(char const*, int, char const*)
???:0
0x81d054 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0x80614a tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
???:0
0x7fedbe instantiate_decl(tree_node*, bool, bool)
???:0
0x81e704 instantiate_pending_templates(int)
???:0
0x7173d1 c_parse_final_cleanups()
???:0
```

GCC is configured with:

```
configure --prefix=/opt/pat-gcc --libdir=/opt/pat-gcc/lib
--libexecdir=/opt/pat-gcc/lib --enable-languages=c,c++,lto --with-isl
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id
--enable-lto --enable-multilib --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-libunwind-exceptions --disable-werror
gdc_include_dir=/opt/pat-gcc/include/dlang/gdc
```

It happens from version 10.1 to latest commit at this date.

It no longer crash if:
- I don't use structured bindings.
- b1 isn't a template.
- I remove `auto&& fc`.