Questions tagged [compiler-bug]

For questions about (suspected) incorrect behavior of a compiler. Use with the appropriate language tag and, where applicable, with the tag for the compiler in question.

309 questions
1
vote
2 answers

Can't get Java enum that implements interface which extends another interface to compile

I want to create an enum that implements I2, which extends I1: package a; import static a.E1.E1A; interface I1 extends I1 {} interface I2 extends I1 {} enum E1 implements I2 { E1A, A1B; } class A { public static void main(String[] args) { …
Dog
  • 7,707
  • 8
  • 40
  • 74
1
vote
1 answer

VS2012 - Decltype as template parameter in trailing return type

The following code works on gcc and even VC11 Nov CTP, but fails to compile with VC11 RTM. template struct A { typedef typename T::Type BreakMe; T x; }; struct B { typedef int Type; }; template struct C { static…
1
vote
3 answers

Why empty assignment compiled with no errors

Here is my snippet: var country = BLLocations.Instance.GetCountries(); ddlCountry.DataSource = ddlCountry.DataTextField = "Country"; ddlCountry.DataValueField = "CountryCode"; ddlCountry.DataBind(); See the second line: ddlCountry.DataSource =…
Moons
  • 3,833
  • 4
  • 49
  • 82
0
votes
1 answer

Calling function type alias instead of function

Consider the following code: #include using f = void(std::string); void fcorrect(f func, std::string s) { func(s); // calling function }; void fmistake(f func, std::string s) { f(s); // calling type alias instead of…
vtm11
  • 165
  • 1
  • 9
0
votes
0 answers

alignas attribute ignored when address sanitizer is used -- gcc bug?

GCC codegen doesn't seem to align stack variables with the specified alignment value, when the address sanitizer is used. The following code causes an assertion failure on g++ (GCC) 13.1.1 20230429, arch x86_64 GNU/Linux, when the flag…
0
votes
1 answer

Compiler bug when implementing core::fmt::Write

When implementing core::fmt::Write for an avr serial monitor, calling unwrap on write_str writes what looks like a compiler error to the output. Calling write_fmt in any capacity crashes, but I think these problems might be related. I'm using a…
Kestrel
  • 3
  • 2
0
votes
0 answers

Different behavior with user defined default constructor (only MSVC)

I came across the following problem, with two classes X and Y where Y has a member of type X If I then: create a vector of objects of type Y via std::vector list = {{}} and Y has a defaulted default constructor One of the instances of type X…
0
votes
1 answer

Why do I get different results for complex multiplication involving NaN with gcc depending on optimisation level?

Consider the following code: #include #include #include int main() { complex double A = CMPLX(-NAN, 0.0); complex double B = CMPLX(NAN, 0.0); printf("A = %e %e, B = %e %e\n", creal(A), cimag(A), creal(B),…
fuz
  • 88,405
  • 25
  • 200
  • 352
0
votes
1 answer

Xcode 13.3 Compiler Bug with multiple nil coalescing operators?

A colleague came up with an issue with the nil coalescing operator starting with Xcode 13.3 and 13.3.1 (Swift 5.6), which I was able to reproduce. The following example always crashes, but worked fine till Xcode 13.2.1. fileprivate typealias Closure…
Frederik Winkelsdorf
  • 4,383
  • 1
  • 34
  • 42
0
votes
0 answers

Why does the latest Clang still report missing default argument on a parameter pack?

#include enum Math { ONE }; template void foo (T t = {}, Args&& ...) {} class A {}; int main () { foo(); // OK foo(""); // OK foo("", 0); //…
iammilind
  • 68,093
  • 33
  • 169
  • 336
0
votes
0 answers

gcc not catching blatant uninitialized variable

I'm compiling this code with gcc 11.2.0 and the -Wuninitialized switch, but I don't get any warning in spite of bar_uninitialized being used uninitialized: #include #include using std::vector; using std::cout; void foo(int…
Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
0
votes
0 answers

Why MSVC still compiles to error for calling a method after removing const-ness of the object?

To avoid complexity, below is a minimal example. For some reason, I have to pass normal object as const to some method and use it as such: #include #define CALL(OBJECT, METHOD) \ …
iammilind
  • 68,093
  • 33
  • 169
  • 336
0
votes
0 answers

Why is GCC not allowing me to capture something by reference, while Clang allows it?

This is with C++20 (-std=c++20), GCC 10.2.0 and Clang 11.1.0. I have a class Graph with a data member prefix_to_presufs. In my code, I make a std::unique_ptr to a Graph like so: auto gr{std::make_unique()}; then I try to do this: auto…
user2373145
  • 332
  • 2
  • 14
0
votes
1 answer

Cortex-M compiler generates improper FOR loop

Tested and reproduced on Cortex-M 4 and Cortex-M 0. I have discovered an issue with the GCC compiler. When a function is declared as type int (non-void), and contains a for loop, but does not have a return statement, the for loop will not break;…
0
votes
1 answer

Specifyin "enum" in a using statement - does it make a difference?

A "sanity check" question for language lawyers / nitpickers: In this snippet of code: enum my_enum { AValue1, AValue2 }; using alias_1 = enum my_enum; using alias_2 = my_enum; can there be any sort of difference between alias_1 and alias_2? That…
einpoklum
  • 118,144
  • 57
  • 340
  • 684