[Bug c++/96408] New: C++20 new attribute [[no_unique_address]] occurs the internal compile error

2020-08-01 Thread hewillk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96408

Bug ID: 96408
   Summary: C++20 new attribute [[no_unique_address]] occurs the
internal compile error
   Product: gcc
   Version: 10.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

Using built-in specs.
COLLECT_GCC=/usr/local/bin/gcc-10
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/10.1.0/libexec/gcc/x86_64-apple-darwin17/10.1.0/lto-wrapper
Target: x86_64-apple-darwin17
Configured with: ../configure --build=x86_64-apple-darwin17
--prefix=/usr/local/Cellar/gcc/10.1.0
--libdir=/usr/local/Cellar/gcc/10.1.0/lib/gcc/10 --disable-nls
--enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran
--program-suffix=-10 --with-gmp=/usr/local/opt/gmp
--with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc
--with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew
GCC 10.1.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues
--disable-multilib SED=/usr/bin/sed
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.1.0 (Homebrew GCC 10.1.0) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++2a'
'-mmacosx-version-min=10.13.0' '-asm_macosx_version_min=10.13' '-mtune=core2'
 /usr/local/Cellar/gcc/10.1.0/libexec/gcc/x86_64-apple-darwin17/10.1.0/cc1plus
-E -quiet -v -D__DYNAMIC__ main.cpp -fPIC -mmacosx-version-min=10.13.0
-mtune=core2 -std=c++2a -fpch-preprocess -o main.ii
ignoring duplicate directory "/usr/local/include"
ignoring nonexistent directory
"/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/../../../../../../x86_64-apple-darwin17/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 /usr/local/include

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/../../../../../../include/c++/10.1.0

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/../../../../../../include/c++/10.1.0/x86_64-apple-darwin17

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/../../../../../../include/c++/10.1.0/backward

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/include
 /usr/local/Cellar/gcc/10.1.0/include

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/include-fixed
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++2a'
'-mmacosx-version-min=10.13.0' '-asm_macosx_version_min=10.13' '-mtune=core2'
 /usr/local/Cellar/gcc/10.1.0/libexec/gcc/x86_64-apple-darwin17/10.1.0/cc1plus
-fpreprocessed main.ii -fPIC -quiet -dumpbase main.cpp
-mmacosx-version-min=10.13.0 -mtune=core2 -auxbase main -std=c++2a -version -o
main.s
GNU C++17 (Homebrew GCC 10.1.0) version 10.1.0 (x86_64-apple-darwin17)
compiled by GNU C version 10.1.0, GMP version 6.2.0, MPFR version
4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++17 (Homebrew GCC 10.1.0) version 10.1.0 (x86_64-apple-darwin17)
compiled by GNU C version 10.1.0, GMP version 6.2.0, MPFR version
4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: b1074358e29f54f1a357a06623845700
during RTL pass: expand
main.cpp: In copy constructor 'vector::vector(const vector&)':
main.cpp:7:109: internal compiler error: in assign_temp, at function.c:984
7 | :
alloc_(std::allocator_traits>::select_on_container_copy_construction(other.alloc_))
{ }
  |
^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/Homebrew/homebrew-core/issues> for instructions.

[Bug c++/96408] C++20 new attribute [[no_unique_address]] occurs the internal compile error

2020-08-01 Thread hewillk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96408

--- Comment #1 from 康桓瑋  ---
Created attachment 48976
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48976&action=edit
the preprocessed file

gcc -v -save-temps -std=c++20 main.cpp

[Bug c++/96409] New: A lambda with a template parameter list inside the template function using C++20 nested requirements clauses occurs internal compiler error

2020-08-01 Thread hewillk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96409

Bug ID: 96409
   Summary: A lambda with a template parameter list inside the
template function using C++20 nested requirements
clauses occurs internal compiler error
   Product: gcc
   Version: 10.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

Created attachment 48977
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48977&action=edit
the preprocessed file

Using built-in specs.
COLLECT_GCC=/usr/local/bin/gcc-10
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/10.1.0/libexec/gcc/x86_64-apple-darwin17/10.1.0/lto-wrapper
Target: x86_64-apple-darwin17
Configured with: ../configure --build=x86_64-apple-darwin17
--prefix=/usr/local/Cellar/gcc/10.1.0
--libdir=/usr/local/Cellar/gcc/10.1.0/lib/gcc/10 --disable-nls
--enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran
--program-suffix=-10 --with-gmp=/usr/local/opt/gmp
--with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc
--with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew
GCC 10.1.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues
--disable-multilib SED=/usr/bin/sed
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.1.0 (Homebrew GCC 10.1.0) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++2a'
'-mmacosx-version-min=10.13.0' '-asm_macosx_version_min=10.13' '-mtune=core2'
 /usr/local/Cellar/gcc/10.1.0/libexec/gcc/x86_64-apple-darwin17/10.1.0/cc1plus
-E -quiet -v -D__DYNAMIC__ main.cpp -fPIC -mmacosx-version-min=10.13.0
-mtune=core2 -std=c++2a -fpch-preprocess -o main.ii
ignoring duplicate directory "/usr/local/include"
ignoring nonexistent directory
"/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/../../../../../../x86_64-apple-darwin17/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 /usr/local/include

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/../../../../../../include/c++/10.1.0

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/../../../../../../include/c++/10.1.0/x86_64-apple-darwin17

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/../../../../../../include/c++/10.1.0/backward

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/include
 /usr/local/Cellar/gcc/10.1.0/include

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/include-fixed
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++2a'
'-mmacosx-version-min=10.13.0' '-asm_macosx_version_min=10.13' '-mtune=core2'
 /usr/local/Cellar/gcc/10.1.0/libexec/gcc/x86_64-apple-darwin17/10.1.0/cc1plus
-fpreprocessed main.ii -fPIC -quiet -dumpbase main.cpp
-mmacosx-version-min=10.13.0 -mtune=core2 -auxbase main -std=c++2a -version -o
main.s
GNU C++17 (Homebrew GCC 10.1.0) version 10.1.0 (x86_64-apple-darwin17)
compiled by GNU C version 10.1.0, GMP version 6.2.0, MPFR version
4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++17 (Homebrew GCC 10.1.0) version 10.1.0 (x86_64-apple-darwin17)
compiled by GNU C version 10.1.0, GMP version 6.2.0, MPFR version
4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: b1074358e29f54f1a357a06623845700
main.cpp: In instantiation of 'void f(T) [with T = std::vector]':
main.cpp:14:23:   required from here
main.cpp:7:39: internal compiler error: in dependent_type_p, at cp/pt.c:26343
7 | if constexpr (requires { requires std::same_as>; });
  | 
~^~~~
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://github.com/Homebrew/homebrew-core/issues> for instructions.

[Bug c++/96409] A lambda with a template parameter list inside the template function using C++20 nested requirements clauses occurs internal compiler error

2020-08-01 Thread hewillk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96409

--- Comment #1 from 康桓瑋  ---
Created attachment 48978
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48978&action=edit
the source file

[Bug c++/96408] C++20 new attribute [[no_unique_address]] occurs the internal compile error

2020-08-01 Thread hewillk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96408

--- Comment #2 from 康桓瑋  ---
Created attachment 48979
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48979&action=edit
the source file

[Bug c++/96410] New: A lambda with a template parameter list using C++20 requires clauses is not usable in a constant expression

2020-08-01 Thread hewillk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96410

Bug ID: 96410
   Summary: A lambda with a template parameter list using C++20
requires clauses is not usable in a constant
expression
   Product: gcc
   Version: 10.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

Created attachment 48980
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48980&action=edit
the preprocessed file

The following code:


#include 

template 
void f(T t) {
  auto g = [](U u) {
if constexpr (requires { std::integral; });
  };
  g(t);
}

int main()
{
  f(1);
}


will occurs compile error:


: In instantiation of 'void f(T) [with T = int]':
:13:6:   required from here
/opt/compiler-explorer/gcc-10.2.0/include/c++/10.2.0/concepts:102:13:  
required by the constraints of 'template concept std::integral'
/opt/compiler-explorer/gcc-10.2.0/include/c++/10.2.0/concepts:102:24: error:
the value of 'std::is_integral_v' is not usable in a constant expression
  102 | concept integral = is_integral_v<_Tp>;
  |^~
In file included from
/opt/compiler-explorer/gcc-10.2.0/include/c++/10.2.0/concepts:44,
 from :1:
/opt/compiler-explorer/gcc-10.2.0/include/c++/10.2.0/type_traits:3031:25: note:
'std::is_integral_v' used in its own initializer
 3031 |   inline constexpr bool is_integral_v = is_integral<_Tp>::value;
  | ^
ASM generation compiler returned: 1


