ada/9927: Compiler doesn't inline static const int's used in ?:

acbell@iastate.edu acbell@iastate.edu
Mon Mar 3 21:46:00 GMT 2003


>Number:         9927
>Category:       ada
>Synopsis:       Compiler doesn't inline static const int's used in ?:
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 03 21:46:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Andrew Bell
>Release:        3.2.1
>Organization:
>Environment:
$ uname -a
SunOS nrias1 5.9 Generic_112233-03 sun4u sparc SUNW,Sun-Fire-280R
>Description:
Compiler doesn't inline public static const int's when used in a "?:" construct.

This worked in 2.95.2.

$ gcc -v
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.9/3.2.1/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --disable-nls
Thread model: posix
gcc version 3.2.1
>How-To-Repeat:
#include <iostream>

class Foo
{
public:
  static const int BAR = 1;
  static const int BAZ = 2;
};

int main()
{
  int a = 0;

  a = (a > 0) ? Foo::BAR : Foo::BAZ;
  std::cerr << "a = " << a << "!\n";

  return (0);
}

-----------------------

$ g++ main.cc
Undefined                       first referenced
 symbol                             in file
Foo::BAR                            /var/tmp//cc7VHQLZ.o
Foo::BAZ                            /var/tmp//cc7VHQLZ.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list