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.
Questions tagged [compiler-bug]
309 questions
2
votes
1 answer
VS2008 SP1: No appropriate default constructor available when pushing a pair into vector
Background
Class Foo has user-declared constructor and thus no implicitly-declared default constructor:
struct Foo {
Foo(...) {...}
};
It is then used in the std::vector of std::pair as follows:
std::vector…

AMA
- 4,114
- 18
- 32
2
votes
1 answer
Should this compile?
I have the following code:
#include "type_traits"
template
struct thing{
template
struct inner {
static T_& impl_0 (void* me ) { return static_cast(me )->operator*(); }
static auto…

DarthRubik
- 3,927
- 1
- 18
- 54
2
votes
0 answers
kbuild C: ~ Operator Converts Unsigned to Signed?
In a Linux kernel module there are definitions for a number of things that are in stdint.h/limits.h for user mode C but are conspicuously missing from the standard kernel headers. E.g. the following:
#define UINT16_MIN (uint16_t)0
#define UINT16_MAX…

Justin Olbrantz
- 647
- 3
- 11
2
votes
0 answers
VS 2015 Update 3 Internal compiler Error when curiously recursive template pattern with name hiding is used
Here is a small,standalone use case that I am trying to compile using VS2015 Update 3 compiler.
template class BaseClass
{
public:
void NameHidingMethod(SomeType const & node)
{
// Do…

Recker
- 1,915
- 25
- 55
2
votes
1 answer
VS2010 Bug When Passing 64 bit enum to Printf
Some weird result encountered in VC++2010:
enum dow :unsigned long long {mon=0x800022223333ULL,tue};
int _tmain(int argc, _TCHAR* argv[])
{
dow a=mon;
unsigned long long b=0x800022223333ULL;
printf("%d\n",sizeof(a));
…

JavaMan
- 4,954
- 4
- 41
- 69
2
votes
1 answer
Template substitution fails when I change the type parameter name - compiler bug?
Most of the following code has been taken from an answer by Piotr Skotnicki. I was experimenting with it and discovered what I believe to be a bug in MSVC 14.0 Update 3.
Consider the following code:
#include
template
struct…

user4520
- 3,401
- 1
- 27
- 50
2
votes
1 answer
Strange template instantiation bug with non-type argument
The following C++11 code compiles with g++ 4.7.4, g++ 4.8.5, g++ 4.9.3 and g++ 5.3.0, but not with clang++ 3.7.1 or clang++ 3.8.0 (trunk 254750):
template struct MetaValue {};
template class IntSpec;
template …

jotik
- 17,044
- 13
- 58
- 123
2
votes
1 answer
VS2013 : compiler bug with float and /EHa + /fp:strict?
We just moved from VS2010 to VS2013 and I found a strange bug and I wonder it might be due to the compiler.
Compiled with the command line cl ConsoleApplication1.cpp /EHa /fp:strict /O2 the following program gives :
0xC0000005: Access violation…

BenjaminB
- 1,809
- 3
- 18
- 32
2
votes
2 answers
Iterating over a temporary std::initializer_list with range based for
Given this code
#include
#include
#include
int a, b;
int main() {
for (auto p : std::initializer_list>{
{ a, "a" },
{ b, "b" },
})
{
std::cout…

nwp
- 9,623
- 5
- 38
- 68
2
votes
1 answer
Delphi 5 compiler bug returning interface pointer rather than return value
I present you a bug in the Delphi 5 compiler. I know there's not going to be any fix for it; but a workaround would be super
program Project1;
uses
Dialogs, SysUtils;
{$R *.RES}
type
IFoo = interface
…

Ian Boyd
- 246,734
- 253
- 869
- 1,219
2
votes
0 answers
When does Delphi call _CopyRecord on const parameters in generic inline functions?
When comparing two managed records using a inline generic class function with const parameters CopyRecord gets called on the records.
This causes the pointers inside the records to change and two (previously) equal records to not test equal.…

Johan
- 74,508
- 24
- 191
- 319
2
votes
1 answer
Is it a user error to declare a generic inline function `const` for shortstring, or is this a compiler bug?
The compiler generates incorrect code for shortstring when using the function
function TTestObject.Compare(const Left, Right: T): integer; inline;
It mangles the parameters.
The following sample program demonstrates the concept:
program…

Johan
- 74,508
- 24
- 191
- 319
2
votes
2 answers
Why does this code seem to exhibit a bug?
I've got a CanExecute for a WPF command that seems to work differently depending on how explicit I am with the compiler; the problem is, I wouldn't expect to have to be explicit.
private bool CanRemoveField()
{
return SelectedField != null &&
…

Clint
- 6,133
- 2
- 27
- 48
2
votes
1 answer
Swift @autoclosure evaluation influenced by type annotations? (compiler bug?)
I played around with Swift again today and was in need of a undefined() function. Basically a function that can be any type you want but crashes when it's actually run/evaluated. That's useful if you haven't had the time to implement a certain…

Johannes Weiss
- 52,533
- 16
- 102
- 136
2
votes
1 answer
Generified static method invocation not compiling in Java 8
Long story short, following code is not compiling in Java 8 but was compiling and executing well in Java 7:
public static void main(final String[] args) {
final Class instance = null;
meth(instance); // compiler error here
}
private static…

Yuriy Nakonechnyy
- 3,742
- 4
- 29
- 41