This seems weird since the type U can be deduced in the compiler time.
command line:

$ gcc -v -save-temps -std=c++20 main.cpp 
Using built-in specs.
COLLECT_GCC=/usr/local/bin/gcc-10
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/10.1.0/libexec/gcc/x86_64-apple-darwin17/10.1.0/lto-wrapper
Target: x86_64-apple-darwin17
Configured with: ../configure --build=x86_64-apple-darwin17
--prefix=/usr/local/Cellar/gcc/10.1.0
--libdir=/usr/local/Cellar/gcc/10.1.0/lib/gcc/10 --disable-nls
--enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran
--program-suffix=-10 --with-gmp=/usr/local/opt/gmp
--with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc
--with-isl=/usr/local/opt/isl --with-system-zlib --with-pkgversion='Homebrew
GCC 10.1.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues
--disable-multilib SED=/usr/bin/sed
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.1.0 (Homebrew GCC 10.1.0) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++2a'
'-mmacosx-version-min=10.13.0' '-asm_macosx_version_min=10.13' '-mtune=core2'
 /usr/local/Cellar/gcc/10.1.0/libexec/gcc/x86_64-apple-darwin17/10.1.0/cc1plus
-E -quiet -v -D__DYNAMIC__ main.cpp -fPIC -mmacosx-version-min=10.13.0
-mtune=core2 -std=c++2a -fpch-preprocess -o main.ii
ignoring duplicate directory "/usr/local/include"
ignoring nonexistent directory
"/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/../../../../../../x86_64-apple-darwin17/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 /usr/local/include

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/../../../../../../include/c++/10.1.0

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/../../../../../../include/c++/10.1.0/x86_64-apple-darwin17

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/../../../../../../include/c++/10.1.0/backward

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/include
 /usr/local/Cellar/gcc/10.1.0/include

/usr/local/Cellar/gcc/10.1.0/lib/gcc/10/gcc/x86_64-apple-darwin17/10.1.0/include-fixed
 /usr/include
 /System/Library/Frameworks
 /Library/Frameworks
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++2a'
'-mmacosx-version-min=10.13.0' '-asm_macosx_version_min=10.13' '-mtune=core2'
 /usr/local/Cellar/gcc/10.1.0/libexec/gcc/x86_64-apple-darwin17/10.1.0/cc1plus
-fpreprocessed main.ii -fPIC -quiet -dumpbase main.cpp
-mmacosx-version-min=10.13.0 -mtune=core2 -auxbase main -std=c++2a -version -o
main.s
GNU C++17 (Homebrew GCC 10.1.0) version 10.1.0 (x86_64-apple-darwin17)
compiled by GNU C version 10.1.0, GMP version 6.2.0, MPFR version
4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++17 (Homebrew GCC 10.1.0) version 10.1.0 (x86_64-apple-darwin17)
compiled by GNU C version 10.1.0, GMP version 6.2.0, MPFR version
4.0.2, MPC version 1.1.0, isl version isl-0.22.1-GMP

G

[Bug c++/96410] A lambda with a template parameter list inside the template function using C++20 requires clauses is not usable in a constant expression

2020-08-01 Thread hewillk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96410

--- Comment #1 from 康桓瑋  ---
Equivalent example:
https://godbolt.org/z/chYW3c

[Bug c++/96408] C++20 new attribute [[no_unique_address]] occurs internal compile error

2020-08-01 Thread hewillk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96408

--- Comment #3 from 康桓瑋  ---
Live example:
https://godbolt.org/z/vMT5Md

[Bug c++/96409] A lambda with a template parameter list inside the template function using C++20 nested requirements clauses occurs internal compiler error

2020-08-01 Thread hewillk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96409

--- Comment #2 from 康桓瑋  ---
Equivalent example:
https://godbolt.org/z/n47Gfh

[Bug c++/96497] New: Compare std::variant with int using C++20 <=> is not a constant expression

2020-08-06 Thread hewillk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96497

Bug ID: 96497
   Summary: Compare std::variant with int using C++20 <=> is not a
constant expression
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

#include 
#include 

using variant = std::variant;

constexpr auto operator<=>(const variant& v, const auto& u) {
  return std::visit([&u](const auto& t) -> std::partial_ordering { return t <=>
u; }, v);
}

constexpr variant v{1};
static_assert(v < 2);

This fails on gcc 11.0 with:
: In function 'int main()':
:12:19: error: non-constant condition for static assertion
   12 |   static_assert(v < 2);
  | ~~^~~
:12:19: error: '' is not a constant expression

but if I initialize the v with double, it can compile:

constexpr variant v{1.0};
static_assert(v < 2);

godbolt link:
https://godbolt.org/z/eE9c97

[Bug c++/96499] New: Compare std::variant with int using C++20 <=> occurs internal compiler error

2020-08-06 Thread hewillk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96499

Bug ID: 96499
   Summary: Compare std::variant with int using C++20 <=> occurs
internal compiler error
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

#include 

constexpr auto operator<=>(const auto& v, const auto& u) {
  return std::visit([&u](const auto& t) { return t <=> u; }, v);
}

constexpr std::variant v{1};
static_assert(v < 2);

This will occurs internal compiler error for gcc-trunk.

godbolt link:
https://godbolt.org/z/EcGKc3

[Bug c++/96575] New: std::ranges::sort is not usable as a 'constexpr' function when saving its return value in lambda function

2020-08-11 Thread hewillk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96575

Bug ID: 96575
   Summary: std::ranges::sort is not usable as a 'constexpr'
function when saving its return value in lambda
function
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

(https://godbolt.org/z/W8zx58)

#include 
#include 

constexpr auto f(auto algo) {
  return [=] {
// this one is okay
// algo(std::array{1, 0});
// this one is also okay
// auto it = algo(std::array{0, 1});
auto it = algo(std::array{1, 0});
return 0;
  }();
}

int main()
{
  static_assert(f(std::ranges::sort) == 0); 
}


This fails on gcc 10.2 and trunk with:

:13:23: error: 'constexpr auto f(auto:16) [with auto:16 =
std::ranges::__sort_fn]' called in a constant expression
   13 |   constexpr auto i = f(std::ranges::sort);
  |  ~^~~
