[Bug c++/93633] New: ICE on consteval virtual

2020-02-08 Thread tyker at outlook dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93633

Bug ID: 93633
   Summary: ICE on consteval virtual
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tyker at outlook dot com
  Target Milestone: ---

I know that consteval virtual is not yet supported. but not crashing seems like
that bare minimum.

gcc trunk currently crashes on the following code.
struct A {
consteval virtual int f() {
return 1;
}
};

struct B : A {
consteval virtual int f() {
return 0;
}
};

consteval int f() {
A* a = new B();
return a->f();
}

int main() {
return f();
}

https://godbolt.org/z/TR5tLZ

[Bug c++/92073] New: references/pointers to thread_local are not constant expressions

2019-10-11 Thread tyker at outlook dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92073

Bug ID: 92073
   Summary: references/pointers to thread_local are not constant
expressions
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tyker at outlook dot com
  Target Milestone: ---

currently gcc accepts the folowing:
```
template
struct A {};

static thread_local int b;

A a;
```
this is not valid. 
http://eel.is/c++draft/expr.const#10.2
says if a constant expression is a pointer to an object it should be in static
storage.

also, compilers(icc, clang, msvc) reject this code https://godbolt.org/z/d47fb9

[Bug c++/91768] New: gcc try to resolve member of template parameter too soon

2019-09-14 Thread tyker at outlook dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91768

Bug ID: 91768
   Summary: gcc try to resolve member of template parameter too
soon
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tyker at outlook dot com
  Target Milestone: ---

the following code is valid according to clang, msvc and icc but not gcc:

template
struct A {
int test(T* Ptr) {
return Ptr->type::test();
}
};

example with use:
https://godbolt.org/z/9XYQ4k

[Bug c++/91538] New: ICE with generic lambda.

2019-08-24 Thread tyker at outlook dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91538

Bug ID: 91538
   Summary: ICE with generic lambda.
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tyker at outlook dot com
  Target Milestone: ---

the following code make gcc trunk crash

void f() {
auto l = [](auto... args, decltype(args)...){};
l(0);
}

https://godbolt.org/z/kjwbcW

[Bug c++/90814] New: gcc accept invalid constexpr defaulted constructor

2019-06-10 Thread tyker at outlook dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90814

Bug ID: 90814
   Summary: gcc accept invalid constexpr defaulted constructor
   Product: gcc
   Version: 10.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tyker at outlook dot com
  Target Milestone: ---

with gcc, the following code doesn't emit an error if INCORRECT is set.

struct A {
  A() {}
};

template
struct D : A {
#ifdef INCORRECT
  int& r;
#endif
};

struct B {
  D<> d;
  constexpr B() = default;
};

example : https://godbolt.org/z/oAVthP

[Bug c++/90210] New: [C++17] CTAD forbidding explicit deduction guide for copy-list-initialization

2019-04-23 Thread tyker at outlook dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90210

Bug ID: 90210
   Summary: [C++17] CTAD forbidding explicit deduction guide for
copy-list-initialization
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tyker at outlook dot com
  Target Milestone: ---

gcc currently allows the following code:

template struct tuple { tuple(T); };
template explicit tuple(T t) -> tuple;
tuple t = { 1 };

this should fail to compile because the deduction guide is marked explicit.
the issue may come from the implicit deduction guide not being overridden by
the user defined one.

example from other compilers:
https://godbolt.org/z/M198L5

the standard says in [over.match.list]:
"In copy-list-initialization, if an explicit constructor is chosen, the
initialization is ill-formed."

[Bug c++/86949] New: gcc generate an error because delete operator is private when it isn't needed

2018-08-14 Thread tyker at outlook dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86949

Bug ID: 86949
   Summary: gcc generate an error because delete operator is
private when it isn't needed
   Product: gcc
   Version: 9.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tyker at outlook dot com
  Target Milestone: ---

in this code:

#include 

struct X {
X() noexcept { }
private:
static void operator delete(void*);
};

int main() { 
X* x = new(std::nothrow) X{}; 
}

the delete operator is private but it isn't needed because the contructor and
the allocator can't throw. but gcc generate an error complaining that the
delete operator is private.

all other majors complier complie this code without errors except gcc:
https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAKxAEZSAbAQwDtRkBSAJgCFufSAZ1QBXYskwgA5NwDMeFsgYisAag6yAwi0wB3Ddg4AGAILGTggsRHICqgBrqA7H1Or3DiAEpVLVJgAPCQAHOw4XZwARcw9VYOI8ADcmAkkYj0sUvGRVRNQ8dFVUYMxiFJJVLAZMVIg8goAqLw1XMydo2VbzBTsAWyYFb2cedTcPewbVAPVZSN89CEt0EBA/AgRiVF0fe3C%2BdpbRtsipL0ZpAFYpUhZpI2vUaU1%2BflVhMQl1Lllaa4I705nADWIFkXAAdAA2IwXGGyIwADgRABYuABOIzI85SZHXW5Se6kR5Sa6CEBGUj/AmnUhwWAwRAoVC9YJ4apkCgQNAstmlEDABFcUgAMzZqWIZIgACMAaQpQomMQAJ7SX6kbm9TAsAgAeRYDBV1NIWH6bGqsvwxEwtiSmDJRsC1pEqVV1x6mAYsqseF6rrOzDYKBevEYeClZMgZ2KBDwqBY9tJonEklo/sueNlxICCMhAFpIcjVMBkDkEeCuKoILhCBU5PRVJpmaz2V8fj5nrx%2BH8AV5gSAuLRwcjUZDZE40VxkU5ZBdaLRZNjcaRfci0eCnJCMRcfrQnE5BWj6PjCcTSeTKT3aQyIEhuc3SuRKHfecQUAxaGiAPoFkVi0qSmUjXlFhFUNNUNS1XV9UNQkTVYYBzSNS1rRjRI7VlR1kGdSQpDVd1PSNb1fVwmkA3YYMBAYMMI28IlQljeNpETD4UzTKQrhuTNpGzPMC1UABZABlAA1TRVA/VQuCMXdVAAJQAFQAdUrasiGIVt60bHkWzkLh2wo7tqV7UgEEwJgsFfWiCKXX1YXLeE0WRSEkS4AcnCPLiSSEc8qXuYyQVkWR12%2BSELgLWgkWRGcnAubFZAzI1TwvIyr3gOlGWfdlHy5JsXxAbJkAi38GHFADZWA0DXXVZlNW1PUDQtTBTQQnDYLwK0bTQ%2B1CUw7Cqvwr0EmI35/XgoNOxDKjw3gKN6LjBMhCTCQ6DYjjjwebic3zQsCvEssjHBIwVPwNSNNIBtcp075ZH0iaeEMvy%2B0C9c0QuWdBSMJwuAPehrOuFc10ii4uFCi4kUPJzOMSpjvIpXyaXSm8mW0h9OUyvklHg6EKVFEr/0oQDCQq5UqoguroMa5rELajrUPQh0AidF0SPIbUPUGn0/UYMbODu0NpsjOiY3mmH3mTFbsTWzyeO21RMbYVRIUOw7jprdS63OrT73V75kVuvheAewETLMizKDYmyQDsucLinWRhznRFtyxdaiVFnyeyeoLIXc9FMQnL7p0hSE4oSk8Yfh4yCK4MONq8yOzjQiUGJAZEgA%3D%3D

note that in this code:

#include 

struct X {
X() noexcept { }
static void operator delete(void*) = delete;
};

int main() { 
X* x = new(std::nothrow) X{}; 
}

where the operator delete isn't needed and explicitly deleted gcc compiles
correctly.