:4:16: note: 'constexpr auto f(auto:16) [with auto:16 =
std::ranges::__sort_fn]' is not usable as a 'constexpr' function because:
4 | constexpr auto f(auto algo) {
  |^
:8:8: error: call to non-'constexpr' function
'f::'
5 |   return [=] {
  |  ~
6 | auto it = algo(std::array{1, 0});
  | ~
7 |   return 0;
  |   ~
8 |   }();
  |   ~^~
:5:14: note: 'f::' is not usable as a
'constexpr' function because:
5 |   return [=] {

[Bug c++/96576] New: ICE when decltype std::index_sequence

2020-08-11 Thread hewillk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96576

Bug ID: 96576
   Summary: ICE when decltype std::index_sequence
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

#include 

auto operator|(auto S, auto) {
  return S;
}

int main()
{
  decltype(std::index_sequence<0>{} | 0 | 0);
}

gives:

: In function 'int main()':
:9:43: internal compiler error: in build_over_call, at cp/call.c:8994
9 |   decltype(std::index_sequence<0>{} | 0 | 0);
  |   ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.

(https://godbolt.org/z/8ezT44)

[Bug c++/96575] std::ranges::sort is not usable as a 'constexpr' function when saving its return value in lambda function

2020-08-12 Thread hewillk at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96575

--- Comment #1 from 康桓瑋  ---
I don't know whether this is same issue or not:

#include 

constexpr auto replace = [](auto old_x, auto new_x) { 
  return [=](auto r) {
return std::ranges::replace(r, old_x, new_x);
  };
};

// this one is ok
constexpr auto f1(auto algo) {
  [=]() {
algo(std::array{0});
return 0;
  }();
  return true;
}

// this one fails with non-constant condition
constexpr auto f2(auto algo) {
  constexpr auto it = [=]() {
algo(std::array{0});
return 0;
  }();
  return true;
}

static_assert(f1(replace(0, 1)));
static_assert(f2(replace(0, 1)));

(https://godbolt.org/z/Kaq4j5)

[Bug c++/99361] New: "unused variable" warning on a used variable in template lambda

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

Bug ID: 99361
   Summary: "unused variable" warning on a used variable in
template lambda
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

The following code:

auto f() {
  const auto x = 1;
  return [] (auto) { return x; };
}

will emit unused variable warnings with "-std=c++20 -Wall" flags:

: In function 'auto f()':
:2:14: warning: variable 'x' set but not used
[-Wunused-but-set-variable]
2 |   const auto x = 1;
  | 

godbolt: https://godbolt.org/z/d54j4G

[Bug c++/99379] New: lambda declared with deduced type 'auto' can appear in its own initializer

2021-03-04 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99379

Bug ID: 99379
   Summary: lambda declared with deduced type 'auto' can appear in
its own initializer
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

The following code accepts by GCC-trunk:

auto x = [x]{ };

godbolt: https://godbolt.org/z/e76Kn1

[Bug c++/99379] lambda declared with deduced type 'auto' can appear in its own initializer

2021-03-04 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99379

--- Comment #1 from 康桓瑋  ---
I find this: 
https://stackoverflow.com/questions/25693676/auto-variable-used-in-lambda-in-its-own-initializer
So this is not a bug.

[Bug c++/99465] New: Segmentation fault when put lambda into requires clause

2021-03-08 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99465

Bug ID: 99465
   Summary: Segmentation fault when put lambda into requires
clause
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

The following code will trigger the segmentation fault of gcc-trunk:

template 
auto g() requires ([] { return 0; } ());

int main() { g(); }

godbolt: https://godbolt.org/z/4bsaPd



error message:
: In substitution of 'template > auto g() requires
()() [with auto  = 0]':
:4:16:   required from here
:2:6:   required by the constraints of 'template >
auto g() requires ()()'
Segmentation fault
2 | auto g() requires ([] { return 0; } ());
  |   ~~^~~
0x1cee989 internal_error(char const*, ...)
???:0
0x7748f3 pp_cxx_parameter_mapping(cxx_pretty_printer*, tree_node*)
???:0
0x7de235 expr_to_string(tree_node*)
???:0
0x1d0a861 pp_format(pretty_printer*, text_info*)
???:0
0x1ced50a diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
???:0
0x1cee60d error_at(unsigned int, char const*, ...)
???:0
0x73c8ea constraints_satisfied_p(tree_node*, tree_node*)
???:0
0x9510c3 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
???:0
0x6db9c2 build_new_function_call(tree_node*, vec**, int)
???:0
0x97d1ec finish_call_expr(tree_node*, vec**, bool,
bool, int)
???:0
0x8dd92d c_parse_file()
???:0
0xa5bd12 c_common_parse_file()
???:0
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.

[Bug c++/99465] Segmentation fault when put lambda into requires clause

2021-03-08 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99465

--- Comment #1 from 康桓瑋  ---
Other related ICE:

template  requires ([]{}());
auto f() requires ([]{}());

https://godbolt.org/z/8z3PPx

[Bug c++/99465] Segmentation fault when put lambda into requires clause

2021-03-08 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99465

--- Comment #2 from 康桓瑋  ---
Here is the minimal reduced example:

f() requires [

godbolt: https://godbolt.org/z/eMWxPj

[Bug c++/99478] New: ICE when decltype lambda in template list

2021-03-08 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99478

Bug ID: 99478
   Summary: ICE when decltype lambda in template list
   Product: gcc
   Version: 9.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

The following code will trigger ICE on gcc-9.1 ~ gcc-trunk with "-std=c++2a"
mode:

template  auto f() {}

int main() { f<{}>(); }

(godbolt: https://godbolt.org/z/dEP5PT)

[Bug c++/99505] New: ICE Segmentation fault when decltype lambda in parameter list

2021-03-09 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99505

Bug ID: 99505
   Summary: ICE Segmentation fault when decltype lambda in
parameter list
   Product: gcc
   Version: 9.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

This may be related/duplicated to the 99478, but I am not sure.

The following code will trigger ICE only on gcc-9:

int main() {
  [] (decltype([]{})) {} ({});
}

(godbolt: https://godbolt.org/z/xdr94q)

But this will trigger ICE on gcc-9, gcc-10 and gcc-11:

struct S {
  template 
  operator T() { return {}; }
};

int main() {
  [] (decltype([]{})) {} (S{});
}

(godbolt: https://godbolt.org/z/3dh477)

[Bug c++/99505] ICE Segmentation fault when decltype lambda in parameter list

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

--- Comment #2 from 康桓瑋  ---
Yep, wandbox (https://wandbox.org/permlink/OUJpCz6dFrlA1vod) compiles fine. 

This invalid code maybe can reproduce that locally.

int main() {
  [] (decltype([]{})) {} ();
}

(wandbox: https://wandbox.org/permlink/re9O9DXwoaYmNInd)
(godbolt: https://godbolt.org/z/e4e7or)

[Bug c++/99511] New: default arguments are allowed for parameters of a requires expression

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

Bug ID: 99511
   Summary: default arguments are allowed for parameters of a
requires expression
   Product: gcc
   Version: 10.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

The following code should not be accepted by gcc-10, since default arguments
are not allowed for parameters of a requires expression.

template 
concept C = requires (T = {}) { true; };

(goldbot: https://godbolt.org/z/fM88qb)

[Bug c++/99513] New: ICE Segmentation fault when decltype lambda in concept template list

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

Bug ID: 99513
   Summary: ICE Segmentation fault when decltype lambda in concept
template list
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

This may be related/duplicated to the 99505, but I am not sure.

The following invalid code will trigger Segmentation fault on gcc-10 and
gcc-11:

template  concept C = true;
auto f() requires C<{}>;

(wandbox: https://wandbox.org/permlink/1gwi5zWcrICysV5G)
(godbolt: https://godbolt.org/z/PMYz6e)

[Bug c++/99516] New: Erroneous lambda conversion in default non-type template list

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

Bug ID: 99516
   Summary: Erroneous lambda conversion in default non-type
template list
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

GCC 9, 10, 11 rejects the following code:

template  
struct S {};

S<> s;

(godbolt: https://godbolt.org/z/Gs4776)

[Bug c++/99521] New: ICE Segmentation fault when decltype lambda in requires clause

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

Bug ID: 99521
   Summary: ICE Segmentation fault when decltype lambda in
requires clause
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Keywords: ice-on-invalid-code
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

This may be related/duplicated to the 99513, but I am not sure.

The following invalid code will trigger Segmentation fault on gcc-11:

int main() {
  [](auto) requires (decltype;
}

(godbolt: https://godbolt.org/z/WaP6qe)

[Bug c++/99521] ICE Segmentation fault when decltype lambda in requires clause

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

康桓瑋  changed:

   What|Removed |Added

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

--- Comment #1 from 康桓瑋  ---
This is duplicate of 99465.

*** This bug has been marked as a duplicate of bug 99465 ***

[Bug c++/99465] Segmentation fault when put lambda into requires clause

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

--- Comment #3 from 康桓瑋  ---
*** Bug 99521 has been marked as a duplicate of this bug. ***

[Bug c++/99361] "unused variable" warning on a used variable in template lambda

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

康桓瑋  changed:

   What|Removed |Added

 Resolution|--- |DUPLICATE
 Status|NEW |RESOLVED

--- Comment #2 from 康桓瑋  ---
This is a duplicate of 96311.

*** This bug has been marked as a duplicate of bug 96311 ***

[Bug c++/96311] [8/9/10/11 Regression] false positive for -Wunused-but-set-variable (const/constexpr identifier used in generic lambda)

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

康桓瑋  changed:

   What|Removed |Added

 CC||hewillk at gmail dot com

--- Comment #5 from 康桓瑋  ---
*** Bug 99361 has been marked as a duplicate of this bug. ***

[Bug c++/99538] New: ICE when lambda return requires clause

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

Bug ID: 99538
   Summary: ICE when lambda return requires clause
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

The following code will trigger the ICE of gcc-10 and trunk:


int main(){
  [] { return requires { []{}; }; };
}

(godbolt: https://godbolt.org/z/WGjx9h)

[Bug c++/99539] New: Varargs are allowed in requires expression

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

Bug ID: 99539
   Summary: Varargs are allowed in requires expression
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

gcc-trunk accepts the following code:

template
concept C = requires(T t, ...) {// error: terminates with an ellipsis
  t;
};

(goldbot: https://godbolt.org/z/qbz7b9)

but according to [expr.prim#req.general-4]: "The parameter-declaration-clause
of a requirement-parameter-list shall not terminate with an ellipsis."

[Bug c++/99546] New: Weird return value of C++20 requires expression

2021-03-11 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99546

Bug ID: 99546
   Summary: Weird return value of C++20 requires expression
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

gcc-trunk accepts following code:

int main() {
  constexpr auto b = requires { []{}; };
  static_assert(b);
  static_assert(!b);
}

(godbolt: https://godbolt.org/z/4K5vq8)

[Bug c++/99546] Weird return value of C++20 requires expression

2021-03-11 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99546

--- Comment #1 from 康桓瑋  ---
You can see more weird cases in this: 
https://stackoverflow.com/questions/66578966/weird-return-value-of-c20-requires-expression.

[Bug c++/99583] New: Parameter packs not expanded in lambda noexcept specifier

2021-03-14 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99583

Bug ID: 99583
   Summary: Parameter packs not expanded in lambda noexcept
specifier
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

The following valid code failed since gcc-4.7

void f(...);

template  
void g() {  
 f([]() noexcept(B) {} ...);  
}

(goldbot: https://gcc.godbolt.org/z/WoKaab)

[Bug c++/99584] New: ICE Segmentation fault when expanding lambda noexcept specifier with invalid parameter pack

2021-03-14 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99584

Bug ID: 99584
   Summary: ICE Segmentation fault when expanding lambda noexcept
specifier with invalid parameter pack
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

This may be related/duplicated to PR 99513 or PR 99583, but I am not sure.

The following invalid code triggers ICE in gcc-trunk:


void f(...);

template  
void g(Args... args) {  
 f([](Args) noexcept(args) {} ...);  
}

int main() { g(0); }

(godbolt: https://gcc.godbolt.org/z/477Mn8)
(wandbox: https://wandbox.org/permlink/qA74qnIHdaZSX6JF)

[Bug c++/99589] New: lambda init-capture without initializer in C++20

2021-03-14 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99589

Bug ID: 99589
   Summary: lambda init-capture without initializer in C++20
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

gcc-9 should reject this code:

void f(auto... args) {  
  ([...args]{}, ...); 
}

according to [expr.prim.lambda#nt:init-capture], the "...args" in capture list
must follow by a initializer.

(goldbot: https://godbolt.org/z/eMo7aY)

[Bug c++/99590] New: ICE when pack expansion with lambda

2021-03-15 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99590

Bug ID: 99590
   Summary: ICE when pack expansion with lambda
   Product: gcc
   Version: 8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

The following code will trigger ICE on gcc-8 ~ gcc-trunk with "-std=c++2a"
mode:

void g(auto... args) {
  ([args...](auto){}(args), ...);  
}

int main() { g(0, 1); }

(goldbot: https://godbolt.org/z/Tvzj7b)

[Bug c++/99590] ICE when pack expansion with lambda

2021-03-15 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99590

--- Comment #1 from 康桓瑋  ---
I think this is a valid code:

void g(auto... args) {
  ([args...](auto...){}(args   ), ...);
}

void f(auto... args) {
  ([args   ](auto...){}(args...), ...);
}

int main() { 
  g(0, 1); // this one ICE
  f(0, 1); // this one works
}

[Bug c++/99594] New: Parameter packs not expanded in lambda requires clause

2021-03-15 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99594

Bug ID: 99594
   Summary: Parameter packs not expanded in lambda requires clause
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

Same form with PR 99583, this code should work:

template 
auto f() {
  ([](auto) requires (B) {}, ...);
}

(goldbot: https://godbolt.org/z/jdn4je)

[Bug c++/99595] New: ICE when pack expansion with template lambda

2021-03-15 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99595

Bug ID: 99595
   Summary: ICE when pack expansion with template lambda
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

The following code will trigger ICE on gcc-trunk:

auto f(auto... args) {
  ([]{ y; }, ...);
}

int main() { f(0); }

(godbolt: https://godbolt.org/z/11G8G5)
(wanbox: https://wandbox.org/permlink/Bbmq4ZWehhJqlBdk)

[Bug c++/99597] New: Parameter packs not expanded in lambda template list

2021-03-15 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99597

Bug ID: 99597
   Summary: Parameter packs not expanded in lambda template list
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

The following code intends to work, even if it fails in three major compilers:

template  
void f(Ts...) {
  ([](){}, ...);  
}

int main() { f(0, 0.5); }

(goldbot: https://godbolt.org/z/xnM9dY)

[Bug c++/99628] New: g++ fails to do the implicit conversion when rewritten operator<=>

2021-03-17 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99628

Bug ID: 99628
   Summary: g++ fails to do the implicit conversion when rewritten
operator<=>
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

gcc-trunk rejects this valid code:

struct S{
  operator int() { return 0; }
};

auto operator<=>(S, S) { return S{}; }

int main() {
  return S{} < S{};
}

(godbolt://godbolt.org/z/9ah1xE)


The expression S{} < S{} would be rewritten as (S{} <=> S{}) < 0, since the
(S{} <=> S{}) return S{}, we compare S{} with 0, and S{} explicit convert to 0,
so we compare 0 < 0 which is false, but gcc-trunk rejects with:

:8:14: error: no match for 'operator<' (operand types are 'S' and
'int')
8 |   return S{} < S{};

[Bug c++/99589] lambda init-capture without initializer in C++20

2021-03-18 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99589

--- Comment #1 from 康桓瑋  ---
reduced:

auto f(auto x) {
 [...x]{};
}

[Bug c++/99659] New: internal compiler error: tree check: expected tree that contains 'decl common' structure, have 'error_mark' in synthesize_implicit_template_parm, at cp/parser.c:45415

2021-03-19 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99659

Bug ID: 99659
   Summary: internal compiler error: tree check: expected tree
that contains 'decl common' structure, have
'error_mark' in synthesize_implicit_template_parm, at
cp/parser.c:45415
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
      Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/qePTPh


template <...args> bar(auto);


:1:11: error: expected identifier before '...' token
1 | template <...args> bar(auto);
  |   ^~~
:1:24: internal compiler error: tree check: expected tree that contains
'decl common' structure, have 'error_mark' in
synthesize_implicit_template_parm, at cp/parser.c:45415
1 | template <...args> bar(auto);
  |^~~~
0x1cfa259 internal_error(char const*, ...)
???:0
0x67bb5d tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
???:0
0x8e136d c_parse_file()
???:0
0xa5f962 c_common_parse_file()
???:0
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.

[Bug c++/99672] New: std::source_location yield different column numbers between free function and template functions

2021-03-19 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99672

Bug ID: 99672
   Summary: std::source_location yield different column numbers
between free function and template functions
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/8T3MGv



#include 
#include 

auto g(auto...) {
std::cout << std::source_location::current().column() << "\n";
}

auto f() {
std::cout << std::source_location::current().column() << "\n";
}

int main() {
g();
f();
std::cout << std::source_location::current().column() << "\n";
}



GCC-trunk output 43, 44, and 44, but the first one should be 44.

[Bug c++/99678] New: c++20 trailing requires clauses allows undeclared identifier

2021-03-19 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99678

Bug ID: 99678
   Summary: c++20 trailing requires clauses allows undeclared
identifier
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/reG8qE



void bar(auto) requires undeclared_identifier;



GCC accepts this code.

[Bug c++/99546] Weird return value of C++20 requires expression

2021-03-20 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99546

--- Comment #4 from 康桓瑋  ---
same form, but this will trigger ICE:



struct S{
  constexpr static auto s = requires { []; };
};



:1:8: internal compiler error: tree check: expected class 'type', have
'exceptional' (error_mark) in override_type_for_decl_p, at dwarf2out.c:23786
1 | struct S{
  |^
0x1cfa229 internal_error(char const*, ...)
???:0
0x67b5e5 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
???:0
0xf3666f rest_of_type_compilation(tree_node*, int)
???:0
0x70c969 finish_struct_1(tree_node*)
???:0
0x70e754 finish_struct(tree_node*, tree_node*)
???:0
0x8e121d c_parse_file()
???:0
0xa5f812 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See  for instructions.

[Bug c++/99672] std::source_location yield different column numbers between free function and template functions

2021-03-21 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99672

--- Comment #3 from 康桓瑋  ---
I think the issue of line() function also needs to do a patch.

https://godbolt.org/z/q8EPnG


constexpr int g(auto...) {
return std::source_location::current( // < opening paren line number
).line();
}

constexpr int f() {
return std::source_location::current( 
).line(); // < closing paren line number
}



[Bug c++/99700] New: gcc takes an uninitialized variable as a constant expression

2021-03-21 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99700

Bug ID: 99700
   Summary: gcc takes an uninitialized variable as a constant
expression
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/93qM1b



struct A {
  constexpr A() { c[0] = 0; }
  char c[2];
};

constexpr A a;



[Bug c++/99730] New: gcc cannot choose the best overload resolution with constrained function

2021-03-23 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99730

Bug ID: 99730
   Summary: gcc cannot choose the best overload resolution with
constrained function
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

auto f(auto&&...) {}
auto f(auto...) requires true {}

int main() {
  f();
}


gcc reject with:

:5:5: error: call of overloaded 'f()' is ambiguous
5 |   f();
  | ^

https://godbolt.org/z/e8jas5frc

[Bug c++/99732] New: gcc accepts overload a member function without ref-qualifier with a member function with a ref-qualifier

2021-03-23 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99732

Bug ID: 99732
   Summary: gcc accepts overload a member function without
ref-qualifier with a member function with a
ref-qualifier
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

struct S {
  constexpr auto f(auto...) &&{ return false; }
  constexpr auto f(auto...) requires true { return true;  }
};

static_assert(S{}.f());

gcc accepts this code.

https://godbolt.org/z/7rdWEsrfv

[Bug c++/99730] gcc cannot choose the best overload resolution with constrained function

2021-03-23 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99730

--- Comment #3 from 康桓瑋  ---
Really appreciate your reply and explanation.

[Bug c++/99742] New: Parameter packs not expanded with nested requirements

2021-03-23 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99742

Bug ID: 99742
   Summary: Parameter packs not expanded with nested requirements
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

template 
concept C = (requires { requires B; } && ...);

static_assert(C);


gcc rejects this code.
https://godbolt.org/z/c6sEq5KEs

[Bug c++/99743] New: ICE Segmentation fault when use lambda init-capture in requires clause

2021-03-23 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99743

Bug ID: 99743
   Summary: ICE Segmentation fault when use lambda init-capture in
requires clause
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

static_assert(requires { [x = 0]{}; });

https://godbolt.org/z/n9KE4z7P6

I don't know whether this code is well-form or not.
Maybe related/duplicate to PR 99538, PR 99465, PR 99546 since they are the same
form.

[Bug c++/99745] New: ICE when parameter pack not expanded in bit field

2021-03-23 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99745

Bug ID: 99745
   Summary: ICE when parameter pack not expanded in bit field
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/dz1bcxhYf

template 
struct S { 
  int a : sizeof(Ts); 
};

S s;


:3:11: internal compiler error: in dependent_type_p, at cp/pt.c:26775
3 |   int a : sizeof(Ts);
  |   ^~
0x1cfa409 internal_error(char const*, ...)
???:0
0x6ba5f7 fancy_abort(char const*, int, char const*)
???:0
0x8f91c8 dependent_type_p(tree_node*)
???:0
0x9c3a1f cxx_sizeof_or_alignof_type(unsigned int, tree_node*, tree_code, bool,
bool)
???:0
0x9164a7 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x95a1a6 instantiate_class_template(tree_node*)
???:0
0x7b2bd0 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
???:0
0x8e111d c_parse_file()
???:0
0xa5f9c2 c_common_parse_file()
???:0
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.

[Bug c++/99745] ICE when parameter pack not expanded in bit field

2021-03-23 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99745

--- Comment #1 from 康桓瑋  ---
Reduce a little:

template 
struct S {
  int x : Xs;
};

S s;


:3:7: internal compiler error: unexpected expression 'Xs' of kind
template_parm_index
3 |   int x : Xs;
  |   ^

[Bug c++/99750] New: gcc allow operator literal operator have default parameters

2021-03-24 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99750

Bug ID: 99750
   Summary: gcc allow operator literal operator have default
parameters
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

constexpr auto operator""_s(const char*, unsigned long size = 2) {
  return size;
}
static_assert(operator""_s(nullptr) == 2);

https://godbolt.org/z/x3YjPT8vd

[Bug libstdc++/99752] New: ranges::find_end should return empty subrange when search range is empty

2021-03-24 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99752

Bug ID: 99752
   Summary: ranges::find_end should return empty subrange when
search range is empty
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

In ranges::find_end implementation:

674 else
675   {
676 auto __i = ranges::next(__first1, __last1);
677 if (__first2 == __last2)
678   return {__i, __i};

when the examined range is not bidirectional_range and the search range is
empty, we still do the ranges::next call, this makes the following code
infinite loop:

#include 
#include 

int main() {
  auto r = std::views::iota(0);
  std::ranges::empty_view e;
  std::ranges::find_end(r, e);
}

But according to the [alg.find.end]: "i be last1 if [first2, last2) is empty", 
so I think this is a library bug since in such case ranges::find_end never
return.

Same situations in ranges::rotate with performance loss in more rare
conditions:

1573  {
1574auto __lasti = ranges::next(__first, __last);
1575if (__first == __middle)
1576  return {__lasti, __lasti};
1577if (__last == __middle)
1578  return {std::move(__first), std::move(__lasti)};

[Bug libstdc++/99752] ranges::find_end should return empty subrange when search range is empty

2021-03-24 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99752

--- Comment #1 from 康桓瑋  ---
My pardon, since the ranges::find_end return type is ranges::subrange, we
still to get the common last1 iterator through the ranges::next call, so this
seems not a bug.

[Bug libstdc++/99752] ranges::find_end should return empty subrange when search range is empty

2021-03-24 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99752

康桓瑋  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #2 from 康桓瑋  ---
Since the ranges::find_end return type is ranges::subrange, we still to get
the common last1 iterator through the ranges::next call, so this seems not a
bug.

[Bug c++/99757] New: ICE when parameter pack not expanded with static_data_member

2021-03-24 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99757

Bug ID: 99757
   Summary: ICE when parameter pack not expanded with
static_data_member
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

related to PR 99745:

template 
struct S {
  constexpr static auto x = Ts::x;
};

S s;

:3:25: internal compiler error: in cp_finish_decl, at cp/decl.c:7736
3 |   constexpr static auto x = Ts::x;
  | ^
0x1cfa799 internal_error(char const*, ...)
???:0
0x6ba647 fancy_abort(char const*, int, char const*)
???:0
0x7b2e42 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
???:0
0x91c9df instantiate_decl(tree_node*, bool, bool)
???:0
0x7b31d8 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
???:0
0x7c9d03 finish_static_data_member_decl(tree_node*, tree_node*, bool,
tree_node*, int)
???:0
0x95a530 instantiate_class_template(tree_node*)
???:0
0x7b2bf0 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
???:0
0x8e12cd c_parse_file()
???:0
0xa5fb72 c_common_parse_file()
???:0
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.

[Bug c++/99800] New: ICE Segmentation fault when put lambda in template parameter list

2021-03-27 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99800

Bug ID: 99800
   Summary: ICE Segmentation fault when put lambda in template
parameter list
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/b6cnKo7ej

template  struct A {};
template  struct B {};
template  using b = B<[]{ return a; }()>;



:3:45: internal compiler error: Segmentation fault
3 | template  using b = B<[]{ return a; }()>;
  | ^
0x1cfb7f9 internal_error(char const*, ...)
???:0
0x6c42c5 resolve_args(vec*, int)
???:0
0x909251 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
???:0
0x929663 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
???:0
0x97fb6d finish_template_type(tree_node*, tree_node*, int)
???:0
0x8e12ad c_parse_file()
???:0
0xa600a2 c_common_parse_file()
???:0
Please submit a full bug report,

[Bug c++/99803] New: internal compiler error: in make_typename_type, at cp/decl.c:4057

2021-03-28 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99803

Bug ID: 99803
   Summary: internal compiler error: in make_typename_type, at
cp/decl.c:4057
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/4Yfnfzdhe

struct A {  A(auto); };
A(unsigned) -> A:: template A;

[Bug c++/99806] New: ICE in tsubst_copy of gcc-trunk and tree_code_size of gcc-10

2021-03-28 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99806

Bug ID: 99806
   Summary: ICE in tsubst_copy of gcc-trunk and tree_code_size of
gcc-10
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/s687ePeGG


template  concept C = requires (T a) { a.f(0); };
struct S { void f(auto) noexcept(); };
static_assert(C);


gcc-trunk:

:2:17: internal compiler error: in tsubst_copy, at cp/pt.c:17247
2 | struct S { void f(auto) noexcept(); };
  | ^

gcc-10:

:2:17: internal compiler error: in tree_code_size, at tree.c:910
2 | struct S { void f(auto) noexcept(); };
  |

[Bug c++/99809] New: ICE: sorry, unimplemented: unexpected AST of kind nontype_argument_pack

2021-03-29 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99809

Bug ID: 99809
   Summary: ICE: sorry, unimplemented: unexpected AST of kind
nontype_argument_pack
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/4dnnTTzMW

#include 

auto f(auto... args) {
  return [](std::same_as auto) {};
}

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

:4:10: sorry, unimplemented: unexpected AST of kind
nontype_argument_pack
4 |   return [](std::same_as auto) {};
  |  ^~~~
:4:10: internal compiler error: in potential_constant_expression_1, at
cp/constexpr.c:8854
0x1cfb7f9 internal_error(char const*, ...)
???:0
0x6ba871 fancy_abort(char const*, int, char const*)
???:0
0x72ac1e is_nondependent_constant_expression(tree_node*)
???:0
0x91465c instantiate_non_dependent_expr_sfinae(tree_node*, int)
???:0
0x98afc1 finish_decltype_type(tree_node*, bool, int)
???:0
0x915dc3 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x941bb6 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
???:0
0x739946 tsubst_constraint(tree_node*, tree_node*, int, tree_node*)
???:0
0x949a91 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0x91c84f instantiate_decl(tree_node*, bool, bool)
???:0
0x7c6c0e maybe_instantiate_decl(tree_node*)
???:0
0x7c8370 mark_used(tree_node*, int)
???:0
0x6de097 build_new_function_call(tree_node*, vec**, int)
???:0
0x980c6c finish_call_expr(tree_node*, vec**, bool,
bool, int)
???:0
0x8e12ad c_parse_file()
???:0
0xa600a2 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/99811] New: ICE: tree check: accessed elt 2 of 'tree_vec' with 1 elts in tsubst_pack_expansion, at cp/pt.c:13002

2021-03-29 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99811

Bug ID: 99811
   Summary: ICE: tree check: accessed elt 2 of 'tree_vec' with 1
elts in tsubst_pack_expansion, at cp/pt.c:13002
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/shj7Tr65M

related to PR 99809:

#include 

template 
auto f(Ts...) {
  return [](std::same_as auto...) {};
}

int main() {
  f(0, 0.5)();
}

:9:12: internal compiler error: tree check: accessed elt 2 of
'tree_vec' with 1 elts in tsubst_pack_expansion, at cp/pt.c:13002
9 |   f(0, 0.5)();
  |   ~^~
0x1cfb7f9 internal_error(char const*, ...)
???:0
0x67bcb2 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
???:0
0x93095c tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
???:0
0x73efca constraints_satisfied_p(tree_node*, tree_node*)
???:0
0x954963 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
???:0
0x6e225e build_op_call(tree_node*, vec**, int)
???:0
0x980ae5 finish_call_expr(tree_node*, vec**, bool,
bool, int)
???:0
0x8e12ad c_parse_file()
???:0
0xa600a2 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.

[Bug c++/99811] ICE: tree check: accessed elt 2 of 'tree_vec' with 1 elts in tsubst_pack_expansion, at cp/pt.c:13002

2021-03-29 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99811

--- Comment #1 from 康桓瑋  ---
same form with the different error message:

https://godbolt.org/z/hE9n6eEMT

#include 

template 
auto f(Ts...) {
  return [] auto> {};
}

int main() {
  f(0).template operator()<0>();
}


:9:30: internal compiler error: tree check: accessed elt 1 of
'tree_vec' with 0 elts in hash, at cp/constraint.cc:2522
9 |   f(0).template operator()<0>();
  |   ~~~^~
0x1cfb7f9 internal_error(char const*, ...)
???:0
0x67bcb2 tree_vec_elt_check_failed(int, int, char const*, int, char const*)
???:0
0x73fc50 sat_hasher::hash(sat_entry*)
???:0
0x73b2b7 satisfaction_cache::satisfaction_cache(tree_node*, tree_node*,
sat_info)
???:0
0x73efca constraints_satisfied_p(tree_node*, tree_node*)
???:0
0x909bbe do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
???:0
0x954187 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
???:0
0x6dec99 build_new_method_call(tree_node*, tree_node*, vec**, tree_node*, int, tree_node**, int)
???:0
0x8e12ad c_parse_file()
???:0
0xa600a2 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/99800] ICE Segmentation fault when put lambda in template parameter list

2021-03-29 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99800

康桓瑋  changed:

   What|Removed |Added

   Keywords|ice-on-invalid-code |ice-on-valid-code

--- Comment #1 from 康桓瑋  ---
This is a valid code.

[Bug c++/99815] New: ICE: in placeholder_type_constraint_dependent_p, at cp/pt.c:28193

2021-03-29 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99815

Bug ID: 99815
   Summary: ICE: in placeholder_type_constraint_dependent_p, at
cp/pt.c:28193
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/4vx18beMW

template  concept C = true;

template 
auto bar(Ts...) { C auto x = 0; }



:4:37: internal compiler error: in
placeholder_type_constraint_dependent_p, at cp/pt.c:28193
4 | auto bar(Ts...) { C auto x = 0; }
  | ^
0x1cfb7f9 internal_error(char const*, ...)
???:0
0x6ba871 fancy_abort(char const*, int, char const*)
???:0
0x90a81a do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
???:0
0x7b1dd4 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
???:0
0x8e12ad c_parse_file()
???:0
0xa600a2 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/99809] ICE: sorry, unimplemented: unexpected AST of kind nontype_argument_pack

2021-03-29 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99809

--- Comment #2 from 康桓瑋  ---
I think this is not a valid code even if clang accepts it, since the parameter
packs args are not expanded.

[Bug c++/99831] New: ICE: in reshape_init, at cp/decl.c:6720

2021-03-30 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99831

Bug ID: 99831
   Summary: ICE: in reshape_init, at cp/decl.c:6720
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

This is a complicated one since I don't know how to reduce it.

https://godbolt.org/z/rqTGxMWef

#include 

template 
struct StringLiteral {
  constexpr StringLiteral(const char (&str)[N]) {
std::ranges::copy_n(str, N, value);
  }
  char value[N];
};

template 
struct string{
  constexpr bool operator==(const string&) const noexcept = default;
};

template 
constexpr auto operator+(string, string) {
  constexpr auto L3 = []{
constexpr auto size1 = sizeof(L1.value);
constexpr auto size2 = sizeof(L2.value);
char value[size1 + size2 - 1] = {};
std::ranges::sort(value);
std::ranges::copy_n(L1.value, size1, value);
std::ranges::copy_n(L2.value, size2, value + size1 - 1);
return StringLiteral{value};
  }();
  return string{};
}

static_assert(
  string<"hello, world">{} ==
  string<"hello">{} + string<", world">{}
);

static_assert(
  string<"a rose is a rose is a rose">{} ==
  string<"a rose">{} + string<" is ">{} + 
  string<"a rose">{} + string<" is ">{} + 
  string<"a rose">{}
);

:36:40: internal compiler error: in reshape_init, at cp/decl.c:6720
   36 |   string<"a rose is a rose is a rose">{} ==
  |^
0x1cfb6a9 internal_error(char const*, ...)
???:0
0x6ba871 fancy_abort(char const*, int, char const*)
???:0
0x7810b6 reshape_init(tree_node*, tree_node*, int)
???:0
0x97e050 finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
???:0
0x8e12ad c_parse_file()
???:0
0xa600a2 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/99831] ICE: in reshape_init, at cp/decl.c:6720

2021-03-30 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99831

--- Comment #1 from 康桓瑋  ---
Note that if we comment one of the asserts, there will be no problem, or we
just comment the redundant std::ranges::sort.

[Bug c++/99831] ICE: in reshape_init, at cp/decl.c:6720

2021-03-30 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99831

--- Comment #4 from 康桓瑋  ---
When the array subscript is outside the bounds of array, gcc seems to fall into
infinite recursion due to the default operator==.

Here is the reduced with no header:

struct A {
  constexpr A(const char*) {}
  char value[1] = {};
};

template 
struct B {
  constexpr bool operator==(const B&) const = default;
};

constexpr auto foo(auto) {
  constexpr auto a = [] {
char value[1];
value[2] = 0; // this line
return A{value};
  }();
  return B{};
}

constexpr auto b = foo(B<"">{});

: In instantiation of 'struct B< >':
:8:18:   recursively required from 'struct B< >'
:8:18:   required from 'struct B< >'
:17:15:   required from 'constexpr auto foo(auto:1) [with auto:1 =
B]'
:20:23:   required from here
:8:18: fatal error: template instantiation depth exceeds maximum of 900
(use '-ftemplate-depth=' to increase the maximum)
8 |   constexpr bool operator==(const B&) const = default;
  |  ^~~~
compilation terminated.

[Bug c++/99844] New: ICE: unexpected expression 'B' of kind template_parm_index

2021-03-30 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99844

Bug ID: 99844
   Summary: ICE: unexpected expression 'B' of kind
template_parm_index
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

Related to fixed PR 99745 and PR 99757.

https://godbolt.org/z/5qW5a1Mnq

template 
struct S {
  constexpr explicit(B) S() {}
};

constexpr S s;


:3:25: internal compiler error: unexpected expression 'B' of kind
template_parm_index
3 |   constexpr explicit(B) S() {}
  | ^
0x1cfb6a9 internal_error(char const*, ...)
???:0
0x9164c7 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x959fc9 instantiate_class_template(tree_node*)
???:0
0x77fbc7 start_decl_1(tree_node*, bool)
???:0
0x7a728f start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
???:0
0x8e12ad c_parse_file()
???:0
0xa600a2 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/99809] ICE: sorry, unimplemented: unexpected AST of kind nontype_argument_pack

2021-03-31 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99809

--- Comment #3 from 康桓瑋  ---
More reduced:

template 
concept C = true;

void f(auto... args) {
  [](C auto) {};
}

int main() { f(); }

[Bug c++/99848] New: Parameter packs not expanded in type-constraint placeholder

2021-03-31 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99848

Bug ID: 99848
   Summary: Parameter packs not expanded in type-constraint
placeholder
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/hxed4eorx

template 
concept C = false;

template 
auto f(Ts...) {
  ([](C auto){}, ...);
}

gcc rejects it.

[Bug c++/99850] New: [P1102R2] reject valid lambda syntax in C++23

2021-03-31 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99850

Bug ID: 99850
   Summary: [P1102R2] reject valid lambda syntax in C++23
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/x5E5cGPTb

auto l = [] requires true -> void {};

gcc incorrectly rejects this valid lambda, you can see more details in
https://stackoverflow.com/questions/6684/the-validity-of-lambda-expression-with-omitted-parameter-list-in-c23

[Bug c++/99850] [P1102R2] reject valid lambda syntax in C++23

2021-03-31 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99850

--- Comment #4 from 康桓瑋  ---
This ICE may be caused by not handle this form.

template  concept C = true;

auto l = [] requires (C && ...) -> void {};

https://godbolt.org/z/vo8xPd4hY

:3:48: internal compiler error: Segmentation fault
3 | auto l = [] requires (C && ...) -> void {};
  |^~~
0x1cfca39 internal_error(char const*, ...)
???:0
0x940286 convert_generic_types_to_packs(tree_node*, int, int)
???:0
0x8e126d c_parse_file()
???:0
0xa60292 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/99869] New: ICE: in do_auto_deduction, at cp/pt.c:29620

2021-04-01 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99869

Bug ID: 99869
   Summary: ICE: in do_auto_deduction, at cp/pt.c:29620
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

This is a small variant of fixed PR 99815.

https://godbolt.org/z/jezs4qh3E

template  concept C = true;

template 
auto bar(Ts...) { for (C auto c : ""); }

:4:42: internal compiler error: in do_auto_deduction, at cp/pt.c:29620
4 | auto bar(Ts...) { for (C auto c : ""); }
  |  ^~
0x1cfca39 internal_error(char const*, ...)
???:0
0x6ba92b fancy_abort(char const*, int, char const*)
???:0
0x90a724 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
???:0
0x8e126d c_parse_file()
???:0
0xa60292 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/99874] New: ICE Segmentation fault when declared variable template of template lambda

2021-04-01 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99874

Bug ID: 99874
   Summary: ICE Segmentation fault when declared variable template
of template lambda
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/4fxhP6jf9

template 
auto l = [] requires requires { x; } {};

int main() {
  l<0>.template operator()<0>();
}


:2:40: internal compiler error: Segmentation fault
2 | auto l = [] requires requires { x; } {};
  |^
0x1cfca39 internal_error(char const*, ...)
???:0
0x917a92 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x73f042 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0x73f08a constraints_satisfied_p(tree_node*, tree_node*)
???:0
0x954d48 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
???:0
0x6ded59 build_new_method_call(tree_node*, tree_node*, vec**, tree_node*, int, tree_node**, int)
???:0
0x8e126d c_parse_file()
???:0
0xa60292 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/99897] New: ICE Segmentation fault when operator appear in template parameter-list

2021-04-03 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99897

Bug ID: 99897
   Summary: ICE Segmentation fault when operator appear in
template parameter-list
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/fjx8cG995

template  struct A {};
template  struct S { void foo(S<+a>); };


:2:40: internal compiler error: Segmentation fault
2 | template  struct S { void foo(S<+a>); };
  |^
0x1cfd119 internal_error(char const*, ...)
???:0
0x6c4475 resolve_args(vec*, int)
???:0
0x9093b1 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
???:0
0x929803 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
???:0
0x97ff1d finish_template_type(tree_node*, tree_node*, int)
???:0
0x8e140d c_parse_file()
???:0
0xa606f2 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/99899] New: ICE: in do_auto_deduction, at cp/pt.c:29630

2021-04-03 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99899

Bug ID: 99899
   Summary: ICE: in do_auto_deduction, at cp/pt.c:29630
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

This is a small variant of fixed PR 99815, PR 99869.

https://godbolt.org/z/zrnPqdenx

template  concept C = true;

struct S { int a, b; };

template 
auto bar(Ts...) { C auto [a, b] = S{}; }


: In function 'auto bar(Ts ...)':
:6:44: internal compiler error: in do_auto_deduction, at cp/pt.c:29630
6 | auto bar(Ts...) { C auto [a, b] = S{}; }
  |^
0x1cfd119 internal_error(char const*, ...)
???:0
0x6baa1b fancy_abort(char const*, int, char const*)
???:0
0x90a8c4 do_auto_deduction(tree_node*, tree_node*, tree_node*, int,
auto_deduction_context, tree_node*, int)
???:0
0x7b1e34 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
???:0
0x8e140d c_parse_file()
???:0
0xa606f2 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/99904] New: ICE: in tsubst_pack_expansion, at cp/pt.c:13056

2021-04-04 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99904

Bug ID: 99904
   Summary: ICE: in tsubst_pack_expansion, at cp/pt.c:13056
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

maybe dup of PR 99595.

https://godbolt.org/z/zarsP11Y6

template  concept C = true;
template  struct A {};
template  class>
struct S {};
constexpr S s;


:5:14: internal compiler error: in tsubst_pack_expansion, at
cp/pt.c:13056
5 | constexpr S s;
  |  ^
0x1cfcc99 internal_error(char const*, ...)
???:0
0x6baa77 fancy_abort(char const*, int, char const*)
???:0
0x9305c7 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
???:0
0x739b56 tsubst_constraint(tree_node*, tree_node*, int, tree_node*)
???:0
0x739cd1 tsubst_constraint_info(tree_node*, tree_node*, int, tree_node*)
???:0
0x929233 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
???:0
0x97fa1d finish_template_type(tree_node*, tree_node*, int)
???:0
0x8e14fd c_parse_file()
???:0
0xa601f2 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/99909] New: The value of 'std::is_integral_v' is not usable in a constant expression

2021-04-04 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99909

Bug ID: 99909
   Summary: The value of 'std::is_integral_v' is not usable
in a constant expression
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/jWr39rrsT

#include 

template  
struct S {};

template  class>
constexpr auto f() {}

int main() {
  f();
}

gcc rejects this code with:

In file included from :1:
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/concepts:102:13:  
required for the satisfaction of 'integral, >]>' [with auto [requires
std::integral<, >] = auto [requires std::integral<,
>]]
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/concepts:102:24:
error: the value of 'std::is_integral_v, >]>' is not usable in a constant expression
  102 | concept integral = is_integral_v<_Tp>;
  |^~
In file included from
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/concepts:44,
 from :1:
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/type_traits: In
function 'int main()':
/opt/compiler-explorer/gcc-trunk-20210404/include/c++/11.0.1/type_traits:3026:25:
note: 'std::is_integral_v, >]>' used
in its own initializer
 3026 |   inline constexpr bool is_integral_v = is_integral<_Tp>::value;
  | ^

[Bug c++/99916] New: ICE Segmentation fault when erroneous structured bindings appears in requires-clause

2021-04-05 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99916

Bug ID: 99916
   Summary: ICE Segmentation fault when erroneous structured
bindings appears in requires-clause
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/cW8367TTr

struct S {} s;
template  concept C = requires { [a] = s; };
static_assert(C);


:2:41: internal compiler error: Segmentation fault
2 | template  concept C = requires { [a] = s; };
  | ^~~
0x1cfcba9 internal_error(char const*, ...)
???:0
0x7779e3 pp_cxx_parameter_mapping(cxx_pretty_printer*, tree_node*)
???:0
0x7e2a68 maybe_print_single_constraint_context(diagnostic_context*, tree_node*)
???:0
0x1cfb736 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
???:0
0x1cfc13d inform(unsigned int, char const*, ...)
???:0
0x73f30f diagnose_constraints(unsigned int, tree_node*, tree_node*)
???:0
0x98aba3 finish_static_assert(tree_node*, tree_node*, unsigned int, bool, bool)
???:0
0x8e14fd c_parse_file()
???:0
0xa60102 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/99923] New: Rejects valid if statement with default argument concept

2021-04-05 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99923

Bug ID: 99923
   Summary: Rejects valid if statement with default argument
concept
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/zPPMEaa33

template   concept C = true;
void foo() { if (C<>) return; }

gcc rejects this valid grammar with:

: In function 'void foo()':
:2:18: error: expected 'auto' or 'decltype(auto)' after 'C<>'
2 | void foo() { if (C<>) return; }
  |  ^~~

[Bug c++/99925] New: Missing 'inconsistent deduction for ‘auto’' error when using type-constraint placeholder

2021-04-05 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99925

Bug ID: 99925
   Summary: Missing 'inconsistent deduction for ‘auto’' error when
using type-constraint placeholder
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

Maybe dup of PR 79009.

https://godbolt.org/z/sGacxEj31

template  concept C = true;

C auto i = 0, j = 0.5, k = "";

[Bug c++/99958] New: The seems to contain the entire and in C++20 mode

2021-04-07 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99958

Bug ID: 99958
   Summary: The  seems to contain the entire 
and  in C++20 mode
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

I found that include  will automatically include the entire 
in C++17 mode, and both the  and  will be automatically
included in C++20 mode:

https://godbolt.org/z/G5hrsaPKs

#include 

int main() {
  std::string s{"hell"};
  s.push_back('o');
  std::vector v{1, 2};
  v.push_back(3);
}

[Bug c++/99967] New: gcc accepts declaration type contains unexpanded parameter pack

2021-04-08 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99967

Bug ID: 99967
   Summary: gcc accepts declaration type contains unexpanded
parameter pack
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/cdqq3ocTG

template  concept C = true;

template  void f() { C auto x = 0; };

int main() { f(); }

gcc accepts it.

[Bug c++/99970] New: gcc accepts invalid comparison between pointer and integer in requires-clause

2021-04-08 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99970

Bug ID: 99970
   Summary: gcc accepts invalid comparison between pointer and
integer in requires-clause
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/qs44TqzKe

template 
void f() requires requires { x == "hello world"; } {};
int main() { f(); }

gcc accepts this.

[Bug c++/99970] gcc accepts invalid comparison between pointer and integer in requires-clause

2021-04-08 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99970

--- Comment #1 from 康桓瑋  ---
The requires-expression is a red herring, so it can be simplified to:

template 
void f() { x == nullptr; };

int main() { 
  f(); 
}

Is this ill-formed?

[Bug c++/99976] New: gcc accepts requires-clause contains unexpanded parameter pack

2021-04-08 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99976

Bug ID: 99976
   Summary: gcc accepts requires-clause contains unexpanded
parameter pack
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/ax7MKM483

template  concept C = requires (Ts) { true; };
static_assert(C);

gcc accepts it.

[Bug c++/100006] New: ICE: in dependent_type_p, at cp/pt.c:26745

2021-04-09 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16

Bug ID: 16
   Summary: ICE: in dependent_type_p, at cp/pt.c:26745
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

Congratulations on hitting the 10,000 reports mark!

https://godbolt.org/z/dhPqd4595

template 
auto f(Ts...) {
  [] { enum class e : Ts {}; };
}

int main() {
  f(0, true);
}

:3:19: internal compiler error: in dependent_type_p, at cp/pt.c:26745
3 |   [] { enum class e : Ts {}; };
  |   ^
0x1d00959 internal_error(char const*, ...)
???:0
0x6bb099 fancy_abort(char const*, int, char const*)
???:0
0x8fa338 dependent_type_p(tree_node*)
???:0
0x78b617 start_enum(tree_node*, tree_node*, tree_node*, tree_node*, bool,
bool*)
???:0
0x92ae1d lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
???:0
0x91766d tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x917717 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x94abba tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0x91d54f instantiate_decl(tree_node*, bool, bool)
???:0
0x7c7a3e maybe_instantiate_decl(tree_node*)
???:0
0x7c91a0 mark_used(tree_node*, int)
???:0
0x6de907 build_new_function_call(tree_node*, vec**, int)
???:0
0x981c3c finish_call_expr(tree_node*, vec**, bool,
bool, int)
???:0
0x8e224d c_parse_file()
???:0
0xa612e2 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/100006] ICE: in dependent_type_p, at cp/pt.c:26745

2021-04-09 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16

--- Comment #1 from 康桓瑋  ---
(In reply to 康桓瑋 from comment #0)
> Congratulations on hitting the 10,000 reports mark!
> 
> https://godbolt.org/z/dhPqd4595
> 
> template 
> auto f(Ts...) {
>   [] { enum class e : Ts {}; };
> }
> 
> int main() {
>   f(0, true);
> }
> 
> :3:19: internal compiler error: in dependent_type_p, at cp/pt.c:26745
> 3 |   [] { enum class e : Ts {}; };
>   |   ^
> 0x1d00959 internal_error(char const*, ...)
>   ???:0
> 0x6bb099 fancy_abort(char const*, int, char const*)
>   ???:0
> 0x8fa338 dependent_type_p(tree_node*)
>   ???:0
> 0x78b617 start_enum(tree_node*, tree_node*, tree_node*, tree_node*, bool,
> bool*)
>   ???:0
> 0x92ae1d lookup_template_class(tree_node*, tree_node*, tree_node*,
> tree_node*, int, int)
>   ???:0
> 0x91766d tsubst(tree_node*, tree_node*, int, tree_node*)
>   ???:0
> 0x917717 tsubst(tree_node*, tree_node*, int, tree_node*)
>   ???:0
> 0x94abba tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
>   ???:0
> 0x91d54f instantiate_decl(tree_node*, bool, bool)
>   ???:0
> 0x7c7a3e maybe_instantiate_decl(tree_node*)
>   ???:0
> 0x7c91a0 mark_used(tree_node*, int)
>   ???:0
> 0x6de907 build_new_function_call(tree_node*, vec vl_embed>**, int)
>   ???:0
> 0x981c3c finish_call_expr(tree_node*, vec**,
> bool, bool, int)
>   ???:0
> 0x8e224d c_parse_file()
>   ???:0
> 0xa612e2 c_common_parse_file()
>   ???:0
> Please submit a full bug report,
> with preprocessed source if appropriate.

100,000

[Bug c++/100006] [8/9/10/11 Regression] ICE: in dependent_type_p, at cp/pt.c:26745

2021-04-09 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16

--- Comment #3 from 康桓瑋  ---
https://godbolt.org/z/o6h8GP6ae

Maybe same form:

template 
auto f() {
  [] { struct S : Ts {}; };
}

int main() {
  f<>();
}

:3:15: internal compiler error: in dependent_type_p, at cp/pt.c:26745
3 |   [] { struct S : Ts {}; };
  |   ^
0x1d00959 internal_error(char const*, ...)
???:0
0x6bb099 fancy_abort(char const*, int, char const*)
???:0
0x8fa338 dependent_type_p(tree_node*)
???:0
0x7a9464 xref_basetypes(tree_node*, tree_node*)
???:0
0x95aa80 instantiate_class_template(tree_node*)
???:0
0x94abba tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0x91d54f instantiate_decl(tree_node*, bool, bool)
???:0
0x7c7a3e maybe_instantiate_decl(tree_node*)
???:0
0x7c91a0 mark_used(tree_node*, int)
???:0
0x6de907 build_new_function_call(tree_node*, vec**, int)
???:0
0x981c3c finish_call_expr(tree_node*, vec**, bool,
bool, int)
???:0
0x8e224d c_parse_file()
???:0
0xa612e2 c_common_parse_file()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/100007] New: Parameter packs not expanded with bit field

2021-04-09 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17

Bug ID: 17
   Summary: Parameter packs not expanded with bit field
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/ccb69heP9

template 
auto f() {
  ([] { struct U { int x : Ns; }; }, ...);
  ([] { union  U { int x : Ns; }; }, ...);
}

gcc rejects it.

[Bug c++/100019] New: ICE Segmentation fault with try-catch block in lambda

2021-04-10 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100019

Bug ID: 100019
   Summary: ICE Segmentation fault with try-catch block in lambda
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/WajPza5fM

void f(auto... args) {
  [] {
try {} catch (decltype(args)) {}
  };
}

int main() {
  f(0);
}

:3:19: internal compiler error: Segmentation fault
3 | try {} catch (decltype(args)) {}
  |   ^~
0x1d00a79 internal_error(char const*, ...)
???:0
0x98c0ff finish_decltype_type(tree_node*, bool, int)
???:0
0x9170e3 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x9177e7 tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0x94acb2 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0x91d61f instantiate_decl(tree_node*, bool, bool)
???:0
0x95f4eb instantiate_pending_templates(int)
???:0
0x7ccff9 c_parse_final_cleanups()
???:0
Please submit a full bug report,
with preprocessed source if appropriate.

[Bug c++/100022] New: Parameter packs not expanded with alignas specifier

2021-04-10 Thread hewillk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100022

Bug ID: 100022
   Summary: Parameter packs not expanded with alignas specifier
   Product: gcc
   Version: 11.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: hewillk at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/49KvrsM9W

template 
void g() {
  ([] { struct alignas(Ns) S {}; }, ...);
}

gcc rejects it.

  1   2   3   4   5   6   >